summaryrefslogtreecommitdiff
path: root/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py
diff options
context:
space:
mode:
Diffstat (limited to 'samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py')
-rw-r--r--samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py b/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py
index d22f9a8a6f..1a65d324fd 100644
--- a/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py
+++ b/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py
@@ -28,10 +28,9 @@ knn_matches = matcher.knnMatch(descriptors1, descriptors2, 2)
#-- Filter matches using the Lowe's ratio test
ratio_thresh = 0.7
good_matches = []
-for matches in knn_matches:
- if len(matches) > 1:
- if matches[0].distance / matches[1].distance <= ratio_thresh:
- good_matches.append(matches[0])
+for m,n in knn_matches:
+ if m.distance / n.distance <= ratio_thresh:
+ good_matches.append(m)
#-- Draw matches
img_matches = np.empty((max(img1.shape[0], img2.shape[0]), img1.shape[1]+img2.shape[1], 3), dtype=np.uint8)