gpt4 book ai didi

opencv - SIFT特征检测器产生未处理的异常

转载 作者:行者123 更新时间:2023-12-02 17:53:34 25 4
gpt4 key购买 nike

下面的代码仅是为了查看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);
我已经一遍又一遍地检查了,不知道问题可能是由什么引起的。

附言我首先尝试用 SiftFeatureDetector代替 FeatureDetector::create("SIFT");,但出现错误,因为它在库文件中找不到 SiftFeatureDetector。我从该论坛上的帖子中了解了这两个代码示例。

谢谢

最佳答案

我不知道您是否尝试过此方法,但是由于它现在位于nonfree.h库中,因此您需要使用initModule_nonfree()。那为我解决了问题。

关于opencv - SIFT特征检测器产生未处理的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13149807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com