Loading autocnet/examples/Apollo15/three_image_adjacency.json +3 −6 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"]} {"AS15-M-0297_SML.png": ["AS15-M-0298_SML.png", "AS15-M-0299_SML.png"], "AS15-M-0298_SML.png": ["AS15-M-0297_SML.png", "AS15-M-0299_SML.png"], "AS15-M-0299_SML.png": ["AS15-M-0297_SML.png", "AS15-M-0298_SML.png"]} autocnet/graph/network.py +8 −3 Original line number Diff line number Diff line Loading @@ -376,7 +376,7 @@ class CandidateGraph(nx.Graph): ---------- """ def __init__(self,*args, **kwargs): def __init__(self,*args, basepath=None, **kwargs): super(CandidateGraph, self).__init__(*args, **kwargs) self.node_counter = 0 node_labels = {} Loading @@ -403,7 +403,7 @@ class CandidateGraph(nx.Graph): self.edge[s][d] = Edge(self.node[s], self.node[d]) @classmethod def from_adjacency(cls, input_adjacency): def from_adjacency(cls, input_adjacency, basepath=None): """ Instantiate the class using an adjacency dict or file. The input must contain relative or absolute paths to image files. Loading @@ -426,6 +426,11 @@ class CandidateGraph(nx.Graph): """ if not isinstance(input_adjacency, dict): input_adjacency = io_json.read_json(input_adjacency) if basepath is not None: for k, v in input_adjacency.items(): input_adjacency[k] = [os.path.join(basepath, i) for i in v] input_adjacency[os.path.join(basepath, k)] = input_adjacency.pop(k) return cls(input_adjacency) def get_name(self, node_index): Loading functional_tests/test_three_image.py +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ class TestThreeImageMatching(unittest.TestCase): def test_three_image(self): # Step: Create an adjacency graph adjacency = get_path('three_image_adjacency.json') cg = CandidateGraph.from_adjacency(adjacency) basepath = get_path('Apollo15') cg = CandidateGraph.from_adjacency(adjacency, basepath) self.assertEqual(3, cg.number_of_nodes()) self.assertEqual(3, cg.number_of_edges()) Loading functional_tests/test_two_image.py +2 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ class TestTwoImageMatching(unittest.TestCase): def test_two_image(self): # Step: Create an adjacency graph adjacency = get_path('two_image_adjacency.json') cg = CandidateGraph.from_adjacency(adjacency) basepath = get_path('Apollo15') cg = CandidateGraph.from_adjacency(adjacency, basepath=basepath) self.assertEqual(2, cg.number_of_nodes()) self.assertEqual(1, cg.number_of_edges()) Loading autocnet/vis/graph_view.py +1 −1 File changed.Contains only whitespace changes. Show changes Loading
autocnet/examples/Apollo15/three_image_adjacency.json +3 −6 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"]} {"AS15-M-0297_SML.png": ["AS15-M-0298_SML.png", "AS15-M-0299_SML.png"], "AS15-M-0298_SML.png": ["AS15-M-0297_SML.png", "AS15-M-0299_SML.png"], "AS15-M-0299_SML.png": ["AS15-M-0297_SML.png", "AS15-M-0298_SML.png"]}
autocnet/graph/network.py +8 −3 Original line number Diff line number Diff line Loading @@ -376,7 +376,7 @@ class CandidateGraph(nx.Graph): ---------- """ def __init__(self,*args, **kwargs): def __init__(self,*args, basepath=None, **kwargs): super(CandidateGraph, self).__init__(*args, **kwargs) self.node_counter = 0 node_labels = {} Loading @@ -403,7 +403,7 @@ class CandidateGraph(nx.Graph): self.edge[s][d] = Edge(self.node[s], self.node[d]) @classmethod def from_adjacency(cls, input_adjacency): def from_adjacency(cls, input_adjacency, basepath=None): """ Instantiate the class using an adjacency dict or file. The input must contain relative or absolute paths to image files. Loading @@ -426,6 +426,11 @@ class CandidateGraph(nx.Graph): """ if not isinstance(input_adjacency, dict): input_adjacency = io_json.read_json(input_adjacency) if basepath is not None: for k, v in input_adjacency.items(): input_adjacency[k] = [os.path.join(basepath, i) for i in v] input_adjacency[os.path.join(basepath, k)] = input_adjacency.pop(k) return cls(input_adjacency) def get_name(self, node_index): Loading
functional_tests/test_three_image.py +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ class TestThreeImageMatching(unittest.TestCase): def test_three_image(self): # Step: Create an adjacency graph adjacency = get_path('three_image_adjacency.json') cg = CandidateGraph.from_adjacency(adjacency) basepath = get_path('Apollo15') cg = CandidateGraph.from_adjacency(adjacency, basepath) self.assertEqual(3, cg.number_of_nodes()) self.assertEqual(3, cg.number_of_edges()) Loading
functional_tests/test_two_image.py +2 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ class TestTwoImageMatching(unittest.TestCase): def test_two_image(self): # Step: Create an adjacency graph adjacency = get_path('two_image_adjacency.json') cg = CandidateGraph.from_adjacency(adjacency) basepath = get_path('Apollo15') cg = CandidateGraph.from_adjacency(adjacency, basepath=basepath) self.assertEqual(2, cg.number_of_nodes()) self.assertEqual(1, cg.number_of_edges()) Loading