wireless_lab
wireless_lab

Reputation: 187

OPENCV SURF feature descriptor strength

Is there any way in which we can limit the number of keypoints to the 100 in OPENCV SURF? Will the keypoints obtained be ordered according to their strength? How to obtain the strength of the descriptor? I am working on OPENCV in a LINUX system with a cpp program.

regards, shiksha

My code is: int main( int argc, char** argv ) {

         Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
         Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );



          //-- Step 1: Detect the keypoints using SURF Detector
         int minHessian = 500;

         SurfFeatureDetector detector( minHessian,1,2,false,true );

         std::vector<KeyPoint> keypoints_1p;

         std::vector<KeyPoint> keypoints_2p;



         detector.detect( img_1, keypoints_1p );
         detector.detect( img_2, keypoints_2p);


          // computing descriptors
          SurfDescriptorExtractor extractor(minHessian,1,1,1,0);
          Mat descriptors1, descriptors2;

          extractor.compute(img_1, keypoints_1p, descriptors1);
          extractor.compute(img_2, keypoints_2p, descriptors2);

Upvotes: 1

Views: 2116

Answers (2)

skm
skm

Reputation: 5649

see the question here. And see my answer there how to limit the number of keypoints.

Upvotes: 1

carlosdc
carlosdc

Reputation: 12142

You can get at most 100. I could imagine images (say for example a constant image) that have no SIFT descriptor. There are many ways to limit the keypoints to 100. There are easy solutions and hard solutions to your problem. You can get at most 100, by randomly selecting 100 keypoints from as many keypoints you get.

There is no such thing as the strength of the keypoint. You're going to have to define your own concept of strength.

There are a wide variety of parameter in the original Lowe paper that filter the keypoints (one of them is that they don't match an image edge, section 4.1 of Lowe's paper). There are 2 or 3 other parameters. You would need to adjust the parameters systematically in such a way that you only get 100. If you get less than 100 you filter less, and if you get more than 100 you filter more.

Upvotes: 1

Related Questions