rot*_*age 10 c++ implementation opencv surf visual-c++
当我尝试运行示例find_obj.cpp或任何OpenCV SURF程序时,我在执行代码时在命令提示符中收到以下错误.该项目的构建没有错误和警告.我正在使用VS2011 beta,OpenCV 2.4和windows7.
错误信息:
OpenCV Error: The function/feature is not implemented < OpenCV was built without SURF support> in unknown function,file ..\..\..\src\opencv\modules\legacy\src\features2d.cpp, line 77
Run Code Online (Sandbox Code Playgroud)
我尝试在调试模式下使用Cmake然后再使用VS2011再次构建OpenCV 2.4,然后在IDE中添加了lib路径,但仍然没有结果.
我该如何解决这个问题?
#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;
}
Run Code Online (Sandbox Code Playgroud)
Art*_*huk 10
取自这个答案(你为什么不在问之前谷歌你的问题?):
SIFT和SURF代码在OpenCV v2.4中移动到一个名为的新模块
nonfree.确保链接(Windlow中的DLL).在linux中,这个库被调用libopencv_nonfree.so.
小智 8
这不是一个错误.SURF位于非自由模块中.要使用它,您应该初始化nonfree模块:
#include <opencv2/nonfree/nonfree.hpp>
...
cv::initModule_nonfree();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27628 次 |
| 最近记录: |