hengli / camodocal

CamOdoCal: Automatic Intrinsic and Extrinsic Calibration of a Rig with Multiple Generic Cameras and Odometry
Other
1.18k stars 390 forks source link

Problem linking opencv nonfree libraries #61

Open gntoni opened 7 years ago

gntoni commented 7 years ago

When compiling the code using openCV 2.4, I came across the following error:

CMakeFiles/camodocal_dvision.dir/SurfSet.cpp.o: In function `DVision::SurfSet::extract(cv::Mat const&, CvSURFParams const&)':
SurfSet.cpp:(.text+0x14af): undefined reference to `cv::SURF::SURF(double, int, int, bool, bool)'
SurfSet.cpp:(.text+0x163d): undefined reference to `cv::SURF::operator()(cv::_InputArray const&, cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::_OutputArray const&, bool) const'
SurfSet.cpp:(.text+0x1803): undefined reference to `VTT for cv::SURF'
CMakeFiles/camodocal_dvision.dir/SurfSet.cpp.o: In function `DVision::SurfSet::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&, CvSURFParams const&)':
SurfSet.cpp:(.text+0x1d63): undefined reference to `cv::SURF::SURF(double, int, int, bool, bool)'
SurfSet.cpp:(.text+0x1ee1): undefined reference to `cv::SURF::operator()(cv::_InputArray const&, cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::_OutputArray const&, bool) const'
SurfSet.cpp:(.text+0x208f): undefined reference to `VTT for cv::SURF'
CMakeFiles/camodocal_dvision.dir/SurfSet.cpp.o: In function `cv::SURF::~SURF()':
SurfSet.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0x10): undefined reference to `VTT for cv::SURF'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcamodocal_dvision.so] Error 1
make[1]: *** [src/dbow2/DVision/CMakeFiles/camodocal_dvision.dir/all] Error 2
make: *** [all] Error 2

It is a linking problem with the opencv nonfree libraries, I solved it by adding "opencv_nonfree" to target link libraries in camodocal/src/dbow2/DVision/CMakeLists.txt