0
以下代码仅用于查看SIFT中的特征检测。问题在于,当我运行它时,它会中断。SIFT特征检测器产生未处理的异常
#include <features2d.hpp>
#include <stdafx.h>
#include <stdlib.h>
#include <cv.hpp>
#include <cxcore.hpp>
#include <highgui.h>
#include <iostream>
using namespace cv;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Mat img = imread("c:\\chappal.jpg", 0);
Ptr<FeatureDetector> feature_detector = FeatureDetector::create("SIFT");
vector<KeyPoint> keypoints;
feature_detector->detect(img, keypoints);
Mat output;
drawKeypoints(img, keypoints, output, Scalar(255, 0, 0));
namedWindow("meh", CV_WINDOW_AUTOSIZE);
imshow("meh", output);
waitKey(0);
return 0;
}
当调试一步一步的在这条线的程序中断:feature_detector->detect(img, keypoints);
我都检查一遍,再和不知道是什么问题所致。
P.S.我第一次尝试SiftFeatureDetector
代替FeatureDetector::create("SIFT");
,但得到错误,因为它在库文件中找不到SiftFeatureDetector
。我在这个论坛上了解到来自帖子的两个代码示例。
谢谢
我发现''SiftFeatureDetector''现在保存在非空闲文件夹中的独立库中。如果是这样,为什么在这个2.4教程中没有使用非自由库:http://docs.opencv.org/doc/tutorials/features2d/feature_detection/feature_detection.html? – StuckInPhD