From 29eda007bb00645f112f37775be3a6132087ee2e Mon Sep 17 00:00:00 2001 From: oulenz Date: Wed, 22 Feb 2017 17:45:21 +0100 Subject: [PATCH 1/3] Fix `FLANN_INDEX_KDTREE`, add `FLANN_INDEX_LSH` initialisation Add initialisations to make clear what values actually have to be passed. Moreover, in accordance with https://github.com/opencv/opencv/blob/383559c2285baaf3df8cf0088072d104451a30ce/modules/flann/include/opencv2/flann/defines.h#L68, I believe `FLANN_INDEX_KDTREE` was being initialised wrongly in the code examples, 1 should be correct, whereas 0 is `FLANN_INDEX_LINEAR`. --- doc/py_tutorials/py_feature2d/py_matcher/py_matcher.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.markdown b/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.markdown index a37d579944..a04715438b 100644 --- a/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.markdown +++ b/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.markdown @@ -148,11 +148,13 @@ its related parameters etc. First one is IndexParams. For various algorithms, th passed is explained in FLANN docs. As a summary, for algorithms like SIFT, SURF etc. you can pass following: @code{.py} +FLANN_INDEX_KDTREE = 1 index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5) @endcode While using ORB, you can pass the following. The commented values are recommended as per the docs, but it didn't provide required results in some cases. Other values worked fine.: @code{.py} +FLANN_INDEX_LSH = 6 index_params= dict(algorithm = FLANN_INDEX_LSH, table_number = 6, # 12 key_size = 12, # 20 @@ -179,7 +181,7 @@ kp1, des1 = sift.detectAndCompute(img1,None) kp2, des2 = sift.detectAndCompute(img2,None) # FLANN parameters -FLANN_INDEX_KDTREE = 0 +FLANN_INDEX_KDTREE = 1 index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5) search_params = dict(checks=50) # or pass empty dictionary From 9cb13435a128c8536648a05944434fe3fb0822d1 Mon Sep 17 00:00:00 2001 From: oulenz Date: Wed, 22 Feb 2017 19:10:33 +0100 Subject: [PATCH 2/3] FLANN_INDEX_KDTREE = 0 -> 1 0 corresponds to FLANN_INDEX_LINEAR --- .../py_feature_homography/py_feature_homography.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown b/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown index 4f5efa4a82..85547541f5 100644 --- a/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown +++ b/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown @@ -50,7 +50,7 @@ sift = cv2.xfeatures2d.SIFT_create() kp1, des1 = sift.detectAndCompute(img1,None) kp2, des2 = sift.detectAndCompute(img2,None) -FLANN_INDEX_KDTREE = 0 +FLANN_INDEX_KDTREE = 1 index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5) search_params = dict(checks = 50) From 28cfb07445b845ae19be904ecea866fae5126ee1 Mon Sep 17 00:00:00 2001 From: oulenz Date: Wed, 22 Feb 2017 19:13:34 +0100 Subject: [PATCH 3/3] FLANN_INDEX_KDTREE = 0 -> 1 0 corresponds to FLANN_INDEX_LINEAR --- .../py_epipolar_geometry/py_epipolar_geometry.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_calib3d/py_epipolar_geometry/py_epipolar_geometry.markdown b/doc/py_tutorials/py_calib3d/py_epipolar_geometry/py_epipolar_geometry.markdown index 0b63515c53..432773d3b2 100644 --- a/doc/py_tutorials/py_calib3d/py_epipolar_geometry/py_epipolar_geometry.markdown +++ b/doc/py_tutorials/py_calib3d/py_epipolar_geometry/py_epipolar_geometry.markdown @@ -86,7 +86,7 @@ kp1, des1 = sift.detectAndCompute(img1,None) kp2, des2 = sift.detectAndCompute(img2,None) # FLANN parameters -FLANN_INDEX_KDTREE = 0 +FLANN_INDEX_KDTREE = 1 index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5) search_params = dict(checks=50)