C++ 添加SurfFeatureDetector后,程序出现错误

C++ 添加SurfFeatureDetector后,程序出现错误,c++,opencv,surf,C++,Opencv,Surf,我使用的是opencv3.3.0 我的代码是 #include <stdio.h> #include <iostream> #include "opencv2/core.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/features2d.hpp" #include "opencv2/xfeatures2d.hpp" #include <fs

我使用的是
opencv3.3.0

我的代码是

#include <stdio.h>
#include <iostream>
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include <fstream>
#include <string>
#include <vector>

using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;

int main(int argc, char** argv)
{
    Mat img1;
    img1 = imread("img/img1.jpg", IMREAD_GRAYSCALE);

    if (img1.empty())
    {
        cout << "Could not open or find the image" << endl;
        return -1;
    }

    Ptr<SurfFeatureDetector> detector = SurfFeatureDetector::create(400);
    vector<KeyPoint> keypoints;
    detector->detect(img1, keypoints);

    imshow("img1", img1);
    waitKey(0);
    return 0;
}
#包括
#包括
#包括“opencv2/core.hpp”
#包括“opencv2/imgcodecs.hpp”
#包括“opencv2/highgui.hpp”
#包括“opencv2/features2d.hpp”
#包括“opencv2/xfeatures2d.hpp”
#包括
#包括
#包括
使用名称空间cv;
使用名称空间std;
使用名称空间cv::xFeature2D;
int main(int argc,字符**argv)
{
Mat-img1;
img1=imread(“img/img1.jpg”,imread\u灰度);
if(img1.empty())
{

cout您尚未为
SurfFeatureDetector
设置参数。我认为您应该尝试以下操作:

int minHessian = 400;
SurfFeatureDetector detector(minHessian);
vector<KeyPoint> keypoints;
detector.detect(img1, keypoints);
int minHessian=400;
表面特征检测器(minHessian);
矢量关键点;
检测器。检测(img1,关键点);

我已经试过了。这对
opencv 3.3.0
不起作用。它会产生编译错误。哦,我使用
opencv 2.4.13
冲浪
冲浪功能检测器
冲浪描述符
是一样的。如果你反对投票,请说明原因。