0

I am doing keypoint detection and matching in opencv to stitch two images.

When the images are small, it works well. But when dealing with larger images, the number of keypoints detected is increased, and therefore it cost a lot of time to match them. But in order to stitch the images, it seems that we don't need so many keypoints. In order to increase efficiency, is there any way to only detect a limited number of keypoints?

In the code, I use SiftFeatureDetector and SiftDiscriptorExtractor to detect keypoints and extract descriptors.

Regards.

beaver
  • 550
  • 1
  • 9
  • 23

1 Answers1

1

My advise:

Re-size the image so they become much smaller and then execute feature matching. Once you have a fast solution (Homography) apply it and than the next matching will be much faster.

You do have a way to easily control the amount of features. You can rise the threshold and as a result less features will be selected. You can even wrap the threshold in while() loop. It rises the threshold until features amount is less than N (but grater than some M).

Look at full code example I posted here:

Calculate offset/skew/rotation of similar images in C++

Community
  • 1
  • 1
DanielHsH
  • 4,287
  • 3
  • 30
  • 36
  • 1,Re-size is a good way. Using a mask parameter in detector.detect(img, feature, mask) will yield the equivalent result, right? 2,to control the amount of features obtained by detector.detect doesn't seem to be easy, since the threshold cannot be set in the function, right? – beaver May 20 '12 at 16:03
  • Using a mask is a good way but I am not sure you know what the mask should be. How can you know in advance where the good features can be found? Regarding amount of features, in example i posted there is a line: Ptr detector = new SurfFeatureDetector(2000); 2000 is the number you need to change by wraping this line together with detector->detect and putting a condition on amount of detected features – DanielHsH May 21 '12 at 07:53