使用OpenCV要素匹配时的选项

时间:2013-11-04 21:18:13

标签: opencv image-processing feature-detection

我正在尝试使用OpenCV功能匹配找到不同的选项。

我使用的是2.4.4版本。

我听说蛮力匹配有一个“模板化”版本 - 而且我可能会得到不同的匹配方法......

到目前为止,这是我发现的 - 但除了在构造函数中传递匹配方法之外,我无法看到如何使用模板化版本。它是如何工作的?我有什么其他选择可以探索吗?

cv::BFMatcher matcher(use_hamming ? cv::NORM_HAMMING : cv::NORM_L2);
matcher.knnMatch(descriptors2, descriptors1, matches, 2);

谢谢

2 个答案:

答案 0 :(得分:0)

模板检测在OpenCV文档中描述:http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=template%20match#void matchTemplate(InputArray image,InputArray templ,OutputArray result,int method)

您可以在http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html?highlight=template%20match

找到教程

答案 1 :(得分:0)

unxnut可能建议模板匹配,因为你混合了两个不同的东西: 1)匹配模板 - 由unxnut和 2)在OpenCV函数中使用C ++模板(这是技术问题,与您的问题无关)。

回答你的问题,BFmatcher只是管道的一部分。你需要 1)检测功能http://docs.opencv.org/doc/tutorials/features2d/feature_detection/feature_detection.html 2)描述检测到的功能 http://docs.opencv.org/doc/tutorials/features2d/feature_description/feature_description.html 3)匹配功能(此处使用BFMatcher。用于SIFT和SURF的二进制功能的汉明,如ORB,FREAK,L2) 4)使用RANSAC进行几何验证。

如果您想要了解整个过程的示例,请查看http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html

如果您有兴趣了解这个过程,我建议您寻找一些大学讲座和/或实验室,例如: http://www.cvl.isy.liu.se/education/undergraduate/tsbb15/lectures/lecture-08