OpenCV 3 SURF特征检测

时间:2015-04-13 16:57:07

标签: c++ c opencv visual-studio-2012 surf

我正在尝试进行简单的冲浪功能检测。
问题是在执行期间我有两个Microsoft Visual C ++运行时库错误,只使用了detect方法:

  

调试断言失败!
计划:   C:\ Windows \ system32 \ MSVCP120D.dll
文件:C:\ Program Files   (x86 \ Microsoft Visual Studio 12.0 \ VC \ include \ vector
行:240   

     

表达式:矢量迭代器不兼容

并且

  

调试断言失败!
计划:   C:\ opencv \ build \ x64 \ vc12 \ bin \ Debug \ opencv_xfeatures2d300d.dll
文件:C:\ Program Files   (x86 \ Microsoft Visual Studio 12.0 \ VC \ include \ vector
行:241   

     

表达式:“标准C ++库无效参数”&& 0

这是代码:

#include "opencv2/core.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/xfeatures2d.hpp"

#include "opencv/cv.h"
#include "opencv/highgui.h"

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

int main(int argc, const char** argv)
{
    // Read image
    Mat img1 = imread("box.png", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img2 = imread("box_in_scene.png", CV_LOAD_IMAGE_GRAYSCALE);
    if (img1.empty() || img2.empty())
    {
        printf("Images non lisibles \n");
        return -1;
    }

    // detecting keypoints

    int hessian = 800;

    Ptr<SURF> surf = SURF::create(hessian);
    vector<KeyPoint> keypoints1, keypoints2;

    surf->detect(img1, keypoints1);
    surf->detect(img2, keypoints2);

    waitKey(0);

    return 0;
}

0 个答案:

没有答案