Loading autocnet/examples/Apollo15/three_image_adjacency.json 0 → 100644 +6 −0 Original line number Diff line number Diff line {"autocnet/examples/Apollo15/AS15-M-0297_SML.png": ["autocnet/examples/Apollo15/AS15-M-0298_SML.png", "autocnet/examples/Apollo15/AS15-M-0299_SML.png"], "autocnet/examples/Apollo15/AS15-M-0298_SML.png": ["autocnet/examples/Apollo15/AS15-M-0297_SML.png", "autocnet/examples/Apollo15/AS15-M-0299_SML.png"], "autocnet/examples/Apollo15/AS15-M-0299_SML.png": ["autocnet/examples/Apollo15/AS15-M-0297_SML.png", "autocnet/examples/Apollo15/AS15-M-0298_SML.png"]} autocnet/fileio/io_controlnetwork.py +1 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ def to_isis(path, C, mode='w', version=VERSION, store.write(header) class IsisStore(object): """ Class to manage IO of an ISIS control network (version 2). Loading autocnet/graph/network.py +39 −5 Original line number Diff line number Diff line from functools import reduce import operator as op import os import networkx as nx Loading @@ -15,6 +13,7 @@ from autocnet.fileio.io_gdal import GeoDataset from autocnet.matcher import feature_extractor as fe # extract features from image from autocnet.matcher import outlier_detector as od class CandidateGraph(nx.Graph): """ A NetworkX derived directed graph to store candidate overlap images. Loading Loading @@ -252,14 +251,46 @@ class CandidateGraph(nx.Graph): """ Generate a control network (C) object from a graph Parameters ---------- clean_keys : list of strings identifying the masking arrays to use, e.g. ratio, symmetry Returns ------- merged_cnet : C A control network object """ clean_keys : list of strings identifying the masking arrays to use, e.g. ratio, symmetry def _validate_cnet(cnet): """ Once the control network is aggregated from graph edges, ensure that a given correspondence in a given image does not match multiple correspondences in a different image. Parameters ---------- cnet : C control network object Returns ------- : C the cleaned control network """ mask = np.zeros(len(cnet), dtype=bool) counter = 0 for i, group in cnet.groupby('pid'): group_size = len(group) if len(group) != len(group['nid'].unique()): mask[counter: counter + group_size] = False else: mask[counter: counter + group_size] = True counter += group_size return cnet[mask] merged_cnet = None for source, destination, attributes in self.edges_iter(data=True): Loading Loading @@ -317,6 +348,9 @@ class CandidateGraph(nx.Graph): merged_cnet = pd.concat([merged_cnet, cnet]) merged_cnet.drop_duplicates(['idx', 'pid'], keep='first', inplace=True) # Final validation to remove any correspondence with multiple correspondences in the same image merged_cnet = _validate_cnet(merged_cnet) return merged_cnet def to_json_file(self, outputfile): Loading autocnet/matcher/matcher.py +0 −3 Original line number Diff line number Diff line Loading @@ -41,9 +41,6 @@ def pattern_match(template, image, upsampling=10, strength : float The strength of the correlation in the range [-1, 1]. """ if upsampling < 1: raise ValueError Loading autocnet/matcher/tests/test_feature_extractor.py +4 −2 Original line number Diff line number Diff line Loading @@ -12,8 +12,10 @@ from autocnet.fileio import io_gdal class TestFeatureExtractor(unittest.TestCase): def setUp(self): self.dataset = io_gdal.GeoDataset(get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif')) @classmethod def setUpClass(self): self.dataset = io_gdal.GeoDataset(get_path('AS15-M-0295_SML.png')) self.data_array = self.dataset.read_array() self.parameters = {"nfeatures" : 10, "nOctaveLayers" : 3, Loading Loading
autocnet/examples/Apollo15/three_image_adjacency.json 0 → 100644 +6 −0 Original line number Diff line number Diff line {"autocnet/examples/Apollo15/AS15-M-0297_SML.png": ["autocnet/examples/Apollo15/AS15-M-0298_SML.png", "autocnet/examples/Apollo15/AS15-M-0299_SML.png"], "autocnet/examples/Apollo15/AS15-M-0298_SML.png": ["autocnet/examples/Apollo15/AS15-M-0297_SML.png", "autocnet/examples/Apollo15/AS15-M-0299_SML.png"], "autocnet/examples/Apollo15/AS15-M-0299_SML.png": ["autocnet/examples/Apollo15/AS15-M-0297_SML.png", "autocnet/examples/Apollo15/AS15-M-0298_SML.png"]}
autocnet/fileio/io_controlnetwork.py +1 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ def to_isis(path, C, mode='w', version=VERSION, store.write(header) class IsisStore(object): """ Class to manage IO of an ISIS control network (version 2). Loading
autocnet/graph/network.py +39 −5 Original line number Diff line number Diff line from functools import reduce import operator as op import os import networkx as nx Loading @@ -15,6 +13,7 @@ from autocnet.fileio.io_gdal import GeoDataset from autocnet.matcher import feature_extractor as fe # extract features from image from autocnet.matcher import outlier_detector as od class CandidateGraph(nx.Graph): """ A NetworkX derived directed graph to store candidate overlap images. Loading Loading @@ -252,14 +251,46 @@ class CandidateGraph(nx.Graph): """ Generate a control network (C) object from a graph Parameters ---------- clean_keys : list of strings identifying the masking arrays to use, e.g. ratio, symmetry Returns ------- merged_cnet : C A control network object """ clean_keys : list of strings identifying the masking arrays to use, e.g. ratio, symmetry def _validate_cnet(cnet): """ Once the control network is aggregated from graph edges, ensure that a given correspondence in a given image does not match multiple correspondences in a different image. Parameters ---------- cnet : C control network object Returns ------- : C the cleaned control network """ mask = np.zeros(len(cnet), dtype=bool) counter = 0 for i, group in cnet.groupby('pid'): group_size = len(group) if len(group) != len(group['nid'].unique()): mask[counter: counter + group_size] = False else: mask[counter: counter + group_size] = True counter += group_size return cnet[mask] merged_cnet = None for source, destination, attributes in self.edges_iter(data=True): Loading Loading @@ -317,6 +348,9 @@ class CandidateGraph(nx.Graph): merged_cnet = pd.concat([merged_cnet, cnet]) merged_cnet.drop_duplicates(['idx', 'pid'], keep='first', inplace=True) # Final validation to remove any correspondence with multiple correspondences in the same image merged_cnet = _validate_cnet(merged_cnet) return merged_cnet def to_json_file(self, outputfile): Loading
autocnet/matcher/matcher.py +0 −3 Original line number Diff line number Diff line Loading @@ -41,9 +41,6 @@ def pattern_match(template, image, upsampling=10, strength : float The strength of the correlation in the range [-1, 1]. """ if upsampling < 1: raise ValueError Loading
autocnet/matcher/tests/test_feature_extractor.py +4 −2 Original line number Diff line number Diff line Loading @@ -12,8 +12,10 @@ from autocnet.fileio import io_gdal class TestFeatureExtractor(unittest.TestCase): def setUp(self): self.dataset = io_gdal.GeoDataset(get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif')) @classmethod def setUpClass(self): self.dataset = io_gdal.GeoDataset(get_path('AS15-M-0295_SML.png')) self.data_array = self.dataset.read_array() self.parameters = {"nfeatures" : 10, "nOctaveLayers" : 3, Loading