Ask Your Question

Scale variant feature matching

asked 2016-03-18 16:18:09 -0500

All the modern feature detectors/descriptors/matchers I see boast to be scale invariant. I have an application where I explicitly want feature matches to occur only on the same scale. I still want multiple scales, I just want to ignore features that move from one scale to the other.

The only way I see to accomplish this with OpenCV is to use some pyramid based technique but to use only one pyramid level and to "manually" do this on multiple scales of the image. This feels like a hack and I am afraid that I would loose out on performance compared to a "native" implementation.

My question is: Is there an "official" way to do this with the OpenCV interface? Are there some modern detectors/descriptors/matchers that are explicitly scale variant? Best case scenario would be an option to just switch off the scale invariance in ORB.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-03-19 08:12:27 -0500

Guanta gravatar image

I would compute the features (ORB, etc.) as usual and then check each keypoint's scale variable and only match those features having the same scale. I think this is the easiest way.

Alternatively, you can do as suggested by @Eduardo and yourself, i.e. compute the scale space yourself, e.g. Gaussian scale space and compute in each level features which are not scale invariant by fixing their octaves (and sublevels) to 1 (and no this is not a "hack", it's just one way to solve it).

edit flag offensive delete link more


+1. Indeed, your solution is easier and smarter as it will work also for Feature2D that don't allow to change easily the scale space (SIFT for example ?).

Eduardo gravatar imageEduardo ( 2016-03-19 09:42:38 -0500 )edit

Ah, I did not see that cv::KeyPoint offers this possibilty. I guess I need to check for the octave value, but I'm not sure what to do about the size value. Is it possible for ORB features to have different sizes (on the same octave)? Thank you, by the way!

Dimitri Schachmann gravatar imageDimitri Schachmann ( 2016-03-19 09:52:11 -0500 )edit

The size should always be the same for one octave. If sublevels between the octaves are possible then the size might differ (does that exist?). But you are right this is confusing!

Guanta gravatar imageGuanta ( 2016-03-23 08:31:32 -0500 )edit

answered 2016-03-19 07:09:01 -0500

Eduardo gravatar image

updated 2016-03-19 07:40:30 -0500

From the ORB documentation, what you could try is to set the nlevels parameter to 1:

cv::Ptr<cv::Feature2D> orb = cv::ORB::create(500,  1.2f, 1);

The detected features should occur only on the current image size.

PS: any corner like feature detectors as FAST, HARRIS, GoodFeatureToTrack, AGAST are scale variant. As most of the descriptors need an orientation information, if you want to be "rotation invariant", in my opinion you have to calculate yourself the orientation of the keypoint and set manually the angle member. For example, ORB (Oriented FAST and Rotated BRIEF) uses the intensity centroid measure for the corner orientation.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-03-18 16:18:09 -0500

Seen: 1,143 times

Last updated: Mar 19 '16