我使用以下代码提取并绘制图像中的 SIFT 关键点。但在我的代码中,我没有指定要提取多少个关键点?因此,这完全取决于图像有多少个关键点。
我想要的是:我想指定图像中最多需要 20 个关键点。如果不存在 20 个关键点,则无需进一步处理,或者如果关键点超过 20 个,则仅考虑最重要的 20 个关键点。
我当前的代码:
//To store the keypoints that will be extracted by SIFT
vector<KeyPoint> keypoints;
//The SIFT feature extractor and descriptor
SiftDescriptorExtractor detector;
Mat input;
//open the file
input = imread("image.jpg", 0);
//detect feature points
detector.detect(input, keypoints);
///Draw Keypoints
Mat keypointImage;
keypointImage.create( input.rows, input.cols, CV_8UC3 );
drawKeypoints(input, keypoints, keypointImage, Scalar(255,0,0));
imshow("Keypoints Found", keypointImage);
waitKey(0);
可以使用以下行来完成:
//The SIFT feature extractor and descriptor
SiftDescriptorExtractor detector(20);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)