简体   繁体   English

使用OpenCV和C ++实现SURF时出现错误cv :: SURF :: SURF(double,int,int,bool,bool)

[英]Error cv::SURF::SURF(double,int,int,bool,bool) in Implementation SURF with OpenCV and C++

Possible duplicate of OpenCV SURF function is not implemented 未实现OpenCV SURF功能的可能重复

My Error code is: 我的错误代码是:

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 错误LNK2019:函数_main中引用的未解析的外部符号“public:__thiscall cv :: SURF :: SURF(double,int,int,bool,bool)”(?? 0SURF @ cv @@ QAE @ NHH_N0 @ Z)

I don't know how to fix it. 我不知道如何解决它。

My Code is: 我的代码是:

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <iostream>
#include <conio.h>
#include <opencv2\nonfree\features2d.hpp>
#include <opencv2\legacy\legacy.hpp>
#include <opencv2\core\core.hpp>
#include <stdio.h>

using namespace cv;
using namespace std;

int main()
{
    Mat img_1 = imread("kmu1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_2 = imread("all.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    if(!img_1.data || !img_2.data)
    {
        cout << "could not open or find the image" << endl;
        return -1;
    }

    int minHessian = 400;
    SURF surf( minHessian );

    vector <KeyPoint> keyPoints_1, keyPoints_2;
    Mat descriptors_1, descriptors_2;

    surf(img_1, Mat(), keyPoints_1, descriptors_1, false);
    surf(img_2, Mat(), keyPoints_2, descriptors_2, false);

    BFMatcher matcher(NORM_L2, false);
    vector<DMatch> matches;
    matcher.match(descriptors_1, descriptors_2, matches);

    Mat img_matches;
    drawMatches(img_1, keyPoints_1, img_2, keyPoints_2, matches, img_matches);

    imshow("Matches", img_matches);

    waitKey(0);
    _getch();
    return 0;
} 

Try to add those libs if you are in Debug mode and using OpenCV 2.4.5: 如果您处于调试模式并使用OpenCV 2.4.5,请尝试添加这些库:

opencv_nonfree245d.lib 
opencv_features2d245d.lib

In Project -> Properties -> linker -> Input -> Additional Dependencies. 在项目 - >属性 - >链接器 - >输入 - >附加依赖项中。

I had the same error doing Feature Description tutorial and it fixed it. 我在做功能描述教程时遇到了同样的错误并修复了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM