make error using opencv 2.4.8
amiltonwong opened this issue · 3 comments
Dear all,
I came across the following make error. It seems the original code supports opencv 2.3 while my system equips with opencv 2.4.8. What should I modify the code openFABMAPcli.cpp to pass the build step?
Thanks!
root@milton-OptiPlex-9010:/data/code/openfabmap/build# make
Scanning dependencies of target openFABMAP
[ 12%] Building CXX object CMakeFiles/openFABMAP.dir/src/chowliutree.cpp.o
[ 25%] Building CXX object CMakeFiles/openFABMAP.dir/src/inference.cpp.o
[ 37%] Building CXX object CMakeFiles/openFABMAP.dir/src/fabmap.cpp.o
[ 50%] Linking CXX static library lib/libopenFABMAP.a
[ 75%] Built target openFABMAP
Scanning dependencies of target openFABMAPcli
[ 87%] Building CXX object CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o
In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0,
from /data/code/openfabmap/samples/openFABMAPcli.cpp:58:
/usr/include/opencv2/nonfree/features2d.hpp:73:21: error: ‘vector’ has not been declared
vector& keypoints) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:73:27: error: expected ‘,’ or ‘...’ before ‘<’ token
vector& keypoints) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:77:21: error: ‘vector’ has not been declared
vector& keypoints,
^
/usr/include/opencv2/nonfree/features2d.hpp:77:27: error: expected ‘,’ or ‘...’ before ‘<’ token
vector& 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& pyr, int nOctaves ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:83:55: error: expected ‘,’ or ‘...’ before ‘<’ token
void buildGaussianPyramid( const Mat& base, vector& pyr, int nOctaves ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:84:33: error: ‘vector’ does not name a type
void buildDoGPyramid( const vector& pyr, vector& dogpyr ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:84:39: error: expected ‘,’ or ‘...’ before ‘<’ token
void buildDoGPyramid( const vector& pyr, vector& dogpyr ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:85:39: error: ‘vector’ does not name a type
void findScaleSpaceExtrema( const vector& gauss_pyr, const vector& dog_pyr,
^
/usr/include/opencv2/nonfree/features2d.hpp:85:45: error: expected ‘,’ or ‘...’ before ‘<’ token
void findScaleSpaceExtrema( const vector& gauss_pyr, const vector& dog_pyr,
^
/usr/include/opencv2/nonfree/features2d.hpp:89:40: error: ‘vector’ has not been declared
void detectImpl( const Mat& image, vector& 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& 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& keypoints, Mat& descriptors ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:90:47: error: expected ‘,’ or ‘...’ before ‘<’ token
void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:125:28: error: ‘vector’ has not been declared
CV_OUT vector& keypoints) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:125:34: error: expected ‘,’ or ‘...’ before ‘<’ token
CV_OUT vector& keypoints) const;
^
In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0,
from /data/code/openfabmap/samples/openFABMAPcli.cpp:58:
/usr/include/opencv2/nonfree/features2d.hpp:128:28: error: ‘vector’ has not been declared
CV_OUT vector& keypoints,
^
/usr/include/opencv2/nonfree/features2d.hpp:128:34: error: expected ‘,’ or ‘...’ before ‘<’ token
CV_OUT vector& 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 /data/code/openfabmap/samples/openFABMAPcli.cpp:58:
/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 /data/code/openfabmap/samples/openFABMAPcli.cpp:58:
/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& 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& 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& keypoints, Mat& descriptors ) const;
^
/usr/include/opencv2/nonfree/features2d.hpp:143:47: error: expected ‘,’ or ‘...’ before ‘<’ token
void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const;
^
In file included from /usr/include/_G_config.h:15:0,
from /usr/include/libio.h:31,
from /usr/include/stdio.h:74,
from /usr/include/c++/4.8/cstdio:42,
from /usr/local/include/opencv2/core/operations.hpp:52,
from /usr/local/include/opencv2/core.hpp:3106,
from /usr/local/include/opencv2/core/core.hpp:48,
from /data/code/openfabmap/samples/../include/inference.hpp:57,
from /data/code/openfabmap/samples/../include/fabmap.hpp:57,
from /data/code/openfabmap/samples/../include/openfabmap.hpp:58,
from /data/code/openfabmap/samples/openFABMAPcli.cpp:54:
/data/code/openfabmap/samples/openFABMAPcli.cpp: In function ‘cv::Ptrcv::Feature2D generateDetector(cv::FileStorage&)’:
/data/code/openfabmap/samples/openFABMAPcli.cpp:668:42: error: conversion from ‘long int’ to non-scalar type ‘cv::Ptrcv::Feature2D’ requested
cv::Ptrcv::FeatureDetector detector = NULL;
^
/data/code/openfabmap/samples/openFABMAPcli.cpp:677:19: error: expected type-specifier
detector = new cv::DynamicAdaptedFeatureDetector(
^
/data/code/openfabmap/samples/openFABMAPcli.cpp:677:19: error: expected ‘;’
/data/code/openfabmap/samples/openFABMAPcli.cpp:687:19: error: expected type-specifier
detector = new cv::StarFeatureDetector(
^
/data/code/openfabmap/samples/openFABMAPcli.cpp:687:19: error: expected ‘;’
/data/code/openfabmap/samples/openFABMAPcli.cpp:699:32: error: cannot allocate an object of abstract type ‘cv::FastFeatureDetector’
["NonMaxSuppression"] > 0);
^
In file included from /usr/local/include/opencv2/features2d/features2d.hpp:48:0,
from /data/code/openfabmap/samples/../include/bowmsctrainer.hpp:58,
from /data/code/openfabmap/samples/../include/openfabmap.hpp:59,
from /data/code/openfabmap/samples/openFABMAPcli.cpp:54:
/usr/local/include/opencv2/features2d.hpp:388:20: note: because the following virtual functions are pure within ‘cv::FastFeatureDetector’:
class CV_EXPORTS_W FastFeatureDetector : public Feature2D
^
/usr/local/include/opencv2/features2d.hpp:401:26: note: virtual void cv::FastFeatureDetector::setThreshold(int)
CV_WRAP virtual void setThreshold(int threshold) = 0;
^
/usr/local/include/opencv2/features2d.hpp:402:25: note: virtual int cv::FastFeatureDetector::getThreshold() const
CV_WRAP virtual int getThreshold() const = 0;
^
/usr/local/include/opencv2/features2d.hpp:404:26: note: virtual void cv::FastFeatureDetector::setNonmaxSuppression(bool)
CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
^
/usr/local/include/opencv2/features2d.hpp:405:26: note: virtual bool cv::FastFeatureDetector::getNonmaxSuppression() const
CV_WRAP virtual bool getNonmaxSuppression() const = 0;
^
/usr/local/include/opencv2/features2d.hpp:407:26: note: virtual void cv::FastFeatureDetector::setType(int)
CV_WRAP virtual void setType(int type) = 0;
^
/usr/local/include/opencv2/features2d.hpp:408:25: note: virtual int cv::FastFeatureDetector::getType() const
CV_WRAP virtual int getType() const = 0;
^
/data/code/openfabmap/samples/openFABMAPcli.cpp:733:19: error: expected type-specifier
detector = new cv::MserFeatureDetector(
^
/data/code/openfabmap/samples/openFABMAPcli.cpp:733:19: error: expected ‘;’
In file included from /usr/include/_G_config.h:15:0,
from /usr/include/libio.h:31,
from /usr/include/stdio.h:74,
from /usr/include/c++/4.8/cstdio:42,
from /usr/local/include/opencv2/core/operations.hpp:52,
from /usr/local/include/opencv2/core.hpp:3106,
from /usr/local/include/opencv2/core/core.hpp:48,
from /data/code/openfabmap/samples/../include/inference.hpp:57,
from /data/code/openfabmap/samples/../include/fabmap.hpp:57,
from /data/code/openfabmap/samples/../include/openfabmap.hpp:58,
from /data/code/openfabmap/samples/openFABMAPcli.cpp:54:
/data/code/openfabmap/samples/openFABMAPcli.cpp: In function ‘cv::Ptrcv::Feature2D generateExtractor(cv::FileStorage&)’:
/data/code/openfabmap/samples/openFABMAPcli.cpp:763:47: error: conversion from ‘long int’ to non-scalar type ‘cv::Ptrcv::Feature2D’ requested
cv::Ptrcv::DescriptorExtractor extractor = NULL;
^
make[2]: *** [CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o] Error 1
make[1]: *** [CMakeFiles/openFABMAPcli.dir/all] Error 2
make: *** [all] Error 2
root@milton-OptiPlex-9010:/data/code/openfabmap/build#
Do you have multiple versions of OpenCV on your computer? Your main concern should be this:
[ 87%] Building CXX object CMakeFiles/openFABMAPcli.dir/samples/openFABMAPcli.cpp.o
In file included from /usr/include/opencv2/nonfree/nonfree.hpp:46:0,
from /data/code/openfabmap/samples/openFABMAPcli.cpp:58:
/usr/include/opencv2/nonfree/features2d.hpp:73:21: error: ‘vector’ has not been declared
vector& keypoints) const;
But looking at the code for 2.4.8 it should be declared in features2d/features2d.hpp:46 -> opencv2/core/core.hpp:77:
using std::vector;
It looks like an issue with your OpenCV installation.
@kmactavish ,
Thanks for your reply. You're right. There are opencv 3.0 and opencv 2.4.8 installed in my system.
I switch to another machine with opencv 2.4.8 only. And it compiles successfully. THX~
Has there been any code written to use openFABMAP with gpu optimizations?