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

标签 c++ opencv surf

OpenCV SURF function is not implemented 可能重复

我的错误代码是:

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

我不知道怎么解决。

我的代码是:

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

最佳答案

如果您处于 Debug模式并使用 OpenCV 2.4.5,请尝试添加这些库:

opencv_nonfree245d.lib 
opencv_features2d245d.lib

在 Project -> Properties -> linker -> Input -> Additional Dependencies.

我在执行功能描述教程时遇到了同样的错误,它已修复。

关于c++ - 使用 OpenCV 和 C++ 实现 SURF 时出现错误 cv::SURF::SURF(double,int,int,bool,bool),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16394123/

相关文章:

c++ - 存储 snprintf 参数供以后使用

matlab - 使用 mexopencv 提取简要特征

c++ - OpenCV - 两个完全不同的图像使用 BFMatcher 进行更多匹配

c++ - 使用 Visual 调试器释放内存非常慢

c++ - 奇怪的 C++ 指针新建/删除问题

c++ - 为什么转换构造函数需要在执行显式转换时声明复制构造函数?

C++,opencv : Is it safe to use the same Mat for both source and destination images in filtering operation?

android - 如何显示原始尺寸的相机捕获的图像?

opencv - 图像处理的关键点是什么?

OpenCV 冲浪和异常值检测