如何在 OPENCV 3.x C++ Visual Studio 2015 中声明 BruteForceMatcher

How to declare BruteForceMatcher in OPENCV 3.x C++ Visual Studio 2015

我正在使用 Open CV 3.2 并在 Visual Studio 2015 平台上工作。

this tutorial 他们使用 BruteForceMatcher。

并且基于this answer,我知道使用opencv 2.x和3.x有几个区别。

所以,有什么建议可以改变吗

BruteForceMatcher<L2<float> > matcher;
vector<DMatch> matches;
matcher.match(descriptors1, descriptors2, matches);

进入 Open CV 3.x 表格?

您可以试试下面的代码

Ptr<cv::DescriptorMatcher> matcher(new cv::BFMatcher(cv::NORM_HAMMING, true));
vector<DMatch> matches;
matcher->match(descriptors1, descriptors2, matches);