SURF feature detector detects no keypoints

asked 2019-10-04 10:44:26 -0500

WolfG gravatar image


This is opencv 4.1.0 on windows 10;

using the below simple image SURF feature detector gives no keypoints. code snippet:

std::vector<cv::KeyPoint> keypoints;
cv::Ptr<cv::xfeatures2d::SURF> detector = cv::xfeatures2d::SURF::create( 1 );
detector->detect( img, keypoints);
printf("keypoints.size=%zu\n", keypoints.size());

keypoints.size() is 0, any explanation?


image description

Any hints?

edit retag flag offensive close merge delete


I have done some test with your code and your image, and i am getting also 0, i think it's because your image is too small

Kitnos gravatar imageKitnos ( 2019-10-04 16:25:48 -0500 )edit

Yes, thank you; Copying the small image to a 64x64, getting 8 keypoints. Now I'm trying to find the minimum image size, as I cant find any hint in the docs. Have i nice weekend.

WolfG gravatar imageWolfG ( 2019-10-05 04:53:29 -0500 )edit

Instead of copying I just enlarge the object by 5 and get 18 keypinints...

WolfG gravatar imageWolfG ( 2019-10-05 08:05:14 -0500 )edit

imho, your image is not suitable for this:

  • it's far too small, each SURF keypoint needs a 32x32 pixel sample patch (else it gets discarded)
  • you don't have any real texture in it, just black lines on white bg. (what should it do with all white pixels ?)

please tell us: what did you want to achieve here, in general ? what's the purpose of it ?

berak gravatar imageberak ( 2019-10-05 10:09:06 -0500 )edit

I'm playin with the examples, just to get familiar with. Thank you for your time.

WolfG gravatar imageWolfG ( 2019-10-06 10:14:54 -0500 )edit