使用openCV在图像中实现SIFT [英] Using openCV to implement SIFT in image

查看:148
本文介绍了使用openCV在图像中实现SIFT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用openCV实现SIFT,我已经参考了这些链接 link1 link2 。此外,我还阅读了Lowe撰写的关于SIFT的论文。我对link1和link2中的代码有一些问题。

I have tried to implement SIFT with openCV and I have refer to these links link1 and link2. Besides, I have also read the paper about SIFT written by Lowe. I have some problems about the code in link1 and link2.


  1. cv :: SiftFeatureDetector detector(0.05,5.0); cv :: SiftDescriptorExtractor extractor(3.0);

  1. cv::SiftFeatureDetector detector( 0.05, 5.0 ); cv::SiftDescriptorExtractor extractor( 3.0 );

我无法完全理解上述函数中的参数。如果我将第一个函数修改为cv :: SiftFeatureDetector探测器(0.05,10.0); ,有一个运行时间OpenCV错误:断言失败< firstOctave> = - 1 %% actualNLayers< = nOctaveLayers>。

I can't totally understand the parameter in the above function. If I modify the first function to cv::SiftFeatureDetector detector( 0.05, 10.0 ); , there is a running time OpenCV Error:Assertion failed < firstOctave>=-1 %% actualNLayers<=nOctaveLayers >.

另外,我没有在SiftDescriptorExtractor提取器()中实现该参数。我知道关键点匹配中存在距离比,但范围是[0,1]。

In addition, I don't realize the parameter in the SiftDescriptorExtractor extractor( ). I know there is a distances ratio in keypoints matching, but the range is [0,1].

我想修改我用来匹配的方法为了图片,所以我需要提取描述符和每个关键点的主导方向。如何提取每个关键点的描述符和主导方向?

I want to modify the method which I use to match to picture, so I need to extract the descriptor and the dominant orientation of each keypoint. How do I extract extract each keypoint's descriptor and dominant orientation?

非常感谢您的回复。

推荐答案

我的建议是你应该在开始时使用SIFT的默认参数。然后,如果您对结果不满意,可以尝试优化这些参数。

My advice is that you should use the default parameters of the SIFT at the beginning. Then, if you're not satisfied with the results you can try to refine these parameters.

Ptr<FeatureDetector> detector = new SIFT();;
Ptr<DescriptorExtractor> extractor = new SIFT();

你可以在这里找到有关OpenCV实现中SIFT参数的有用信息: http://docs.opencv.org/modules/nonfree/doc/feature_detection.html

U can find useful information about SIFT parameters in the OpenCV implementation here: http://docs.opencv.org/modules/nonfree/doc/feature_detection.html

计算关键点:

vector<KeyPoint> keypoints;
detector->detect(yourImage, keypoints);

计算关键点时,其方向会自动计算,并与每个关键点的参数角度相关联关键。请在此处找到更多信息: http://docs.opencv.org/modules/features2d /doc/common_interfaces_of_feature_detectors.html

When you compute the keypoints its orientation is automatically calculated and is associated with the parameter 'angle' of each keypoint. Please find more info here: http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html

计算关键点的描述符:

Mat descriptors;
extractor->compute(yourImage, keypoints, descriptors);

是Mat描述符的每一行描述符。

being each row of the Mat descriptors one descriptor.

如果您有任何疑问,请与我们联系!
希望这有帮助。

Please let me know if you have questions! Hope this helps.

这篇关于使用openCV在图像中实现SIFT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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