Ask Your Question
2

[Features2D] implementation differences of different Features Detectors/Extractors/Matchers

asked 2013-05-13 05:52:00 -0600

ShadowTS gravatar image

Hello, i'm testing images matching with Feature Detectors, Extractors and Matchers. I've found a problem when i try to use OrbFeatures. I'l try to explain.

If i use SURF in this way:

SurfFeatureDetector detector;
SurfDescriptorExtractor extractor;
BFMatcher matcher; //or Flann, not relevant
[...]//features detection and extraction here both for object and scene
std::vector< Mat > descriptors;
descriptors.push_back(descriptors_object);
matcher.clear();
matcher.add(descriptors);
matcher.train();
matcher.match( descriptors_scene, matches);

And then i print the DMatches this way:

//match is cycled through all the matches
printf("-- Match trainIdx, queryIdx, distance: %d, %d, %f \n", match.queryIdx, match.trainIdx, match.distance );

The result are matches ordered by trainIdx.

But when i use ORB this way:

OrbFeatureDetector detector;
OrbDescriptorExtractor extractor;
BFMatcher matcher;
[...]//features detection and extraction here both for object and scene
std::vector< Mat > descriptors;
descriptors.push_back(descriptors_object);
matcher.clear();
matcher.add(descriptors);
matcher.train();
matcher.match( descriptors_scene, matches);

Then i print the results same way, the matches are ordered by queryIdx!

The problem is not the matches order, but it seems that ORB results are not correct, like if the matcher takes every feature from the scene image (query) and try to find the most similar feature in the object image (train), opposite to the SURF case in which it seems that the matcher takes every feature from from the object image (train) and try to find the most similar feature in the scene image (query).

edit retag flag offensive close merge delete

Comments

1

Small note:

For ORB descriptors use NORM_HAMMING distance:

BFMatcher matcher(NORM_HAMMING);
Vladislav Vinogradov gravatar imageVladislav Vinogradov ( 2013-05-13 06:08:44 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-05-14 02:08:29 -0600

Nyenna gravatar image

First of all, ORB descriptors are binary descriptors and therefore require to use the Hamming distance (the Euclidean distance makes no sense in this case). Your wrong results certainly come from here.

Then, I would say that matcher.add() adds descriptors to the index. When you match() your descriptors_scene, it actually matches descriptors_scene to the index (i.e. descriptors here).

So it is not wrong that ORB matches the query to the train image. And I believe that SURF does the same.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-05-13 05:52:00 -0600

Seen: 610 times

Last updated: May 14 '13