2015-11-06 115 views
2

我想實現的OpenCV-3.0.0 對於它的SURF算法我已經包含頭文件的OpenCV-3.0.0的Ubuntu 14.04 「非自由/ nonfree.hpp」 建立自己的錯誤

#include <stdio.h> 
#include <iostream> 
#include "opencv2/core.hpp" 
#include "opencv2/features2d.hpp" 
#include "opencv2/highgui.hpp" 
#include "opencv2/calib3d.hpp" 
#include "opencv2/xfeatures2d.hpp" 
#include "opencv2/calib3d.hpp" 
#include <opencv2/nonfree/nonfree.hpp> 
using namespace cv; 
using namespace std; 

但我不斷收到下面提到的錯誤。我試圖到處搜索,但找不到任何解決方案。我已經構建了具有額外依賴性的opencv模塊。

In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0, 
      from panaroma.cpp:7: 
/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 panaroma.cpp:7: 
/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 panaroma.cpp:7: 
/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 panaroma.cpp:7: 
/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; 
             ^

編輯1 所以,我其實面臨的問題是,我試圖用這是在發展,而不是穩定版本的包。我只需要做git checkout 3.0.0即可獲得穩定版本。

+0

你的編譯器是什麼? – Azad

+0

g ++ 4.8.4在ubuntu上 –

+1

嘗試用'opencv2/nonfree/features2d.hpp'替換'opencv2/nonfree/nonfree.hpp' – Azad

回答

0

打開文件features2d.hpp位於/usr/include/opencv2/nonfree/features2d.hpp 你應該是sudo usr編輯文件。 將「vector」頭文件添加爲#include < vector> 然後使用namespace std;

這應該可以解決您的問題。 關於, Avinash

相關問題