OpenCV Why does number of SIFT keypoints go over threshold?
Hi,
I created SIFT constructor, with Threshold = 100
cv::Ptr<feature2d> f2d = xfeatures2d::SIFT::create(100);
f2d->compute(image, keypoint, descriptor);
Then I extract descriptors from sequence of images and for some images I receive number of keypoints bigger than limit by one. Please see descriptors print below:
[128 x 101]
[128 x 100]
[128 x 100]
[128 x 101]
[128 x 100]
[128 x 100]
[128 x 101]
[128 x 100]
Why does it happen? Do have incorrect understanding of nfeatures attribute?
I think that your are right @LBerger. I tested with this image and this code:
I got 61 keypoints with different response and 101 in total.
That sounds like a bug to me. In this case algorithm should just ignore other features. Accorfing documentation it supposes to keep numer of best features.
I don't think it's a bug but if you think so you can make an issue or improve doc using a pull request. You are welcome
It is not a bug, but as suggested due to the fact that keypoints can have the same score or strength. It can therefore only limit it to the closest correct amount. What you should do is physically limit the output afterwards. It will never be 99, always 100 or more.
That's what I did, thanks.