簡體   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++

未實現OpenCV SURF功能的可能重復

我的錯誤代碼是:

錯誤LNK2019:函數_main中引用的未解析的外部符號“public:__thiscall cv :: SURF :: SURF(double,int,int,bool,bool)”(?? 0SURF @ cv @@ QAE @ NHH_N0 @ Z)

我不知道如何解決它。

我的代碼是:

#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;
} 

如果您處於調試模式並使用OpenCV 2.4.5,請嘗試添加這些庫:

opencv_nonfree245d.lib 
opencv_features2d245d.lib

在項目 - >屬性 - >鏈接器 - >輸入 - >附加依賴項中。

我在做功能描述教程時遇到了同樣的錯誤並修復了它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM