2014-02-10 55 views
0

我想運行detector_descriptor_evaluation.cpp OpenCV中使用opencv_extra數據集的示例。但是,我收到有關SIFT,SURF檢測器的錯誤,我無法使用匹配器。我想知道是否有人會解釋這些問題。opencv示例不起作用(detectors_descriptors_evaluation.cpp)

主要功能創建了不同的檢測器和/或匹配類型DetectorQualityEvaluator類的對象,如下所示:

Ptr<BaseQualityEvaluator> evals[] = 
{ 
    new DetectorQualityEvaluator("FAST", "quality-detector-fast"), 
    new DetectorQualityEvaluator("GFTT", "quality-detector-gftt"), 
    new DetectorQualityEvaluator("HARRIS", "quality-detector-harris"), 
    new DetectorQualityEvaluator("MSER", "quality-detector-mser"), 
    new DetectorQualityEvaluator("STAR", "quality-detector-star"), 
    new DetectorQualityEvaluator("SIFT", "quality-detector-sift"), 
    new DetectorQualityEvaluator("SURF", "quality-detector-surf"), 
    new DescriptorQualityEvaluator("SIFT", "quality-descriptor-sift", "BruteForce"), 
    new DescriptorQualityEvaluator("SURF", "quality-descriptor-surf", "BruteForce"), 
    new DescriptorQualityEvaluator("FERN", "quality-descriptor-fern"), 
    new CalonderDescriptorQualityEvaluator() 
}; 

程序正常工作,直到SIFT和SURF檢測器,但它給「不能被讀取算法」錯誤。換句話說,我無法制造這些探測器。當我不創造SIFT和SURF探測器

//new DetectorQualityEvaluator("SIFT", "quality-detector-sift"), 
    //new DetectorQualityEvaluator("SURF", "quality-detector-surf"), 

我得到以下錯誤:

OpenCV Error: Assertion failed (!extractor.empty() && !matcher.empty()) in VectorDescriptorMatcher, file /home/sy/opencv-2.4.8/modules/features2d/src/matchers.cpp, line 1089 

當我用下面的代碼

//new DetectorQualityEvaluator("SIFT", "quality-detector-sift"), 
    //new DetectorQualityEvaluator("SURF", "quality-detector-surf"), 
    //new DescriptorQualityEvaluator("SIFT", "quality-descriptor-sift", "BruteForce"), 
    //new DescriptorQualityEvaluator("SURF", "quality-descriptor-surf", "BruteForce"), 
    new DescriptorQualityEvaluator("FERN", "quality-descriptor-fern"), 
    new CalonderDescriptorQualityEvaluator() 

我也得到下面的errro。我認爲它不承認「FERN」匹配器。只有CalonderDescriptor在這個例子中工作。

OpenCV Error: Bad argument (Unknown matcher name) in create, file /home/sy/opencv-2.4.8/modules/features2d/src/matchers.cpp, line 488 

問候

回答

2

我遇到了完全一樣的失敗。經過一些調試後,我發現對於SIFT和SURF,您將需要示例代碼中缺少的非自由模塊。地址:

#include "opencv2/nonfree/nonfree.hpp" 

然後插入在main()以下:

Ptr<BaseQualityEvaluator> evals[] = 

問候

+0

謝謝你,我會嘗試:前行

cv::initModule_nonfree(); 

sy456