Loading autocnet/graph/network.py +0 −3 Original line number Diff line number Diff line Loading @@ -366,9 +366,6 @@ class CandidateGraph(nx.Graph): edge_offsets[i] = sp.subpixel_offset(s_template, d_search, upsampling=upsampling) # The destination node is the node that is subpixel registered, so downsample there edge_offsets[:, :2] /= d_node['downsampling'] # Compute the mask for correlations less than the threshold threshold_mask = edge_offsets[edge_offsets[:, -1] >= threshold] Loading autocnet/matcher/outlier_detector.py +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ def distance_ratio(matches, ratio=0.8): # The distances from the unique points are identical mask[counter: counter + group_size] = False counter += group_size elif unique[1] / unique[0] > ratio: elif unique[1] / unique[0] < ratio: # The ratio test passes mask[counter] = True mask[counter + 1:counter + group_size] = False Loading autocnet/matcher/tests/test_feature_extractor.py +3 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ class TestFeatureExtractor(unittest.TestCase): "sigma": 1.6} def test_extract_features(self): features = feature_extractor.extract_features(self.data_array, self.parameters) features = feature_extractor.extract_features(self.data_array, method='sift', extractor_parameters=self.parameters) self.assertEquals(len(features), 2) self.assertIn(len(features[0]), range(8,12)) self.assertIsInstance(features[0][0], type(cv2.KeyPoint())) Loading functional_tests/test_two_image.py +4 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ class TestTwoImageMatching(unittest.TestCase): self.assertEqual(1, cg.number_of_edges()) # Step: Extract image data and attribute nodes cg.extract_features(extractor_parameters={"nfeatures":500}) cg.extract_features(method='sift', extractor_parameters={"nfeatures":500}) for node, attributes in cg.nodes_iter(data=True): self.assertIn(len(attributes['keypoints']), range(490, 511)) Loading @@ -68,12 +68,12 @@ class TestTwoImageMatching(unittest.TestCase): attributes['symmetry'] = symmetry_mask # Perform the ratio test ratio_mask = od.distance_ratio(matches, ratio=0.95) self.assertIn(ratio_mask.sum(), range(390, 451)) ratio_mask = od.distance_ratio(matches, ratio=0.8) self.assertIn(ratio_mask.sum(), range(20, 100)) attributes['ratio'] = ratio_mask mask = np.array(ratio_mask * symmetry_mask) self.assertIn(len(matches.loc[mask]), range(75,101)) self.assertIn(len(matches.loc[mask]), range(5,50)) # Step: Compute the homographies and apply RANSAC cg.compute_homographies(clean_keys=['symmetry', 'ratio']) Loading Loading
autocnet/graph/network.py +0 −3 Original line number Diff line number Diff line Loading @@ -366,9 +366,6 @@ class CandidateGraph(nx.Graph): edge_offsets[i] = sp.subpixel_offset(s_template, d_search, upsampling=upsampling) # The destination node is the node that is subpixel registered, so downsample there edge_offsets[:, :2] /= d_node['downsampling'] # Compute the mask for correlations less than the threshold threshold_mask = edge_offsets[edge_offsets[:, -1] >= threshold] Loading
autocnet/matcher/outlier_detector.py +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ def distance_ratio(matches, ratio=0.8): # The distances from the unique points are identical mask[counter: counter + group_size] = False counter += group_size elif unique[1] / unique[0] > ratio: elif unique[1] / unique[0] < ratio: # The ratio test passes mask[counter] = True mask[counter + 1:counter + group_size] = False Loading
autocnet/matcher/tests/test_feature_extractor.py +3 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ class TestFeatureExtractor(unittest.TestCase): "sigma": 1.6} def test_extract_features(self): features = feature_extractor.extract_features(self.data_array, self.parameters) features = feature_extractor.extract_features(self.data_array, method='sift', extractor_parameters=self.parameters) self.assertEquals(len(features), 2) self.assertIn(len(features[0]), range(8,12)) self.assertIsInstance(features[0][0], type(cv2.KeyPoint())) Loading
functional_tests/test_two_image.py +4 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ class TestTwoImageMatching(unittest.TestCase): self.assertEqual(1, cg.number_of_edges()) # Step: Extract image data and attribute nodes cg.extract_features(extractor_parameters={"nfeatures":500}) cg.extract_features(method='sift', extractor_parameters={"nfeatures":500}) for node, attributes in cg.nodes_iter(data=True): self.assertIn(len(attributes['keypoints']), range(490, 511)) Loading @@ -68,12 +68,12 @@ class TestTwoImageMatching(unittest.TestCase): attributes['symmetry'] = symmetry_mask # Perform the ratio test ratio_mask = od.distance_ratio(matches, ratio=0.95) self.assertIn(ratio_mask.sum(), range(390, 451)) ratio_mask = od.distance_ratio(matches, ratio=0.8) self.assertIn(ratio_mask.sum(), range(20, 100)) attributes['ratio'] = ratio_mask mask = np.array(ratio_mask * symmetry_mask) self.assertIn(len(matches.loc[mask]), range(75,101)) self.assertIn(len(matches.loc[mask]), range(5,50)) # Step: Compute the homographies and apply RANSAC cg.compute_homographies(clean_keys=['symmetry', 'ratio']) Loading