Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Opencv 代码中的冲浪功能错误_Opencv_Image Processing_Computer Vision - Fatal编程技术网

Opencv 代码中的冲浪功能错误

Opencv 代码中的冲浪功能错误,opencv,image-processing,computer-vision,Opencv,Image Processing,Computer Vision,我正在用SURF做特征提取的代码,但它给了我一个错误,下面是我的程序 #include <iostream> #include <sys/stat.h> #include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> #include <opencv/cv.h> #include "opencv2/features2d/f

我正在用SURF做特征提取的代码,但它给了我一个错误,下面是我的程序

#include <iostream>
#include <sys/stat.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <opencv/cv.h>
#include "opencv2/features2d/features2d.hpp"
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include  <vector>
#pragma comment (lib , "opencv_core244d.lib")
#pragma comment (lib ,"opencv_highgui244d.lib")
#pragma comment(lib , "opencv_imgproc244d.lib")
#pragma comment(lib ,"opencv_video244.lib")
using namespace cv ;

int main(int argc, char *argv[])
{
    Mat image1, outImg1, image2, outImg2;


    vector<KeyPoint> keypoints1, keypoints2;


    image1 = imread("1.jpg",0);
    image2 = imread("2.jpg",0);

    SurfFeatureDetector surf(2500);
    surf.detect(image1, keypoints1);
    surf.detect(image2, keypoints2);
    drawKeypoints(image1, keypoints1, outImg1, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
    drawKeypoints(image2, keypoints2, outImg2, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);

    namedWindow("SURF detector img1");
    imshow("SURF detector img1", outImg1);

    namedWindow("SURF detector img2");
    imshow("SURF detector img2", outImg2);

    SurfDescriptorExtractor surfDesc;
    Mat descriptors1, descriptors2;
    surfDesc.compute(image1, keypoints1, descriptors1);
    surfDesc.compute(image2, keypoints2, descriptors2);

    cv::waitKey();
    return 0;
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括“opencv2/features2d/features2d.hpp”
#包括
#包括“opencv2/opencv.hpp”
#包括“opencv2/core/core.hpp”
#包括“opencv2/nonfree/features2d.hpp”
#包括“opencv2/highgui/highgui.hpp”
#包括“opencv2/calib3d/calib3d.hpp”
#包括
#pragma注释(lib,“opencv_core244d.lib”)
#pragma注释(lib,“opencv_highgui244d.lib”)
#pragma注释(lib,“opencv_imgproc244d.lib”)
#pragma注释(lib,“opencv\u video244.lib”)
使用名称空间cv;
int main(int argc,char*argv[])
{
Mat image1,outImg1,image2,outImg2;
向量关键点1,关键点2;
image1=imread(“1.jpg”,0);
image2=imread(“2.jpg”,0);
表面特征探测器表面粗糙度(2500);
冲浪检测(图像1,关键点1);
冲浪检测(图像2,关键点2);
drawKeypoints(图像1、keypoints1、outImg1、标量(255255)、DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
drawKeypoints(图像2、keypoints2、outImg2、标量(255255255)、DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
namedWindow(“海浪探测器img1”);
imshow(“海浪探测器img1”,outImg1);
namedWindow(“冲浪探测器img2”);
imshow(“海浪探测器img2”,outImg2);
SURFdescriptor surfDesc;
Mat描述符1,描述符2;
surfDesc.compute(图像1,关键点1,描述符1);
surfDesc.compute(图像2,关键点2,描述符2);
cv::waitKey();
返回0;
}
这些是错误的

Error2  error LNK2019: unresolved external symbol "public: void __thiscall cv::DescriptorExtractor::compute(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > &,class cv::Mat &)const " (?compute@DescriptorExtractor@cv@@QBEXABVMat@2@AAV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAV32@@Z) referenced in function _main
Error3  error LNK2019: unresolved external symbol "public: __thiscall cv::SURF::SURF(void)" (??0SURF@cv@@QAE@XZ) referenced in function _main
Error4  error LNK2019: unresolved external symbol "void __cdecl cv::drawKeypoints(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > const &,class cv::Mat &,class cv::Scalar_<double> const &,int)" (?drawKeypoints@cv@@YAXABVMat@1@ABV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAV21@ABV?$Scalar_@N@1@H@Z) referenced in function _main
Error5  error LNK2019: unresolved external symbol "public: void __thiscall cv::FeatureDetector::detect(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > &,class cv::Mat const &)const " (?detect@FeatureDetector@cv@@QBEXABVMat@2@AAV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@0@Z) referenced in function _main   
Error6  error LNK2019: unresolved external symbol "public: __thiscall cv::SURF::SURF(double,int,int,bool,bool)" (??0SURF@cv@@QAE@NHH_N0@Z) referenced in function _main
Error7  error LNK2019: unresolved external symbol "public: virtual __thiscall cv::FeatureDetector::~FeatureDetector(void)" (??1FeatureDetector@cv@@UAE@XZ) referenced in function "public: virtual __thiscall cv::Feature2D::~Feature2D(void)" (??1Feature2D@cv@@UAE@XZ)
Error8  error LNK2019: unresolved external symbol "public: virtual __thiscall cv::DescriptorExtractor::~DescriptorExtractor(void)" (??1DescriptorExtractor@cv@@UAE@XZ) referenced in function "public: virtual __thiscall cv::Feature2D::~Feature2D(void)" (??1Feature2D@cv@@UAE@XZ)
Error9  error LNK1120: 7 unresolved externals
Error2 error LNK2019:未解析的外部符号“public:void\uu thiscall cv::DescriptorExtractor::compute(类cv::Mat const&,类std::vector&,类cv::Mat&)const”(?compute@DescriptorExtractor@简历@@QBEXABVMat@2@AAV$vector@VKeyPoint@cv@@V$allocator@VKeyPoint@cv@@@std@@@std@@@AAV32@@Z)在函数\u main中引用
错误3错误LNK2019:未解析的外部符号“public:u thiscall cv::SURF::SURF(void)”(?)??0SURF@cv@@QAE@XZ)在函数_main中引用
错误4错误LNK2019:未解析的外部符号“void u cdecl cv::drawKeypoints(类cv::Mat const&,类std::vector const&,类cv::Mat&,类cv::Scalar_uconst&,int)”(?drawKeypoints@cv@@YAXABVMat@1@ABV$vector@VKeyPoint@cv@@V$allocator@VKeyPoint@cv@@@std@@@std@@AAV21@ABV?$Scalar_@N@1@H@Z)在函数_main中引用
错误5错误LNK2019:未解析的外部符号“public:void\uu thiscall cv::FeatureDetector::detect(类cv::Mat const&,类std::vector&,类cv::Mat const&)const”(?detect@FeatureDetector@简历@@QBEXABVMat@2@AAV$vector@VKeyPoint@cv@@V$allocator@VKeyPoint@cv@@@std@@@std@@0@Z)在函数_main中引用
错误6错误LNK2019:未解析的外部符号“public:u thiscall cv::SURF::SURF(double,int,int,bool,bool)”(?)??0SURF@cv@@QAE@NHH_N0@Z) 在函数_main中引用
Error7 error LNK2019:未解析的外部符号“public:virtual\u thiscall cv::FeatureDetector::~FeatureDetector(void)”(?)??1FeatureDetector@cv@@UAE@XZ)在函数“public:virtual\uu thiscall cv::Feature2D::~Feature2D(void)”中引用(?)??1Feature2D@cv@@UAE@XZ)
错误8错误LNK2019:未解析的外部符号“public:virtual\u thiscall cv::DescriptorExtractor::~DescriptorExtractor(void)”(?)??1DescriptorExtractor@cv@@UAE@XZ)在函数“public:virtual\uu thiscall cv::Feature2D::~Feature2D(void)”中引用(?)??1Feature2D@cv@@UAE@XZ)
错误9错误LNK1120:7个未解析的外部

