Ask Your Question
0

error: ‘create’ is not a member of ‘cv::FeatureDetector {aka cv::Feature2D}’ Ptr<FeatureDetector> detector = FeatureDetector::create("SURF") and some compiling errors for OpenCV sample code

asked 2015-11-14 15:30:43 -0600

winter-star gravatar image

I am trying to compile the sample demo: here

I have been slowly repairing different compiling errors. I have added includes for:

#include <opencv2/xfeatures2d/nonfree.hpp>
#include <opencv2/features2d/features2d.hpp>

I have also written:

initModule_nonfree();

At the beginning of the main method. When I compile with: g++ -ggdb -I/usr/local/include/opencv -I/usr/local/include -lopencv_features2d -lopencv_highgui -lopencv_imgproc -lopencv_nonfree -lopencv_core -lopencv_flann main.cpp -o main

I get the errors:

main.cpp:19:38: error: ‘create’ is not a member of ‘cv::DescriptorExtractor {aka cv::Feature2D}’ Ptr<descriptorextractor> extractor = DescriptorExtractor::create("SURF"); ^

main.cpp:20:33: error: ‘create’ is not a member of ‘cv::FeatureDetector {aka cv::Feature2D}’ Ptr<featuredetector> detector = FeatureDetector::create("SURF"); ^

main.cpp: In function ‘int main(int, char**)’: main.cpp:113:21: error: ‘initModule_nonfree’ was not declared in this scope initModule_nonfree(); ^

main.cpp:130:2: error: ‘NormalBayesClassifier’ was not declared in this scope NormalBayesClassifier classifier;

I am including the nonfree libraries. Is there something else I need to do to compile this properly?

edit retag flag offensive close merge delete

Comments

opencv version ?

berak gravatar imageberak ( 2015-11-14 22:59:33 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-01-29 00:13:20 -0600

zshn25 gravatar image

For the first two errors, its because of the CV version 3. Try this

Ptr<descriptorextractor> extractor = SURF::create();

Ptr<featuredetector> detector = SURF::create();

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-11-14 15:30:43 -0600

Seen: 3,115 times

Last updated: Jan 29 '16