2017-10-16 39 views
-1

을 제공하는 것은SurfFeatureDetector를 추가 한 후, 프로그램은 내가 <code>opencv 3.3.0</code></p> <p>내 코드를 사용하고 오류

#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에 새로운 오전입니다. 서핑 부분없이 코드가 잘 작동합니다.

오류가

OpenCV Error: Assertion failed (TlsSetValue(tlsKey, pData) == TRUE) in cv::TlsAbstraction::SetData, file C:\Users\Darshana\Documents\opencv\opencv-3.3.0\modules\core\src\system.cpp, line 1270

나뿐만 아니라 Ptr<SURF> detector = SURF::create(400);으로 노력했다.

UPDATE

나는 이것에 대한 해결책을 알아낼 수 없었다. 설치 문제 또는 라이브러리 문제 일 수 있습니다. 그래서 저는 opencv 2.4.13으로 이동하고 모든 것이 잘 작동합니다. 비록 위의 코드를 v2.4.13과 작동하도록 변경해야했습니다.

+0

투표가 실패하면 이유를 말씀해주십시오. – Darshana

답변

0

SurfFeatureDetector에 대한 매개 변수를 설정하지 않았습니다. 제 생각에는 이것을 시도해야한다고 생각합니다 :

int minHessian = 400; 
SurfFeatureDetector detector(minHessian); 
vector<KeyPoint> keypoints; 
detector.detect(img1, keypoints); 
+0

나는 이미 이것을 시도했다. 이것은'opencv 3.3.0'에서는 작동하지 않습니다. 컴파일 오류가 발생합니다. – Darshana

+0

아, opencv 2.4.13을 사용하고'SURF','SurfFeatureDetector','SurfDescriptorExtractor'는 같습니다. –