skm*_*skm 2 opencv image-processing computer-vision
我使用以下代码来提取和绘制图像中的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);
Run Code Online (Sandbox Code Playgroud)
可以使用以下行来完成:
//The SIFT feature extractor and descriptor
SiftDescriptorExtractor detector(20);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3708 次 |
| 最近记录: |