pythonmatlabopencvcomputer-visionflann

Equivalent parameter 'Unique' in SIFT matching between FLANN matcher in OpenCv and matchFeature in matlab


I am porting to python a matlab software that matches images.

Since in matlab the function matchFeature is used with the parameter Unique set to true, it returns a list of matches where the keypoints don't repeat themselves (you can look up the function here: https://it.mathworks.com/help/vision/ref/matchfeatures.html). In python i use OpenCv for SIFT calculation and a FLANN based matcher. I tried to find an equivalent parameter for the FLANN matcher, but i didn't find any.

Does a parameter like this exists in OpenCv's matchers? if not, how can i select the matches with keypoints that do not repeate themselves?


Solution

  • The BruteForce Matcher does this with the parameter crossCheck=True. This matcher is roughly equivalent to Matlab's matchFeatures with 'Unique' = true and 'Method' = 'Exhaustive' (default). The OpenCV Flann matcher (similar to MATLAB's 'Method' = 'Approximate') would require you to implement your own crosschecking by searching for repeats of either the queryIdx or trainIdx members of the matches.