OpenCV SURF function is not implemented(未实现 OpenCV SURF 功能)
问题描述
当我尝试运行示例 find_obj.cpp
或任何 OpenCV SURF 程序时,我在执行代码时在命令提示符中收到以下错误.项目构建时没有错误和警告.我使用的是 VS2011 beta、OpenCV 2.4 和 windows7.
When I try to run the sample find_obj.cpp
or any OpenCV SURF program I get the following error in command prompt while executing the code. The project builds without errors and warnings. I am using VS2011 beta, OpenCV 2.4 and windows7.
错误信息:
OpenCV Error: The function/feature is not implemented < OpenCV was built without SURF support> in unknown function,file ......srcopencvmoduleslegacysrcfeatures2d.cpp, line 77
我尝试使用 Cmake 再次构建 OpenCV 2.4,然后在调试模式下使用 VS2011,然后在 IDE 中添加 lib 路径,但仍然没有结果.
I tried to build the OpenCV 2.4 again using Cmake and then VS2011 in debug mode and then added the lib paths in the IDE, but still no result.
我该如何解决?
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/legacy/legacy.hpp>
#include <opencv2/legacy/compat.hpp>
#include <opencv2/flann/flann.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/nonfree/nonfree.hpp>
using namespace std;
using namespace cv;
int main()
{
cv::initModule_nonfree();//THIS LINE IS IMPORTANT
IplImage *image1 = cvLoadImage("C:\SURF\1.jpg");
IplImage *image2 = cvLoadImage("C:\SURF\2.jpg");
CvMemStorage* memoryBlock = cvCreateMemStorage();
CvSeq* image1KeyPoints;
CvSeq* image1Descriptors;
CvSeq* image2KeyPoints;
CvSeq* image2Descriptors;
// Only values with a hessian greater than 500 are considered for keypoints
CvSURFParams params = cvSURFParams(500, 1);
cvExtractSURF(image1, 0, &image1KeyPoints, &image1Descriptors, memoryBlock, params);
cvExtractSURF(image2, 0, &image2KeyPoints, &image2Descriptors, memoryBlock, params);
return 0;
}
推荐答案
摘自 这个答案(为什么不在提问前先用谷歌搜索一下?):
Taken from this answer (why don't you google your question before asking?):
SIFT 和 SURF 代码在 OpenCV v2.4 中被移动到一个名为的新模块中非自由
.确保您正在链接(Windlows 中的 DLL)到它.在 linux 中,这个库被称为 libopencv_nonfree.so
.
The SIFT and SURF code was moved in OpenCV v2.4 to a new module called
nonfree
. Make sure you are linking (DLL in Windlows) to it. In linux this library is called libopencv_nonfree.so
.
这篇关于未实现 OpenCV SURF 功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未实现 OpenCV SURF 功能


基础教程推荐
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- C++,'if' 表达式中的变量声明 2021-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- 设计字符串本地化的最佳方法 2022-01-01