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

查看:44
本文介绍了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);

推荐答案

可以使用下面这行来完成:

It can be done by using the following line:

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

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

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