2015-11-11 36 views
1

我試圖使用檢測器ORB獲取映像中的關鍵點,但始終得到異常並崩潰,我的代碼是下一個。opencv中的崩潰檢測函數(ORB和BRISK)

vector <KeyPoint> kp; 

int nfeatures = 500; 
float scaleFactor = 1.2f; 
int nlevels = 8; 
int edgeThreshold = 15; 
int firstLevel = 0; 
int WTA_K = 2; 
int scoreType = ORB::HARRIS_SCORE; 
int patchSize = 31; 
int fastThreshold = 20; 

Ptr <ORB> detector = ORB::create(
    nfeatures, 
    scaleFactor, 
    nlevels, 
    edgeThreshold, 
    firstLevel, 
    WTA_K, 
    scoreType, 
    patchSize, 
    fastThreshold); 

detector->detect(img, kp); 
cout << "Found " << kp.size() << " Keypoints " << std::endl; 

Mat out; 
drawKeypoints(img, kp, out, Scalar::all(255)); 

imshow("Kpts", out); 

img被宣佈提前,問題是什麼時候做detect-> detect(img,kp);我不知道是什麼問題,我正在嘗試其他形式的操作,但都在detect()的調用中崩潰。

我嘗試使用BRISK,並且在調用檢測崩潰時問題相同。 隨着輕快的我做了簡化下一個:

Ptr <BRISK> detector = BRISK::create(); 
vector <KeyPoint> kp; 
detector->detect(img,kp); 

這是轉向可氣。

我使用OpenCV的3在Visual Studio 2015年與Windows 10

對不起,我的英語,感謝您的回答。

回答