Why KeyPointsFilter::retainBest does keep the size of the vector?
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?
Probably GFTT doesn't have a strongest classification / score and then indeed you should use the first points that are found.
Where I can find the info of what features have a strongest classification / score?
Hmm you need to read papers I guess. For example, Harris corner detector gives a value for "cornerness" which could be used for this.