未实现OpenCV SURF功能 [英] OpenCV SURF function is not implemented
问题描述
当我尝试运行示例 find_obj.cpp
或任何OpenCV SURF程序时,我在执行代码时在命令提示符下得到以下错误。项目构建没有错误和警告。我使用的是VS2011测试版,OpenCV 2.4和Windows7。
错误讯息:
OpenCV Error:未实现函数/ OpenCV是建立没有SURF支持>在未知函数中,文件.. \..\..\src\opencv\modules\legacy\src\features2d.cpp,第77行
我试图再次使用Cmake和VS2011在调试模式下构建OpenCV 2.4,然后在IDE中添加了lib路径,但仍然没有结果。 p>
如何解决这个问题?
#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(); //这个行是重要的
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;
//只有粗糙度大于500的值被考虑用于关键点
CvSURFParams params = cvSURFParams(500,1);
cvExtractSURF(image1,0,& image1KeyPoints,& image1Descriptors,memoryBlock,params);
cvExtractSURF(image2,0,& image2KeyPoints,& image2Descriptors,memoryBlock,params);
return 0;
}
取自此答案(为什么不google:你问的问题?):
SIFT和SURF代码在OpenCV v2.4中移动到一个新的模块
nonfree
。确保你正在链接(DLL在Windlows)。在linux中,此库称为 libopencv_nonfree.so
。
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.
Error message:
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
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.
How can I fix that?
#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?):
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功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!