Loading autocnet/graph/network.py +13 −6 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class CandidateGraph(nx.Graph): self.node_counter = 0 node_labels = {} self.node_name_map = {} self.graph_masks = {} self.graph_masks = pd.DataFrame() # the node_name is the relative path for the image for node_name, node in self.nodes_iter(data=True): Loading Loading @@ -368,15 +368,21 @@ class CandidateGraph(nx.Graph): of keys in graph_masks """ if graph_mask_keys: merged_graph_mask = self.graph_masks[graph_mask_keys].all(axis=1) edges_to_iter = merged_graph_mask[merged_graph_mask].index else: edges_to_iter = self.edges() if not isinstance(func, str): func = func.__name__ for s, d in edges_to_iter: curr_edge = self.get_edge_data(s, d) try: function = getattr(curr_edge, func) except: raise AttributeError('The passed function is not an attribute of Edge') raise AttributeError(func, ' is not an attribute of Edge') else: function(*args, **kwargs) Loading @@ -391,7 +397,9 @@ class CandidateGraph(nx.Graph): boolean mask for edges in the minimum spanning tree """ self.graph_masks = pd.DataFrame(False, index=self.edges(), columns=['mst']) graph_mask = pd.Series(False, index=self.edges()) self.graph_masks['mst'] = graph_mask mst = nx.minimum_spanning_tree(self) self.graph_masks['mst'][mst.edges()] = True Loading Loading @@ -503,7 +511,6 @@ class CandidateGraph(nx.Graph): : C the cleaned control network """ mask = np.zeros(len(cnet), dtype=bool) counter = 0 for i, group in cnet.groupby('pid'): Loading functional_tests/test_three_image.py +2 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,8 @@ class TestThreeImageMatching(unittest.TestCase): for source, destination, edge in cg.edges_iter(data=True): edge.symmetry_check() edge.ratio_check(clean_keys=['symmetry'], ratio=0.99) cg.compute_homographies(clean_keys=['symmetry', 'ratio']) cg.apply_func_to_edges("compute_homography", clean_keys=['symmetry', 'ratio']) # Step: And create a C object cnet = cg.to_cnet(clean_keys=['symmetry', 'ratio', 'ransac']) Loading functional_tests/test_two_image.py +2 −2 Original line number Diff line number Diff line Loading @@ -73,14 +73,14 @@ class TestTwoImageMatching(unittest.TestCase): self.assertIn(edge.masks['ratio'].sum(), range(40, 100)) # Step: Compute the homographies and apply RANSAC cg.compute_homographies(clean_keys=['symmetry', 'ratio']) cg.apply_func_to_edges("compute_homography", clean_keys=['symmetry', 'ratio']) # Step: Compute the overlap ratio and coverage ratio for s, d, edge in cg.edges_iter(data=True): edge.coverage_ratio(clean_keys=['symmetry', 'ratio']) # Step: Compute subpixel offsets for candidate points cg.subpixel_register(clean_keys=['ransac']) cg.apply_func_to_edges("subpixel_register", clean_keys=['ransac']) # Step: And create a C object cnet = cg.to_cnet(clean_keys=['symmetry', 'ratio', 'ransac', 'subpixel']) Loading notebooks/Tutorial with Visualization.ipynb +61 −35 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
autocnet/graph/network.py +13 −6 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class CandidateGraph(nx.Graph): self.node_counter = 0 node_labels = {} self.node_name_map = {} self.graph_masks = {} self.graph_masks = pd.DataFrame() # the node_name is the relative path for the image for node_name, node in self.nodes_iter(data=True): Loading Loading @@ -368,15 +368,21 @@ class CandidateGraph(nx.Graph): of keys in graph_masks """ if graph_mask_keys: merged_graph_mask = self.graph_masks[graph_mask_keys].all(axis=1) edges_to_iter = merged_graph_mask[merged_graph_mask].index else: edges_to_iter = self.edges() if not isinstance(func, str): func = func.__name__ for s, d in edges_to_iter: curr_edge = self.get_edge_data(s, d) try: function = getattr(curr_edge, func) except: raise AttributeError('The passed function is not an attribute of Edge') raise AttributeError(func, ' is not an attribute of Edge') else: function(*args, **kwargs) Loading @@ -391,7 +397,9 @@ class CandidateGraph(nx.Graph): boolean mask for edges in the minimum spanning tree """ self.graph_masks = pd.DataFrame(False, index=self.edges(), columns=['mst']) graph_mask = pd.Series(False, index=self.edges()) self.graph_masks['mst'] = graph_mask mst = nx.minimum_spanning_tree(self) self.graph_masks['mst'][mst.edges()] = True Loading Loading @@ -503,7 +511,6 @@ class CandidateGraph(nx.Graph): : C the cleaned control network """ mask = np.zeros(len(cnet), dtype=bool) counter = 0 for i, group in cnet.groupby('pid'): Loading
functional_tests/test_three_image.py +2 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,8 @@ class TestThreeImageMatching(unittest.TestCase): for source, destination, edge in cg.edges_iter(data=True): edge.symmetry_check() edge.ratio_check(clean_keys=['symmetry'], ratio=0.99) cg.compute_homographies(clean_keys=['symmetry', 'ratio']) cg.apply_func_to_edges("compute_homography", clean_keys=['symmetry', 'ratio']) # Step: And create a C object cnet = cg.to_cnet(clean_keys=['symmetry', 'ratio', 'ransac']) Loading
functional_tests/test_two_image.py +2 −2 Original line number Diff line number Diff line Loading @@ -73,14 +73,14 @@ class TestTwoImageMatching(unittest.TestCase): self.assertIn(edge.masks['ratio'].sum(), range(40, 100)) # Step: Compute the homographies and apply RANSAC cg.compute_homographies(clean_keys=['symmetry', 'ratio']) cg.apply_func_to_edges("compute_homography", clean_keys=['symmetry', 'ratio']) # Step: Compute the overlap ratio and coverage ratio for s, d, edge in cg.edges_iter(data=True): edge.coverage_ratio(clean_keys=['symmetry', 'ratio']) # Step: Compute subpixel offsets for candidate points cg.subpixel_register(clean_keys=['ransac']) cg.apply_func_to_edges("subpixel_register", clean_keys=['ransac']) # Step: And create a C object cnet = cg.to_cnet(clean_keys=['symmetry', 'ratio', 'ransac', 'subpixel']) Loading
notebooks/Tutorial with Visualization.ipynb +61 −35 File changed.Preview size limit exceeded, changes collapsed. Show changes