Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

match() & knnMatch duplicates results

Hello, I'm found a problem in my Andorid (NDK) implementation of Feature Detector + Descriptor + Matcher.

I'm using knnMatch with k = 2 to match descriptors extracted from camera frame.

Then I filter outliers with ratio test, checking the ratio between the first match "distance" property and the second match "distance" property, for each.

If the ratio is smaller then a threshold then i save the first match in a new vector containing only "good matches". I also save trainIdx and queryIdx corresponding to each "good match" in 2 vecors.

So now I expect that one between trainIdx vector and queryIdx vector does not contain duplicates. I think this because I expect that knnMatch() and match() functions cicle through all the descriptors of train (OR query) descriptor-vectors and find the best (or best 2) matches in the other descriptor-vector. In this way there could be duplicates between query indexes, because 2 train descriptors CAN match the same query descriptor, but there should not be duplicates in the train indexes! Even if the match are computed in the opposite way (functions cicle through all the descriptors of query descriptor-vectors and find the best (or best 2) matches in the train descriptor-vector), one of the two indexes vectors must not have duplicates.

So I'm doing something wrong, or the matching functions work in a different way from what I think?

Notes: I'm using ORB keypoint detector and descriptor extractor, and BFMatcher.

match() & knnMatch duplicates results

Hello, I'm found I have a problem in my Andorid (NDK) implementation of Feature Detector + Descriptor + Matcher.

I'm using knnMatch with k = 2 to match descriptors extracted from camera frame.

Then I filter outliers with ratio test, checking the ratio between the first match "distance" property and the second match "distance" property, for each.

If the ratio is smaller then a threshold then i save the first match in a new vector containing only "good matches". I also save trainIdx and queryIdx corresponding to each "good match" in 2 vecors.

So now I expect that one between trainIdx vector and queryIdx vector does not contain duplicates. I think this because I expect that knnMatch() and match() functions cicle through all the descriptors of train (OR query) descriptor-vectors and find the best (or best 2) matches in the other descriptor-vector. In this way there could be duplicates between query indexes, because 2 train descriptors CAN match the same query descriptor, but there should not be duplicates in the train indexes! Even if the match are computed in the opposite way (functions cicle through all the descriptors of query descriptor-vectors and find the best (or best 2) matches in the train descriptor-vector), one of the two indexes vectors must not have duplicates.

So I'm doing something wrong, or the matching functions work in a different way from what I think?

Notes: I'm using ORB keypoint detector and descriptor extractor, and BFMatcher.

match() & knnMatch duplicates results

Hello, I have a problem in my Andorid (NDK) implementation of Feature Detector + Descriptor + Matcher.

I'm using knnMatch with k = 2 to match descriptors extracted from camera frame.frame to descriptor extracted from a fixed image.

Then I filter outliers with ratio test, checking the ratio between the first match "distance" property and the second match "distance" property, for each.

If the ratio is smaller then a threshold then i save the first match in a new vector containing only "good matches". I also save trainIdx and queryIdx corresponding to each "good match" in 2 vecors.

So now I expect that one between trainIdx vector and queryIdx vector does not contain duplicates. I think this because I expect that knnMatch() and match() functions cicle through all the descriptors of train (OR query) descriptor-vectors and find the best (or best 2) matches in the other descriptor-vector. In this way there could be duplicates between query indexes, because 2 train descriptors CAN match the same query descriptor, but there should not be duplicates in the train indexes! Even if the match are computed in the opposite way (functions cicle through all the descriptors of query descriptor-vectors and find the best (or best 2) matches in the train descriptor-vector), one of the two indexes vectors must not have duplicates.

So I'm doing something wrong, or the matching functions work in a different way from what I think?

Notes: I'm using ORB keypoint detector and descriptor extractor, and BFMatcher.