dorian3d / DBoW2

Enhanced hierarchical bag-of-word library for C++
Other
851 stars 367 forks source link

nonfree opencv error while compilining. #23

Open azinnai opened 7 years ago

azinnai commented 7 years ago

I'm currently using opencv 3.2.0. While I was compiling I got this error:

fatal error: opencv2/xfeatures2d/nonfree.hpp: No such file or directory compilation terminated.

even if I have correctly installed libopencv-nonfree-dev. So I symlinked:

sudo ln -s /usr/include/opencv2/nonfree/nonfree.hpp /usr/include/opencv2/xfeatures2d/nonfree.hpp Now the error is:

In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0, from /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:27: /usr/include/opencv2/nonfree/features2d.hpp:73:21: error: ‘vector’ has not been declared vector<KeyPoint>& keypoints) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:73:27: error: expected ‘,’ or ‘...’ before ‘<’ token vector<KeyPoint>& keypoints) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:77:21: error: ‘vector’ has not been declared vector<KeyPoint>& keypoints, ^ /usr/include/opencv2/nonfree/features2d.hpp:77:27: error: expected ‘,’ or ‘...’ before ‘<’ token vector<KeyPoint>& keypoints, ^ /usr/include/opencv2/nonfree/features2d.hpp:76:10: error: ‘void cv::SIFT::operator()(cv::InputArray, cv::InputArray, int) const’ cannot be overloaded void operator()(InputArray img, InputArray mask, ^ /usr/include/opencv2/nonfree/features2d.hpp:72:10: error: with ‘void cv::SIFT::operator()(cv::InputArray, cv::InputArray, int) const’ void operator()(InputArray img, InputArray mask, ^ /usr/include/opencv2/nonfree/features2d.hpp:81:5: error: ‘AlgorithmInfo’ does not name a type AlgorithmInfo* info() const; ^ /usr/include/opencv2/nonfree/features2d.hpp:83:49: error: ‘vector’ has not been declared void buildGaussianPyramid( const Mat& base, vector<Mat>& pyr, int nOctaves ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:83:55: error: expected ‘,’ or ‘...’ before ‘<’ token void buildGaussianPyramid( const Mat& base, vector<Mat>& pyr, int nOctaves ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:84:33: error: ‘vector’ does not name a type void buildDoGPyramid( const vector<Mat>& pyr, vector<Mat>& dogpyr ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:84:39: error: expected ‘,’ or ‘...’ before ‘<’ token void buildDoGPyramid( const vector<Mat>& pyr, vector<Mat>& dogpyr ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:85:39: error: ‘vector’ does not name a type void findScaleSpaceExtrema( const vector<Mat>& gauss_pyr, const vector<Mat>& dog_pyr, ^ /usr/include/opencv2/nonfree/features2d.hpp:85:45: error: expected ‘,’ or ‘...’ before ‘<’ token void findScaleSpaceExtrema( const vector<Mat>& gauss_pyr, const vector<Mat>& dog_pyr, ^ /usr/include/opencv2/nonfree/features2d.hpp:89:40: error: ‘vector’ has not been declared void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:89:46: error: expected ‘,’ or ‘...’ before ‘<’ token void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:90:41: error: ‘vector’ has not been declared void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:90:47: error: expected ‘,’ or ‘...’ before ‘<’ token void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:125:28: error: ‘vector’ has not been declared CV_OUT vector<KeyPoint>& keypoints) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:125:34: error: expected ‘,’ or ‘...’ before ‘<’ token CV_OUT vector<KeyPoint>& keypoints) const; ^ In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0, from /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:27: /usr/include/opencv2/nonfree/features2d.hpp:128:28: error: ‘vector’ has not been declared CV_OUT vector<KeyPoint>& keypoints, ^ /usr/include/opencv2/nonfree/features2d.hpp:128:34: error: expected ‘,’ or ‘...’ before ‘<’ token CV_OUT vector<KeyPoint>& keypoints, ^ /usr/include/opencv2/nonfree/features2d.hpp:127:10: error: ‘void cv::SURF::operator()(cv::InputArray, cv::InputArray, int) const’ cannot be overloaded void operator()(InputArray img, InputArray mask, ^ In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0, from /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:27: /usr/include/opencv2/nonfree/features2d.hpp:124:10: error: with ‘void cv::SURF::operator()(cv::InputArray, cv::InputArray, int) const’ void operator()(InputArray img, InputArray mask, ^ In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0, from /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:27: /usr/include/opencv2/nonfree/features2d.hpp:132:5: error: ‘AlgorithmInfo’ does not name a type AlgorithmInfo* info() const; ^ /usr/include/opencv2/nonfree/features2d.hpp:142:40: error: ‘vector’ has not been declared void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:142:46: error: expected ‘,’ or ‘...’ before ‘<’ token void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:143:41: error: ‘vector’ has not been declared void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const; ^ /usr/include/opencv2/nonfree/features2d.hpp:143:47: error: expected ‘,’ or ‘...’ before ‘<’ token void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const; ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp: In member function ‘void DVision::SurfSet::extract(const cv::Mat&, const DVision::SurfSet::SURFParams&)’: /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:123:11: error: ‘xfeatures2d’ is not a member of ‘cv’ cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create( ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:123:11: error: ‘xfeatures2d’ is not a member of ‘cv’ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:123:32: error: template argument 1 is invalid cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create( ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:123:45: error: ‘cv::xfeatures2d’ has not been declared cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create( ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:128:7: error: base operand of ‘->’ is not a pointer surf->detectAndCompute(image, cv::Mat() /* mask */, this->keys, descs); ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp: In member function ‘void DVision::SurfSet::compute(const cv::Mat&, const std::vector<cv::KeyPoint>&, const DVision::SurfSet::SURFParams&)’: /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:180:13: error: ‘xfeatures2d’ is not a member of ‘cv’ cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create( ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:180:13: error: ‘xfeatures2d’ is not a member of ‘cv’ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:180:34: error: template argument 1 is invalid cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create( ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:180:47: error: ‘cv::xfeatures2d’ has not been declared cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create( ^ /home/ale/university/third_semester/probabilist_robotics/exam/DBoW2/build/dependencies/src/DLib/src/DVision/SurfSet.cpp:185:9: error: base operand of ‘->’ is not a pointer surf->compute(image, this->keys, descs); ^ [ 16%] Building CXX object CMakeFiles/DLib.dir/src/DUtilsCV/GUI.cpp.o CMakeFiles/DLib.dir/build.make:182: recipe for target 'CMakeFiles/DLib.dir/src/DVision/SurfSet.cpp.o' failed make[5]: *** [CMakeFiles/DLib.dir/src/DVision/SurfSet.cpp.o] Error 1 make[5]: *** Waiting for unfinished jobs.... CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DLib.dir/all' failed make[4]: *** [CMakeFiles/DLib.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make[3]: *** [all] Error 2 CMakeFiles/DLib.dir/build.make:110: recipe for target 'dependencies/src/DLib-stamp/DLib-build' failed make[2]: *** [dependencies/src/DLib-stamp/DLib-build] Error 2 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DLib.dir/all' failed make[1]: *** [CMakeFiles/DLib.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

Thanks for the support.

pmoulon commented 7 years ago

Default DBoW2 ask to have opencv compile with the non free features modules (one that are in contribs). You can check my version here that have a flag to disable the support of the non free module and so compile with the regular opencv. https://github.com/pmoulon/DBoW2/commit/c14bd20ab1b9a26884f1bdc0e900d77c955b5d4a

azinnai commented 7 years ago

Thanks, I have rebuilt opencv 3.2.0 with opencv_contrib and all works fine now.

dorian3d commented 7 years ago

Latest version does without nonfree features.