【发布时间】:2018-05-11 12:13:42
【问题描述】:
我正在使用 opencv 3.2.0,我正在尝试分别与 FAST、BRISK、BruteForce 进行特征检测、描述符计算和描述符匹配。我在 Visual Studio 2017 中使用 C++。
std::vector<KeyPoint> keypoints1, keypoints2;
cv::Mat descriptors1, descriptors2;
m_image_A = imread("a.bmp", IMREAD_GRAYSCALE);
m_image_B = imread("b.bmp", IMREAD_GRAYSCALE);
cv::Ptr<cv::FeatureDetector> a = cv::FastFeatureDetector::create();
a->detect(m_image_A, keypoints1);
a->detect(m_image_B, keypoints2);
cv::Ptr<cv::DescriptorExtractor> ex = cv::BRISK::create();
ex->compute(m_image_A, keypoints1, descriptors1);
ex->compute(m_image_B, keypoints2, descriptors2);
cv::Ptr<cv::DescriptorMatcher> matcher;
std::vector<vector<DMatch>> matches;
matcher = cv::BFMatcher::create();
matcher->knnMatch(descriptors1, descriptors2, matches, 2);
这是我的简单代码,但它不能正常运行。 我阅读了许多代码和提示,但我找不到适合我的问题的解决方案。
有人可以帮助我吗?如何让它正常运行?
【问题讨论】:
-
我编辑了这个问题的标签以删除不必要的标签并将
opencv3.2更改为opencv,因为大多数人不会查看特定的发布标签。这应该可以帮助您获得更多回复。但是,您应该查看 OpenCV 教程;他们有一些使用BFMatcher。例如,docs.opencv.org/3.0-beta/doc/tutorials/features2d/…。当您说“它无法正常运行”时,您是什么意思?更具体地处理实际问题。