SurfDescriptorExtractor/featureDetector - iOS 中的 OpenCv

发布于 2024-12-16 00:24:45 字数 872 浏览 2 评论 0原文

我正在开发一个 iphone 项目,该项目使用 openCV 进行一些图像匹配。最初我使用 cvMatchTemplate(),但输出不是我们期望的。所以我现在正在尝试使用 FLANN 实现 SURF 检测器。

我尝试将以下 .cpp 代码移植到 Objective C,

//-- Step 2: Calculate descriptors (feature vectors)
  SurfDescriptorExtractor extractor;

  Mat descriptors_1, descriptors_2;

  extractor.compute( img_1, keypoints_1, descriptors_1 );
  extractor.compute( img_2, keypoints_2, descriptors_2 );

  //-- Step 3: Matching descriptor vectors using FLANN matcher
  FlannBasedMatcher matcher;
  std::vector< DMatch > matches;
  matcher.match( descriptors_1, descriptors_2, matches );

但无法编译它,即使我包含了所有必需的库和头文件。自动完成也没有为

#include "opencv2/features2d/features2d.hpp"

“探测器在头文件中定义为

class CV_EXPORTS FeatureDetector
{
...
}

我在这里做错了什么?” 中存在的任何探测器提供选项。有关如何调用检测器类(抽象基类)中的方法的任何输入?

i am working on an iphone project which uses openCV for some image matching. Initially I was using cvMatchTemplate(), but the output is not what we expected. so I am now trying to implement SURF detector using FLANN.

I tried to port the following .cpp code to objective C,

//-- Step 2: Calculate descriptors (feature vectors)
  SurfDescriptorExtractor extractor;

  Mat descriptors_1, descriptors_2;

  extractor.compute( img_1, keypoints_1, descriptors_1 );
  extractor.compute( img_2, keypoints_2, descriptors_2 );

  //-- Step 3: Matching descriptor vectors using FLANN matcher
  FlannBasedMatcher matcher;
  std::vector< DMatch > matches;
  matcher.match( descriptors_1, descriptors_2, matches );

But couldn't get it compiled, even though I have all the required libraries and header files included. The auto-complete is also not giving options for the any detectors present in

#include "opencv2/features2d/features2d.hpp"

The detector is defined in the header file as

class CV_EXPORTS FeatureDetector
{
...
}

What am I doing wrong here? Any input on how to call methods in the detector class(Abstract base class)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌上青苔 2024-12-23 00:24:45

我没有在 iPhone 上专门使用过 openCV,所以无法提供帮助,但是当我使用特征检测器/描述符/匹配器时,我使用了以下语法(最终可能与您编写的相同) ...):

cv::Ptr<cv::DescriptorExtractor> extractor;
extractor = cv::DescriptorExtractor::create("SURF");

cv::Ptr<cv::DescriptorMatcher> matcher;
matcher = cv::DescriptorMatcher::create("FlannBased");

这种风格适合你吗?

I've not used openCV on the iphone specifically so can't help there, but when I've used feature detector/descriptor/matcher I've used the following syntax (which may end up being the same as what you've written...):

cv::Ptr<cv::DescriptorExtractor> extractor;
extractor = cv::DescriptorExtractor::create("SURF");

cv::Ptr<cv::DescriptorMatcher> matcher;
matcher = cv::DescriptorMatcher::create("FlannBased");

Does that style work for you?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文