Why KeyPointsFilter::retainBest does keep the size of the vector?

asked 2014-10-16 09:52:55 -0600

thdrksdfthmn gravatar image

I have written the following code:

cv::Ptr< cv::FeatureDetector > detector = cv::FeatureDetector::create("PyramidGFTT");
std::vector< cv::KeyPoint > keypoints;
detector->detect(img, keypoints);
std::cout << "detected: " << keypoints.size() << std::endl;

cv::Mat img2;
cv::drawKeypoints(img, keypoints, img2);
cv::imshow("detection", img2);

cv::KeyPointsFilter::retainBest(keypoints, 20);
std::cout << "retained: " << keypoints.size() << std::endl;
cv::Mat img3;
cv::drawKeypoints(img, keypoints, img3);
cv::imshow("best", img3);

And there is no difference after the KeyPointsFilter::retainBest. It always show all the points, and more the size of the vector is not changed. Is this correct? Am I doing something wrong? Is it just keeping on the first N positions the best keypoints?

edit retag flag offensive close merge delete

Comments

2

Probably GFTT doesn't have a strongest classification / score and then indeed you should use the first points that are found.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-17 04:38:47 -0600 )edit
1

Where I can find the info of what features have a strongest classification / score?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-10-17 05:03:32 -0600 )edit
2

Hmm you need to read papers I guess. For example, Harris corner detector gives a value for "cornerness" which could be used for this.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-17 05:33:56 -0600 )edit