当我在VS2010中编写代码时,它没有显示错误,但当我调试它时,它会显示错误,我可以在视频中使用相同的代码吗

转到
项目属性->链接器->常规->附加库目录
,并确保列表包含指向opencv库安装路径的路径。这应该类似于
\lib\


转到
项目属性->链接器->输入->其他依赖项
,然后将以下库名称作为依赖项粘贴到调试配置中:

opencv_core244d.lib
opencv_highgui244d.lib
opencv_imgproc244d.lib
opencv_features2d244d.lib
opencv_core244.lib
opencv_highgui244.lib
opencv_imgproc244.lib
opencv_features2d244.lib
以及发布配置中的以下内容:

opencv_core244d.lib
opencv_highgui244d.lib
opencv_imgproc244d.lib
opencv_features2d244d.lib
opencv_core244.lib
opencv_highgui244.lib
opencv_imgproc244.lib
opencv_features2d244.lib

冲浪是非自由的这就是为什么会发生错误

它需要添加以下内容:

#include "opencv2/nonfree/nonfree.hpp"   // SURF is nonfree
在main()中执行任何其他操作之前:


和指向opencv_nonfree244.lib的ofc链接

您是否在调试中构建了opencv?如果是,请在调试模式属性中检查链接器的依赖关系。是的,我先构建链接器,然后再调试它。获得“在调试模式属性中检查链接器的依赖关系”我不知道如何执行此操作在解决方案资源管理器的“属性”、“链接器编辑器”、“常规”中右键单击项目,现在比较两个配置版本和调试之间的附加libs行,我猜它不是为调试模式设置的。只需将发行版中的内容复制到调试中。
Error 1 Error LNK2019:未解析的外部符号“public:u thiscall cv::SURF::SURF(void)”(?)??0SURF@cv@@QAE@XZ)函数u main
错误2错误LNK2019:未解析的外部符号“public:u thiscall cv::SURF::SURF(double,int,int,bool,bool)”(?)??0SURF@cv@@QAE@NHH_N0@Z)函数_main中引用了
错误3错误LNK1120:2个未解决的外部
仍有3个错误,我需要手动安装任何cpp或hpp文件吗?我刚刚注意到您使用了
\pragma comment(lib…)
。尝试在调试配置中添加这一行
#pragma comment(lib,“opencv_features2d244.lib”)
,使其成为
#pragma comment(lib,“opencv_features2d244d.lib”)
错误1错误LNK1104:无法打开文件“#pragma comment(lib,\opencv_features2d244d.lib\).obj”