Reputation: 1704
I want to run detector_descriptor_evaluation.cpp sample in OpenCV with opencv_extra dataset. However, I get errors about SIFT, SURF detector and I cannot use matchers. I wonder if somebody had these problems that i am going to explain.
The main function creates an object of DetectorQualityEvaluator class with different detector and/or matcher types as shown below:
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()
};
Program works fine until SIFT and SURF detectors but it gives "Algorithm cannot be read" error. In other words, I cannot create these detectors. When I don't create SIFT and SURF detectors
//new DetectorQualityEvaluator( "SIFT", "quality-detector-sift" ),
//new DetectorQualityEvaluator( "SURF", "quality-detector-surf" ),
I get the following error:
OpenCV Error: Assertion failed (!extractor.empty() && !matcher.empty()) in VectorDescriptorMatcher, file /home/sy/opencv-2.4.8/modules/features2d/src/matchers.cpp, line 1089
When I use following code
//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()
I also get the errro below. I think it doesn't recognize "FERN" matcher. Only CalonderDescriptor works in this example.
OpenCV Error: Bad argument (Unknown matcher name) in create, file /home/sy/opencv-2.4.8/modules/features2d/src/matchers.cpp, line 488
Regards
Upvotes: 0
Views: 772
Reputation: 21
I encountered the exact same failure. After some debugging I found that for SIFT and SURF, you'll need the nonfree module, which is missing from the example code. Add :
#include "opencv2/nonfree/nonfree.hpp"
Then insert the following in main():
cv::initModule_nonfree();
before the line:
Ptr<BaseQualityEvaluator> evals[] =
Regards
Upvotes: 2