【发布时间】:2017-10-16 01:54:58
【问题描述】:
我正在使用opencv 3.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;
}
我是 C++ 和 opencv 的新手。该代码在没有 surf 部分的情况下运行良好。
错误
OpenCV 错误:cv::TlsAbstraction::SetData 文件 C:\Users\Darshana\Documents\opencv\opencv-3.3.0\modules\core\ 中的断言失败 (TlsSetValue(tlsKey, pData) == TRUE) src\system.cpp,第 1270 行
我也试过Ptr<SURF> detector = SURF::create(400);。
更新
我想不出解决办法。也许是设置问题或库问题。所以我只是搬到opencv 2.4.13,现在一切正常。不过,我必须更改上面的代码才能使用v2.4.13。
【问题讨论】:
-
如果您投反对票,请说明原因。