OpenCV compile error of nonfree/feature2d.hpp - c++

I am trying to compile a c++ program with SIFT/SURF, and when I include I get this error message:
/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: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 SURF_detector.cpp:12:0:
/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 SURF_detector.cpp:12:0:
/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 SURF_detector.cpp:12:0:
/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;
I am trying to use ROS and catkin, and it has all worked up until I have tried implementing SIFT/SURF. I have also tried to compile with normal g++ with no luck. I have tried to install OpenCV three times with different methods, but still the same results.
I am using Ubuntu 14.04 with OpenCV 2.4.10

I had the exact same problem, SIFT/SURF have been moved to the opencv_contrib module on github now
https://github.com/Itseez/opencv_contrib
you'll have to build opencv from start with the module included in the cmake process, they have a tutorial showing you how to do this
the features now have the namespace cv::xfeatures2d to reflect the contribution changes
hope that helps

Related

Converting cv::Mat to Eigen::Matrix gives compilation error from opencv2/core/eigen.hpp file (OpenCV + Eigen)

In my code, I have to convert cv::Mat to Eigen::Matrix so that I can use some of the functionalities of the Eigen library. I believe a straightforward option would be to manually copy+paste each element of cv::Mat into Eigen::Matrix. However, I stumbled upon this question on SO and found out about the cv::cv2eigen function. It's located in opencv2/core/eigen.hpp file.
Here is the sample code:
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/core/eigen.hpp>
#include <Eigen/Core>
int main(int argc, char const *argv[]) {
cv::Mat cv_mat = cv::Mat::eye(3, 3, CV_64FC1);
std::cout << cv_mat << std::endl;
Eigen::Matrix3d eigen_mat;
cv::cv2eigen(cv_mat, eigen_mat);
std::cout << eigen_mat << std::endl;
return 0;
}
However, weirdly enough, upon trying to build, I get way too many compilation errors from opencv2/core/eigen.hpp file:
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:63:22: error: ‘Eigen’ does not name a type; did you mean ‘eigen’?
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, OutputArray dst )
^~~~~
eigen
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:63:35: error: expected unqualified-id before ‘<’ token
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, OutputArray dst )
^
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:63:35: error: expected ‘)’ before ‘<’ token
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:63:35: error: expected initializer before ‘<’ token
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:81:22: error: ‘Eigen’ does not name a type; did you mean ‘eigen’?
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
^~~~~
eigen
.
.
.
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:234:6: error: redefinition of ‘template<class _Tp> void cv::cv2eigen(const cv::Mat&, int)’
void cv2eigen( const Mat& src,
^~~~~~~~
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:141:6: note: ‘template<class _Tp> void cv::cv2eigen(const cv::Mat&, int)’ previously declared here
void cv2eigen( const Mat& src,
^~~~~~~~
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:259:16: error: ‘Eigen’ has not been declared
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^~~~~
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:259:29: error: expected ‘,’ or ‘...’ before ‘<’ token
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp: In function ‘void cv::cv2eigen(const cv::Matx<_Tp, 1, _cols>&, int)’:
.
.
.
/usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp:262:23: error: ‘Eigen’ has not been declared
if( !(dst.Flags & Eigen::RowMajorBit) )
^~~~~
This is quite strange, right? Because I'm getting errors for the OpenCV functions that I'm not even touching.
So, how can I fix this weird issue?
P.S.
I'm using OpenCV 4.2.0
I've modified some explicit paths with <string>
Actually, I found the root cause:
As per line 78 & 79 of opencv/modules/core/include/opencv2/core/eigen.hpp on 4.x branch:
#note Using these functions requires the Eigen/Dense or similar header to be included before this header.
So, surprisingly enough, all I had to do was change the #include order
from
#include <opencv2/core.hpp>
#include <opencv2/core/eigen.hpp>
#include <Eigen/Core>
to
#include <opencv2/core.hpp>
#include <Eigen/Core>
#include <opencv2/core/eigen.hpp>
On the other hand, I checked the existing /usr/local/<blah_blah>/include/opencv4/opencv2/core/eigen.hpp file (OpenCV 4.2.0) on my machine, and sadly, it does not say anything about the #include order!
¯\_(ツ)_/¯

Unable to Build OpenCV project in eclipse CDT C++

Hello I am having issues getting my opencv setup and working with Eclipse and C++. I have my paths linked correctly and included libraries set up correctly, I have it working on my laptop so I am sure of this. When I try and build a project with just having #include as the only OpenCV code I get these errors.
UMat(UMat&& m);
^
/usr/local/include/opencv2/core/mat.hpp:2531:27: error: expected ‘,’ or ‘...’ before ‘&&’ token
UMat& operator = (UMat&& m);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: In member function ‘void cv::_InputArray::init(int, const void*, cv::Size)’:
/usr/local/include/opencv2/core/mat.inl.hpp:70:41: error: ambiguous overload for ‘operator=’ (operand types are ‘cv::Size {aka cv::Size_<int>}’ and ‘cv::Size {aka cv::Size_<int>}’)
{ flags = _flags; obj = (void*)_obj; sz = _sz; }
^
In file included from /usr/local/include/opencv2/core.hpp:58:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/types.hpp:1707:13: note: candidate: cv::Size_<_Tp>& cv::Size_<_Tp>::operator=(const cv::Size_<_Tp>&) [with _Tp = int]
Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz)
^
/usr/local/include/opencv2/core/types.hpp:1714:13: note: candidate: cv::Size_<_Tp>& cv::Size_<_Tp>::operator=(cv::Size_<_Tp>) [with _Tp = int]
Size_<_Tp>& Size_<_Tp>::operator = (Size_<_Tp>&& sz) CV_NOEXCEPT
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:88:37: error: ‘array’ in namespace ‘std’ does not name a template type
_InputArray::_InputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:88:42: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputArray::_InputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:89:86: error: ‘arr’ was not declared in this scope
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_READ, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:92:37: error: ‘array’ in namespace ‘std’ does not name a template type
_InputArray::_InputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:92:42: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputArray::_InputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:93:37: error: ‘arr’ was not declared in this scope
{ init(STD_ARRAY_MAT + ACCESS_READ, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:175:33: error: ‘cv::_OutputArray::_OutputArray’ declared as an ‘inline’ variable
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:175:33: error: ‘int cv::_OutputArray::_OutputArray’ is not a static data member of ‘class cv::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:175:33: error: template definition of non-template ‘int cv::_OutputArray::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:175:28: error: ‘array’ is not a member of ‘std’
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:175:42: error: expected primary-expression before ‘,’ token
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:175:50: error: ‘arr’ was not declared in this scope
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:33: error: ‘cv::_OutputArray::_OutputArray’ declared as an ‘inline’ variable
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:33: error: ‘int cv::_OutputArray::_OutputArray’ is not a static data member of ‘class cv::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:179:33: error: template definition of non-template ‘int cv::_OutputArray::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:179:28: error: ‘array’ is not a member of ‘std’
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:42: error: expected primary-expression before ‘,’ token
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:50: error: ‘arr’ was not declared in this scope
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:215:39: error: ‘array’ in namespace ‘std’ does not name a template type
_OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:215:44: error: expected ‘,’ or ‘...’ before ‘<’ token
_OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:216:87: error: ‘arr’ was not declared in this scope
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:219:39: error: ‘array’ in namespace ‘std’ does not name a template type
_OutputArray::_OutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:219:44: error: expected ‘,’ or ‘...’ before ‘<’ token
_OutputArray::_OutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:220:51: error: ‘arr’ was not declared in this scope
{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:290:43: error: ‘cv::_InputOutputArray::_InputOutputArray’ declared as an ‘inline’ variable
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:290:43: error: ‘int cv::_InputOutputArray::_InputOutputArray’ is not a static data member of ‘class cv::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:290:43: error: template definition of non-template ‘int cv::_InputOutputArray::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:290:38: error: ‘array’ is not a member of ‘std’
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:290:52: error: expected primary-expression before ‘,’ token
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:290:60: error: ‘arr’ was not declared in this scope
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:43: error: ‘cv::_InputOutputArray::_InputOutputArray’ declared as an ‘inline’ variable
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:43: error: ‘int cv::_InputOutputArray::_InputOutputArray’ is not a static data member of ‘class cv::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:294:43: error: template definition of non-template ‘int cv::_InputOutputArray::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:294:38: error: ‘array’ is not a member of ‘std’
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:52: error: expected primary-expression before ‘,’ token
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:60: error: ‘arr’ was not declared in this scope
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:325:49: error: ‘array’ in namespace ‘std’ does not name a template type
_InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:325:54: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:326:84: error: ‘arr’ was not declared in this scope
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:329:49: error: ‘array’ in namespace ‘std’ does not name a template type
_InputOutputArray::_InputOutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:329:54: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputOutputArray::_InputOutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:330:48: error: ‘arr’ was not declared in this scope
{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:562:21: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
Mat::Mat(const std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:562:37: error: expected ‘,’ or ‘...’ before ‘<’ token
Mat::Mat(const std::initializer_list<_Tp> list)
^
In file included from /usr/local/include/opencv2/core.hpp:54:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::Mat::Mat(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:565:5: error: ‘list’ was not declared in this scope
CV_Assert(list.size() != 0);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:566:14: error: ‘list’ was not declared in this scope
Mat((int)list.size(), 1, traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:570:21: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
Mat::Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:570:37: error: expected ‘,’ or ‘...’ before ‘<’ token
Mat::Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::Mat::Mat(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:574:14: error: ‘s’ does not name a type
for(auto s : sizes)
^
In file included from /usr/local/include/opencv2/core.hpp:54:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected ‘;’ before ‘do’
CV_Assert(list.size() != 0);
^
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected primary-expression before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected ‘;’ before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected primary-expression before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected ‘)’ before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: ‘list’ was not declared in this scope
CV_Assert(list.size() != 0);
^
/usr/local/include/opencv2/core/mat.inl.hpp:577:5: error: ‘list’ was not declared in this scope
CV_Assert(size_total == list.size());
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:578:14: error: ‘sizes’ was not declared in this scope
Mat((int)sizes.size(), (int*)sizes.begin(), traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
^
/usr/local/include/opencv2/core/mat.inl.hpp:578:83: error: ‘list’ was not declared in this scope
Mat((int)sizes.size(), (int*)sizes.begin(), traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:582:21: error: ‘array’ in namespace ‘std’ does not name a template type
Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
^
/usr/local/include/opencv2/core/mat.inl.hpp:582:26: error: expected ‘,’ or ‘...’ before ‘<’ token
Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::Mat::Mat(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:583:90: error: ‘arr’ was not declared in this scope
: flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows((int)arr.size()),
^
/usr/local/include/opencv2/core/mat.inl.hpp:588:10: error: ‘copyData’ was not declared in this scope
if( !copyData )
^
/usr/local/include/opencv2/core/mat.inl.hpp: In member function ‘void cv::Mat::assignTo(cv::Mat&, int) const’:
/usr/local/include/opencv2/core/mat.inl.hpp:762:11: error: ambiguous overload for ‘operator=’ (operand types are ‘cv::Mat’ and ‘const cv::Mat’)
m = *this;
^
/usr/local/include/opencv2/core/mat.inl.hpp:686:6: note: candidate: cv::Mat& cv::Mat::operator=(const cv::Mat&)
Mat& Mat::operator = (const Mat& m)
^
In file included from /usr/local/include/opencv2/core.hpp:59:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.hpp:2060:10: note: candidate: cv::Mat& cv::Mat::operator=(cv::Mat)
Mat& operator = (Mat&& m);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:1249:20: error: ‘array’ in namespace ‘std’ does not name a template type
Mat::operator std::array<_Tp, _Nm>() const
^
/usr/local/include/opencv2/core/mat.inl.hpp:1323:13: error: expected ‘,’ or ‘...’ before ‘&&’ token
Mat::Mat(Mat&& m)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1323:1: error: prototype for ‘cv::Mat::Mat(cv::Mat)’ does not match any in class ‘cv::Mat’
Mat::Mat(Mat&& m)
^
In file included from /usr/local/include/opencv2/core.hpp:59:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.hpp:1021:14: error: candidates are: cv::Mat::Mat(const cv::cuda::GpuMat&)
explicit Mat(const cuda::GpuMat& m);
^
/usr/local/include/opencv2/core/mat.hpp:1018:37: error: template<class _Tp> cv::Mat::Mat(const cv::MatCommaInitializer_<_Tp>&)
template<typename _Tp> explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer);
^
/usr/local/include/opencv2/core/mat.hpp:1014:37: error: template<class _Tp> cv::Mat::Mat(const cv::Point3_<_Tp>&, bool)
template<typename _Tp> explicit Mat(const Point3_<_Tp>& pt, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:1010:37: error: template<class _Tp> cv::Mat::Mat(const cv::Point_<_Tp>&, bool)
template<typename _Tp> explicit Mat(const Point_<_Tp>& pt, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:1006:51: error: template<class _Tp, int m, int n> cv::Mat::Mat(const cv::Matx<_Tp, m, n>&, bool)
template<typename _Tp, int m, int n> explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:1002:44: error: template<class _Tp, int n> cv::Mat::Mat(const cv::Vec<_Tp, m>&, bool)
template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:997:49: error: template<class _Tp, long unsigned int _Nm> cv::Mat::Mat(int)
template<typename _Tp, size_t _Nm> explicit Mat(const std::array<_Tp, _Nm>& arr, bool copyData=false);
^
/usr/local/include/opencv2/core/mat.hpp:992:37: error: template<class _Tp> cv::Mat::Mat(int)
template<typename _Tp> explicit Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list);
^
/usr/local/include/opencv2/core/mat.hpp:988:14: error: template<class _Tp, class> cv::Mat::Mat(int)
explicit Mat(const std::initializer_list<_Tp> list);
^
/usr/local/include/opencv2/core/mat.hpp:983:37: error: template<class _Tp> cv::Mat::Mat(const std::vector<_Tp>&, bool)
template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
^
/usr/local/include/opencv2/core/mat.hpp:965:5: error: cv::Mat::Mat(const cv::Mat&, const std::vector<cv::Range>&)
Mat(const Mat& m, const std::vector<Range>& ranges);
^
/usr/local/include/opencv2/core/mat.hpp:955:5: error: cv::Mat::Mat(const cv::Mat&, const cv::Range*)
Mat(const Mat& m, const Range* ranges);
^
/usr/local/include/opencv2/core/mat.hpp:945:5: error: cv::Mat::Mat(const cv::Mat&, const Rect&)
Mat(const Mat& m, const Rect& roi);
^
/usr/local/include/opencv2/core/mat.hpp:935:5: error: cv::Mat::Mat(const cv::Mat&, const cv::Range&, const cv::Range&)
Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all());
^
/usr/local/include/opencv2/core/mat.hpp:923:5: error: cv::Mat::Mat(const std::vector<int>&, int, void*, const size_t*)
Mat(const std::vector<int>& sizes, int type, void* data, const size_t* steps=0);
^
/usr/local/include/opencv2/core/mat.hpp:909:5: error: cv::Mat::Mat(int, const int*, int, void*, const size_t*)
Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:515:1: error: cv::Mat::Mat(cv::Size, int, void*, size_t)
Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/mat.inl.hpp:486:1: error: cv::Mat::Mat(int, int, int, void*, size_t)
Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/mat.inl.hpp:467:1: error: cv::Mat::Mat(const cv::Mat&)
Mat::Mat(const Mat& m)
^
/usr/local/include/opencv2/core/mat.inl.hpp:458:1: error: cv::Mat::Mat(const std::vector<int>&, int, const Scalar&)
Mat::Mat(const std::vector<int>& _sz, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:441:1: error: cv::Mat::Mat(int, const int*, int, const Scalar&)
Mat::Mat(int _dims, const int* _sz, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:450:1: error: cv::Mat::Mat(const std::vector<int>&, int)
Mat::Mat(const std::vector<int>& _sz, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:433:1: error: cv::Mat::Mat(int, const int*, int)
Mat::Mat(int _dims, const int* _sz, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:424:1: error: cv::Mat::Mat(cv::Size, int, const Scalar&)
Mat::Mat(Size _sz, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:407:1: error: cv::Mat::Mat(int, int, int, const Scalar&)
Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:416:1: error: cv::Mat::Mat(cv::Size, int)
Mat::Mat(Size _sz, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:399:1: error: cv::Mat::Mat(int, int, int)
Mat::Mat(int _rows, int _cols, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:393:1: error: cv::Mat::Mat()
Mat::Mat()
^
/usr/local/include/opencv2/core/mat.inl.hpp:1348:26: error: expected ‘,’ or ‘...’ before ‘&&’ token
Mat& Mat::operator = (Mat&& m)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In member function ‘cv::Mat& cv::Mat::operator=(cv::Mat)’:
/usr/local/include/opencv2/core/mat.inl.hpp:1350:18: error: ‘m’ was not declared in this scope
if (this == &m)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1354:13: error: ‘m’ was not declared in this scope
flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols; data = m.data;
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:1628:22: error: ‘cv::Mat_<_Tp>::Mat_’ declared as an ‘inline’ variable
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1628:22: error: ‘int cv::Mat_<_Tp>::Mat_’ is not a static data member of ‘class cv::Mat_<_Tp>’
/usr/local/include/opencv2/core/mat.inl.hpp:1628:22: error: template definition of non-template ‘int cv::Mat_<_Tp>::Mat_’
/usr/local/include/opencv2/core/mat.inl.hpp:1628:17: error: ‘initializer_list’ is not a member of ‘std’
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1628:42: error: expected primary-expression before ‘>’ token
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1628:44: error: ‘list’ was not declared in this scope
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1633:28: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
Mat_<_Tp>::Mat_(const std::initializer_list<int> sizes, std::initializer_list<_Tp> list)

opencv-3.0.0 ubuntu 14.04 "nonfree/nonfree.hpp" build error

I am trying to implement the SURF algorithm in opencv-3.0.0
For it I have included the header files
#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;
but I keep getting the error mentioned below. I have tried searching everywhere but couldn't find any solution. I have already build the opencv module with extra dependencies.
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;
^
EDIT 1
So, the issue I was actually facing was that I was trying to use the package which was in development and not stable version. I just had to do git checkout 3.0.0 to get to the stable version.
Open the file features2d.hpp located at /usr/include/opencv2/nonfree/features2d.hpp
You should be a sudo usr to edit the file.
Add the "vector" header file as #include < vector >
and then add using namespace std;
This should solve your problem.
regards,
Avinash

"UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 75: ordinal not in range(128)" using pip for python flandmark

I was trying to install flandmark for Python using pip, but I ended up getting an error that I cannot figure out how to solve or what the error means.
In the Ubuntu terminal, I used this command:
sudo pip install bob.ip.flandmark
When I tried to use that command, it gave me this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 75: ordinal not in range(128)
This is the other output from the Ubuntu command line (some are cut off because it won't let me go up any further):
from bob/ip/flandmark/flandmark_detector.h:15,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
In file included from /usr/local/include/opencv/cvaux.h:56:0,
from bob/ip/flandmark/flandmark_detector.h:16,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2673:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 3, which is not yet defined
OneWayDescriptorMatcher( const Params& params=Params() );
^
/usr/local/include/opencv2/legacy.hpp:2673:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 4, which is not yet defined
/usr/local/include/opencv2/legacy.hpp:2673:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 5, which is not yet defined
/usr/local/include/opencv2/legacy.hpp:2718:1: error: expected class-name before ‘{’ token
{
^
/usr/local/include/opencv2/legacy.hpp:2732:23: error: ‘string’ does not name a type
Params( const string& filename );
^
/usr/local/include/opencv2/legacy.hpp:2743:9: error: ‘string’ does not name a type
string filename;
^
/usr/local/include/opencv2/legacy.hpp:2759:17: error: ‘GenericDescriptorMatcher’ was not declared in this scope
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
^
/usr/local/include/opencv2/legacy.hpp:2759:41: error: template argument 1 is invalid
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
^
/usr/local/include/opencv2/legacy.hpp:2762:55: error: ‘vector’ has not been declared
virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/local/include/opencv2/legacy.hpp:2762:61: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/local/include/opencv2/legacy.hpp:2765:58: error: ‘vector’ has not been declared
virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/local/include/opencv2/legacy.hpp:2765:64: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/local/include/opencv2/legacy.hpp:2771:70: error: ‘vector’ has not been declared
float& bestProb, int& bestMatchIdx, vector<float>& signature );
^
/usr/local/include/opencv2/legacy.hpp:2771:76: error: expected ‘,’ or ‘...’ before ‘<’ token
float& bestProb, int& bestMatchIdx, vector<float>& signature );
^
/usr/local/include/opencv2/legacy.hpp:2785:40: error: ‘string’ does not name a type
CalonderDescriptorExtractor( const string& classifierFile );
^
/usr/local/include/opencv2/legacy.hpp:2796:49: error: ‘vector’ has not been declared
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
^
/usr/local/include/opencv2/legacy.hpp:2796:55: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
^
/usr/local/include/opencv2/legacy.hpp:2803:1: error: prototype for ‘cv::CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const string&)’ does not match any in class ‘cv::CalonderDescriptorExtractor<T>’
CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const std::string& classifier_file)
^
/usr/local/include/opencv2/legacy.hpp:2785:5: error: candidate is: cv::CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const int&)
CalonderDescriptorExtractor( const string& classifierFile );
^
/usr/local/include/opencv2/legacy.hpp:2810:50: error: ‘vector’ has not been declared
vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp:2810:56: error: expected ‘,’ or ‘...’ before ‘<’ token
vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp: In member function ‘virtual void cv::CalonderDescriptorExtractor<T>::computeImpl(const cv::Mat&, int) const’:
/usr/local/include/opencv2/legacy.hpp:2814:39: error: ‘keypoints’ was not declared in this scope
KeyPointsFilter::runByImageBorder(keypoints, image.size(), BORDER_SIZE);
^
/usr/local/include/opencv2/legacy.hpp:2817:5: error: ‘descriptors’ was not declared in this scope
descriptors.create((int)keypoints.size(), classifier_.classes(), cv::DataType<T>::type);
^
/usr/local/include/opencv2/legacy.hpp:2825:58: error: expected primary-expression before ‘>’ token
classifier_.getSignature( &ipl, descriptors.ptr<T>((int)i));
^
/usr/local/include/opencv2/legacy.hpp: In member function ‘virtual bool cv::CalonderDescriptorExtractor<T>::empty() const’:
/usr/local/include/opencv2/legacy.hpp:2840:24: error: ‘const class cv::RTreeClassifier’ has no member named ‘trees_’
return classifier_.trees_.empty();
^
/usr/local/include/opencv2/legacy.hpp: At global scope:
/usr/local/include/opencv2/legacy.hpp:2864:32: error: ‘vector’ does not name a type
PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,
^
/usr/local/include/opencv2/legacy.hpp:2864:38: error: expected ‘,’ or ‘...’ before ‘<’ token
PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,
^
/usr/local/include/opencv2/legacy.hpp:2872:30: error: ‘vector’ does not name a type
virtual void train(const vector<Mat>& pyr, int _npoints=300,
^
/usr/local/include/opencv2/legacy.hpp:2872:36: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void train(const vector<Mat>& pyr, int _npoints=300,
^
/usr/local/include/opencv2/legacy.hpp:2879:30: error: ‘vector’ does not name a type
virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp:2879:36: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp:2879:18: error: ‘virtual void cv::PlanarObjectDetector::train(int)’ cannot be overloaded
virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp:2872:18: error: with ‘virtual void cv::PlanarObjectDetector::train(int)’
virtual void train(const vector<Mat>& pyr, int _npoints=300,
^
/usr/local/include/opencv2/legacy.hpp:2887:5: error: ‘vector’ does not name a type
vector<KeyPoint> getModelPoints() const;
^
/usr/local/include/opencv2/legacy.hpp:2894:61: error: ‘vector’ has not been declared
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
^
/usr/local/include/opencv2/legacy.hpp:2894:67: error: expected ‘,’ or ‘...’ before ‘<’ token
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
^
/usr/local/include/opencv2/legacy.hpp:2895:27: error: ‘vector’ does not name a type
bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp:2895:33: error: expected ‘,’ or ‘...’ before ‘<’ token
bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/local/include/opencv2/legacy.hpp:2902:5: error: ‘vector’ does not name a type
vector<KeyPoint> modelPoints;
^
/usr/local/include/opencv2/legacy.hpp:2950:38: error: variable or field ‘cvInitSubdivDelaunay2D’ declared void
CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
^
/usr/local/include/opencv2/legacy.hpp:2950:38: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/local/include/opencv2/legacy.hpp:2950:50: error: ‘subdiv’ was not declared in this scope
CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
^
/usr/local/include/opencv2/legacy.hpp:2950:65: error: expected primary-expression before ‘rect’
CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
^
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv/cv.h:63,
from bob/ip/flandmark/flandmark_detector.h:15,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2953:1: error: ‘CvSubdiv2D’ does not name a type
CVAPI(CvSubdiv2D*) cvCreateSubdiv2D( int subdiv_type, int header_size,
^
In file included from /usr/local/include/opencv/cvaux.h:56:0,
from bob/ip/flandmark/flandmark_detector.h:16,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2960:12: error: ‘CvSubdiv2D’ does not name a type
CV_INLINE CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage )
^
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv/cv.h:63,
from bob/ip/flandmark/flandmark_detector.h:15,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2971:1: error: ‘CvSubdiv2DPoint’ does not name a type
CVAPI(CvSubdiv2DPoint*) cvSubdivDelaunay2DInsert( CvSubdiv2D* subdiv, CvPoint2D32f pt);
^
/usr/local/include/opencv2/legacy.hpp:2976:1: error: ‘CvSubdiv2DPointLocation’ does not name a type
CVAPI(CvSubdiv2DPointLocation) cvSubdiv2DLocate(
^
In file included from /usr/local/include/opencv/cvaux.h:56:0,
from bob/ip/flandmark/flandmark_detector.h:16,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2982:37: error: variable or field ‘cvCalcSubdivVoronoi2D’ declared void
CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
/usr/local/include/opencv2/legacy.hpp:2982:37: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/local/include/opencv2/legacy.hpp:2982:49: error: ‘subdiv’ was not declared in this scope
CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
/usr/local/include/opencv2/legacy.hpp:2986:38: error: variable or field ‘cvClearSubdivVoronoi2D’ declared void
CVAPI(void) cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
/usr/local/include/opencv2/legacy.hpp:2986:38: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/local/include/opencv2/legacy.hpp:2986:50: error: ‘subdiv’ was not declared in this scope
CVAPI(void) cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv/cv.h:63,
from bob/ip/flandmark/flandmark_detector.h:15,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2990:1: error: ‘CvSubdiv2DPoint’ does not name a type
CVAPI(CvSubdiv2DPoint*) cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt );
^
In file included from /usr/local/include/opencv/cvaux.h:56:0,
from bob/ip/flandmark/flandmark_detector.h:16,
from bob/ip/flandmark/flandmark_detector.cpp:17:
/usr/local/include/opencv2/legacy.hpp:2995:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge )
^
/usr/local/include/opencv2/legacy.hpp:3001:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate )
^
/usr/local/include/opencv2/legacy.hpp:3006:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge )
^
/usr/local/include/opencv2/legacy.hpp:3011:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type )
^
/usr/local/include/opencv2/legacy.hpp:3019:12: error: ‘CvSubdiv2DPoint’ does not name a type
CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge )
^
/usr/local/include/opencv2/legacy.hpp:3026:12: error: ‘CvSubdiv2DPoint’ does not name a type
CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge )
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/bob.ip.flandmark/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nOl3aD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/bob.ip.flandmark
How would I solve something like this?
Use Python 3 it will solve the problem. the error is because of non ASCI characters and default encoding standards for python 2.7 is not UTF-8, while Python 3 has default encoding standard as UTF-8. so use latest Python 3.

OpenCV symbol was not declared in this scope

I'm trying to compile a source-code from another person. Its OpenCV in C++.
I created a new Ubuntu Virtual Machine 64bit and installed this packets:
sudo apt-get install -y subversion build-essential git cmake libopencv-legacy-dev
git clone https://github.com/Itseez/opencv.git
cd ~/opencv_tmp/opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
sudo make install
Then I tried compile
cd project
mkdir build
cd build
cmake ..
make
And then this returned this error:
12%] Building CXX object CMakeFiles/Project.dir/main.o
In file included from xx,
from xx:
/usr/include/opencv2/legacy/legacy.hpp:1750:53: error: ‘cv::EM’ has not been declared
CvEMParams( int nclusters, int cov_mat_type=cv::EM::COV_MAT_DIAGONAL,
^
/usr/include/opencv2/legacy/legacy.hpp:1751:36: error: ‘cv::EM’ has not been declared
int start_step=cv::EM::START_AUTO_STEP,
^
/usr/include/opencv2/legacy/legacy.hpp:1767:1: error: expected class-name before ‘{’ token
{
^
(...)
^
^
^
/usr/include/opencv2/legacy/legacy.hpp:2600:73: error: expected ‘,’ or ‘...’ before ‘<’ token
void InitializeObjectDescriptors(IplImage* train_image, const vector<KeyPoint>& features,
^
/usr/include/opencv2/legacy/legacy.hpp:2609:5: error: ‘vector’ does not name a type
vector<KeyPoint> m_train_features; // train features
^
/usr/include/opencv2/legacy/legacy.hpp:2572:63: error: ‘string’ was not declared in this scope
const string &train_path = string (), const string &images_list = string (),
^
/usr/include/opencv2/legacy/legacy.hpp:2572:63: note: suggested alternative:
In file included from /usr/include/c++/4.8/string:39:0,
from /usr/local/include/opencv2/core/cvstd.hpp:58,
from /usr/local/include/opencv2/core/base.hpp:55,
from /usr/local/include/opencv2/core.hpp:52,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xx,
from xx:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
In file included from xx,
from xx:
/usr/include/opencv2/legacy/legacy.hpp:2572:102: error: ‘string’ was not declared in this scope
const string &train_path = string (), const string &images_list = string (),
^
/usr/include/opencv2/legacy/legacy.hpp:2572:102: note: suggested alternative:
In file included from /usr/include/c++/4.8/string:39:0,
from /usr/local/include/opencv2/core/cvstd.hpp:58,
from /usr/local/include/opencv2/core/base.hpp:55,
from /usr/local/include/opencv2/core.hpp:52,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xx,
from xx:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
In file included from xx,
from xx:
/usr/include/opencv2/legacy/legacy.hpp: In member function ‘void cv::OneWayDescriptorObject::SetLabeledFeatures(int)’:
/usr/include/opencv2/legacy/legacy.hpp:2584:64: error: ‘m_train_features’ was not declared in this scope
void SetLabeledFeatures(const vector<KeyPoint>& features) {m_train_features = features;};
^
/usr/include/opencv2/legacy/legacy.hpp:2584:83: error: ‘features’ was not declared in this scope
void SetLabeledFeatures(const vector<KeyPoint>& features) {m_train_features = features;};
^
/usr/include/opencv2/legacy/legacy.hpp: At global scope:
/usr/include/opencv2/legacy/legacy.hpp:2622:1: error: expected class-name before ‘{’ token
{
^
/usr/include/opencv2/legacy/legacy.hpp:2636:16: error: ‘string’ has not been declared
string pcaFilename = string(),
^
/usr/include/opencv2/legacy/legacy.hpp:2637:16: error: ‘string’ has not been declared
string trainPath = string(), string trainImagesList = string(),
^
/usr/include/opencv2/legacy/legacy.hpp:2637:45: error: ‘string’ has not been declared
string trainPath = string(), string trainImagesList = string(),
^
/usr/include/opencv2/legacy/legacy.hpp:2643:9: error: ‘string’ does not name a type
string pcaFilename;
^
/usr/include/opencv2/legacy/legacy.hpp:2644:9: error: ‘string’ does not name a type
string trainPath;
^
/usr/include/opencv2/legacy/legacy.hpp:2645:9: error: ‘string’ does not name a type
string trainImagesList;
^
/usr/include/opencv2/legacy/legacy.hpp:2667:17: error: ‘GenericDescriptorMatcher’ was not declared in this scope
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2667:41: error: template argument 1 is invalid
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2676:55: error: ‘vector’ has not been declared
virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2676:61: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2679:58: error: ‘vector’ has not been declared
virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2679:64: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2636:44: error: ‘string’ was not declared in this scope
string pcaFilename = string(),
^
/usr/include/opencv2/legacy/legacy.hpp:2636:44: note: suggested alternative:
In file included from /usr/include/c++/4.8/string:39:0,
from /usr/local/include/opencv2/core/cvstd.hpp:58,
from /usr/local/include/opencv2/core/base.hpp:55,
from /usr/local/include/opencv2/core.hpp:52,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xx,
from xx:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
In file included from xx,
from xx:
/usr/include/opencv2/legacy/legacy.hpp:2637:42: error: ‘string’ was not declared in this scope
string trainPath = string(), string trainImagesList = string(),
^
/usr/include/opencv2/legacy/legacy.hpp:2637:42: note: suggested alternative:
In file included from /usr/include/c++/4.8/string:39:0,
from /usr/local/include/opencv2/core/cvstd.hpp:58,
from /usr/local/include/opencv2/core/base.hpp:55,
from /usr/local/include/opencv2/core.hpp:52,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xx,
from xx:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
In file included from xx,
from xx:
/usr/include/opencv2/legacy/legacy.hpp:2637:77: error: ‘string’ was not declared in this scope
string trainPath = string(), string trainImagesList = string(),
^
/usr/include/opencv2/legacy/legacy.hpp:2637:77: note: suggested alternative:
In file included from /usr/include/c++/4.8/string:39:0,
from /usr/local/include/opencv2/core/cvstd.hpp:58,
from /usr/local/include/opencv2/core/base.hpp:55,
from /usr/local/include/opencv2/core.hpp:52,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xxxx,
from xxxx:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
In file included from xxx,
from xxxx:
/usr/include/opencv2/legacy/legacy.hpp:2650:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 3, which is not yet defined
OneWayDescriptorMatcher( const Params& params=Params() );
^
/usr/include/opencv2/legacy/legacy.hpp:2650:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 4, which is not yet defined
/usr/include/opencv2/legacy/legacy.hpp:2650:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 5, which is not yet defined
/usr/include/opencv2/legacy/legacy.hpp:2695:1: error: expected class-name before ‘{’ token
{
^
/usr/include/opencv2/legacy/legacy.hpp:2709:23: error: ‘string’ does not name a type
Params( const string& filename );
^
/usr/include/opencv2/legacy/legacy.hpp:2720:9: error: ‘string’ does not name a type
string filename;
^
/usr/include/opencv2/legacy/legacy.hpp:2736:17: error: ‘GenericDescriptorMatcher’ was not declared in this scope
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2736:41: error: template argument 1 is invalid
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2739:55: error: ‘vector’ has not been declared
virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2739:61: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2742:58: error: ‘vector’ has not been declared
virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2742:64: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2748:70: error: ‘vector’ has not been declared
float& bestProb, int& bestMatchIdx, vector<float>& signature );
^
/usr/include/opencv2/legacy/legacy.hpp:2748:76: error: expected ‘,’ or ‘...’ before ‘<’ token
float& bestProb, int& bestMatchIdx, vector<float>& signature );
^
/usr/include/opencv2/legacy/legacy.hpp:2762:40: error: ‘string’ does not name a type
CalonderDescriptorExtractor( const string& classifierFile );
^
/usr/include/opencv2/legacy/legacy.hpp:2773:49: error: ‘vector’ has not been declared
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2773:55: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2780:1: error: prototype for ‘cv::CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const string&)’ does not match any in class ‘cv::CalonderDescriptorExtractor<T>’
CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const std::string& classifier_file)
^
/usr/include/opencv2/legacy/legacy.hpp:2762:5: error: candidate is: cv::CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const int&)
CalonderDescriptorExtractor( const string& classifierFile );
^
/usr/include/opencv2/legacy/legacy.hpp:2787:50: error: ‘vector’ has not been declared
vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2787:56: error: expected ‘,’ or ‘...’ before ‘<’ token
vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp: In member function ‘virtual void cv::CalonderDescriptorExtractor<T>::computeImpl(const cv::Mat&, int) const’:
/usr/include/opencv2/legacy/legacy.hpp:2791:39: error: ‘keypoints’ was not declared in this scope
KeyPointsFilter::runByImageBorder(keypoints, image.size(), BORDER_SIZE);
^
/usr/include/opencv2/legacy/legacy.hpp:2794:5: error: ‘descriptors’ was not declared in this scope
descriptors.create((int)keypoints.size(), classifier_.classes(), cv::DataType<T>::type);
^
/usr/include/opencv2/legacy/legacy.hpp:2802:58: error: expected primary-expression before ‘>’ token
classifier_.getSignature( &ipl, descriptors.ptr<T>((int)i));
^
/usr/include/opencv2/legacy/legacy.hpp: In member function ‘virtual bool cv::CalonderDescriptorExtractor<T>::empty() const’:
/usr/include/opencv2/legacy/legacy.hpp:2817:24: error: ‘const class cv::RTreeClassifier’ has no member named ‘trees_’
return classifier_.trees_.empty();
^
/usr/include/opencv2/legacy/legacy.hpp: At global scope:
/usr/include/opencv2/legacy/legacy.hpp:2841:32: error: ‘vector’ does not name a type
PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,
^
/usr/include/opencv2/legacy/legacy.hpp:2841:38: error: expected ‘,’ or ‘...’ before ‘<’ token
PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,
^
/usr/include/opencv2/legacy/legacy.hpp:2849:30: error: ‘vector’ does not name a type
virtual void train(const vector<Mat>& pyr, int _npoints=300,
^
/usr/include/opencv2/legacy/legacy.hpp:2849:36: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void train(const vector<Mat>& pyr, int _npoints=300,
^
/usr/include/opencv2/legacy/legacy.hpp:2856:30: error: ‘vector’ does not name a type
virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2856:36: error: expected ‘,’ or ‘...’ before ‘<’ token
virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2856:18: error: ‘virtual void cv::PlanarObjectDetector::train(int)’ cannot be overloaded
virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2849:18: error: with ‘virtual void cv::PlanarObjectDetector::train(int)’
virtual void train(const vector<Mat>& pyr, int _npoints=300,
^
/usr/include/opencv2/legacy/legacy.hpp:2864:5: error: ‘vector’ does not name a type
vector<KeyPoint> getModelPoints() const;
^
/usr/include/opencv2/legacy/legacy.hpp:2871:61: error: ‘vector’ has not been declared
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2871:67: error: expected ‘,’ or ‘...’ before ‘<’ token
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
^
/usr/include/opencv2/legacy/legacy.hpp:2872:27: error: ‘vector’ does not name a type
bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2872:33: error: expected ‘,’ or ‘...’ before ‘<’ token
bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
^
/usr/include/opencv2/legacy/legacy.hpp:2879:5: error: ‘vector’ does not name a type
vector<KeyPoint> modelPoints;
^
/usr/include/opencv2/legacy/legacy.hpp:2927:38: error: variable or field ‘cvInitSubdivDelaunay2D’ declared void
CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
^
/usr/include/opencv2/legacy/legacy.hpp:2927:38: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/include/opencv2/legacy/legacy.hpp:2927:50: error: ‘subdiv’ was not declared in this scope
CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
^
/usr/include/opencv2/legacy/legacy.hpp:2927:65: error: expected primary-expression before ‘rect’
CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
^
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv2/core/utility.hpp:765,
from /usr/local/include/opencv2/core.hpp:2960,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from /home/xxxxxxxx,
from /homxxxxxxxxxxxxrc/main.cpp:2:
/usr/include/opencv2/legacy/legacy.hpp:2930:1: error: ‘CvSubdiv2D’ does not name a type
CVAPI(CvSubdiv2D*) cvCreateSubdiv2D( int subdiv_type, int header_size,
^
In file included from xx,
from xxxx:
/usr/include/opencv2/legacy/legacy.hpp:2937:12: error: ‘CvSubdiv2D’ does not name a type
CV_INLINE CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage )
^
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv2/core/utility.hpp:765,
from /usr/local/include/opencv2/core.hpp:2960,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xx,
from xx:
/usr/include/opencv2/legacy/legacy.hpp:2948:1: error: ‘CvSubdiv2DPoint’ does not name a type
CVAPI(CvSubdiv2DPoint*) cvSubdivDelaunay2DInsert( CvSubdiv2D* subdiv, CvPoint2D32f pt);
^
/usr/include/opencv2/legacy/legacy.hpp:2953:1: error: ‘CvSubdiv2DPointLocation’ does not name a type
CVAPI(CvSubdiv2DPointLocation) cvSubdiv2DLocate(
^
In file included from xxxxxx,
from xxxxxxx:
/usr/include/opencv2/legacy/legacy.hpp:2959:37: error: variable or field ‘cvCalcSubdivVoronoi2D’ declared void
CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
/usr/include/opencv2/legacy/legacy.hpp:2959:37: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/include/opencv2/legacy/legacy.hpp:2959:49: error: ‘subdiv’ was not declared in this scope
CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
/usr/include/opencv2/legacy/legacy.hpp:2963:38: error: variable or field ‘cvClearSubdivVoronoi2D’ declared void
CVAPI(void) cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
/usr/include/opencv2/legacy/legacy.hpp:2963:38: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/include/opencv2/legacy/legacy.hpp:2963:50: error: ‘subdiv’ was not declared in this scope
CVAPI(void) cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );
^
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv2/core/utility.hpp:765,
from /usr/local/include/opencv2/core.hpp:2960,
from /usr/local/include/opencv2/highgui.hpp:46,
from /usr/local/include/opencv2/highgui/highgui.hpp:48,
from xxxxxxxxxxx,
from xxxxxxxxxxx:
/usr/include/opencv2/legacy/legacy.hpp:2967:1: error: ‘CvSubdiv2DPoint’ does not name a type
CVAPI(CvSubdiv2DPoint*) cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt );
^
In file included from xxxxxxxxxxxxxxx
/usr/include/opencv2/legacy/legacy.hpp:2972:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge )
^
/usr/include/opencv2/legacy/legacy.hpp:2978:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate )
^
/usr/include/opencv2/legacy/legacy.hpp:2983:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge )
^
/usr/include/opencv2/legacy/legacy.hpp:2988:12: error: ‘CvSubdiv2DEdge’ does not name a type
CV_INLINE CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type )
^
/usr/include/opencv2/legacy/legacy.hpp:2996:12: error: ‘CvSubdiv2DPoint’ does not name a type
CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge )
^
/usr/include/opencv2/legacy/legacy.hpp:3003:12: error: ‘CvSubdiv2DPoint’ does not name a type
CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge )
^
/usr/include/opencv2/legacy/legacy.hpp:3014:29: error: variable or field ‘icvDrawMosaic’ declared void
CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
^
/usr/include/opencv2/legacy/legacy.hpp:3014:29: error: ‘CvSubdiv2D’ was not declared in this scope
/usr/include/opencv2/legacy/legacy.hpp:3014:41: error: ‘subdiv’ was not declared in this scope
CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
^
/usr/include/opencv2/legacy/legacy.hpp:3014:57: error: expected primary-expression before ‘*’ token
CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
^
/usr/include/opencv2/legacy/legacy.hpp:3014:59: error: ‘src’ was not declared in this scope
CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
^
/usr/include/opencv2/legacy/legacy.hpp:3014:72: error: expected primary-expression before ‘*’ token
CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
^
/usr/include/opencv2/legacy/legacy.hpp:3014:74: error: ‘dst’ was not declared in this scope
CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
^
/usr/include/opencv2/legacy/legacy.hpp:3018:32: error: ‘CvSubdiv2D’ was not declared in this scope
CVAPI(int) icvSubdiv2DCheck( CvSubdiv2D* subdiv );
^
/usr/include/opencv2/legacy/legacy.hpp:3018:44: error: ‘subdiv’ was not declared in this scope
CVAPI(int) icvSubdiv2DCheck( CvSubdiv2D* subdiv );
^
make[2]: *** [CMakeFiles/Project.dir/main.o] Error 1
make[1]: *** [CMakeFiles/Project.dir/all] Error 2
make: *** [all] Error 2
If you can switch to OpenCv v 3.3.0, the EM class is simply namespaced as cv::ml::EM.