SIFT openCV的关键点数量? [英] number of keypoints by SIFT openCV?

查看:1379
本文介绍了SIFT openCV的关键点数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码来提取和绘制图像中的SIFT关键点。但在我的代码,我没有指定有多少关键点我想提取?因此,它完全取决于图片有多少关键点。

I am using the following code to extract and draw the SIFT keypoints in an image. But in my code, i haven't specified that how many keypoints i want to extract? so, it completely depends upon the image how many keypoints it have.

我想要什么:我想指定我需要最多20个关键点在图像中。如果20个关键点不存在,则不需要继续进行,或者如果关键点大于20,则只考虑最重要的20个关键点。

What i want: I want to specify that i need maximum 20 keypoints in an image. If 20 keypoints are not present then no need to proceed further or if keypoints are more than 20 then just consider the most important 20 keypoints.

我当前的代码:

//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);


推荐答案

可以使用以下行: / p>

It can be done by using the following line:

//The SIFT feature extractor and descriptor
SiftDescriptorExtractor detector(20); 

这篇关于SIFT openCV的关键点数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