gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 01:19:02 26 4
gpt4 key购买 nike

我正在使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com