c++ - 如何在OpenCV C++中使用FeatureDetector?

标签 c++ opencv feature-detection

我正在使用 VS 2008,并按照安装指南安装了 OpenCV 2.1。 FeatureDetector/SurfFeatureDetector 在文档中被列为类,但它们被视为“语法错误:标识符'SurfFeatureDetector”

这几乎是我的全部代码。

#include "cv.h"
#include "highgui.h"

Ptr<FeatureDetector> *detect = new SurfFeatureDetector();

我尝试了一些随机组合来使其发挥作用。如何初始化特征检测器?

最佳答案

您正在声明一个指向 cv::Ptr 的指针——您确实应该只拥有 cv::Ptr。将代码更改为

#include "cv.h"
#include "highgui.h"

using namespace cv;
Ptr<FeatureDetector> detect = new SurfFeatureDetector();

它应该可以工作。

关于c++ - 如何在OpenCV C++中使用FeatureDetector?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6553559/

相关文章:

c++ - 返回 Eigen::Ref 是否合法?

c++ - 每个项目的 Boost.Build 条件库编译

python - 如何将openCV中的imshow()和moveWindow()与python结合起来?

macos - 错误 : 'uncaught_exceptions' is unavailable: introduced in macOS 10. 12

c++ - 使用C++线程构建管道结构

c++ - cmake 是否使用约定优于配置?

python - 在3.4.2.0(Python 3)以上的cv2版本上使用SIFT算法

python - 从 imshow 开始运行 OpenCV 脚本

python - 使用 Python 在 OpenCV 中进行 Harris 角点检测和定位

OpenCV 模板匹配最大最小值返回错误值