is there a way to set a threshold for potential matched pairs of image descriptors calculated by DescriptorMatcher in OpenCV’s features2d?
In detail, I have a Bruteforce-Matcher with which I want to calculate descriptor pairs of two images and only pairs with a minimum distance of threshold should go in matches.
BFMatcher matcher(NORM_L2, true);
vector<DMatch> matches;
matcher.match(descriptors1, descriptors2, matches);
Thank’s for your help!
Ok, so I did some more reading and found some interesting Posts like How to use flann based matcher, or generally flann in opencv? and figured out my own way 😉
First I used FlannBasedMatcher to match the calculated descriptors. After that I sorted the matches (they get sorted by distance in ascending order by default). Created a second DMatch vector and just added the matches which had a distance below a distance-threshold chosen by me. Thats it. This way I can also choose the top N matches it the threshold is selected to bad.
May not be the best / cleanest way but it’s a quick solution which is ok for the prototypal situation.