rubengooj / stvo-pl

Stereo Visual Odometry by combining point and line segment features
GNU General Public License v3.0
222 stars 96 forks source link

undefined reference to cv::line_descriptor #2

Closed RichardChe closed 7 years ago

RichardChe commented 7 years ago

Hello, When I compiled the source code, the following error occurred:

../lib/libstvo.so: undefined reference to `cv::line_descriptor::LSDDetector::detect(cv::Mat const&, std::vector<cv::line_descriptor::KeyLine, std::allocator >&, int, int, cv::line_descriptor::LSDDetector::LSDOptions, cv::Mat const&)' collect2: error: ld returned 1 exit status make[2]: [imagesStVO] Error 1 make[1]: [CMakeFiles/imagesStVO.dir/all] Error 2 make: *** [all] Error 2

I compiled OpenCV 3.0.0 with the line_descriptor module provided in StVO-PL-master/3rdparty and there was no error. Did I miss something?
rubengooj commented 7 years ago

Hi, it should be straightforward, are you sure you're linking the same version that you compiled with the line_descriptor module to the project? If so, can you tell me the OpenCV version you are using? (Cause actually I'm using the 3.0.0 as well).

RichardChe commented 7 years ago

Yes. I used OpenCV 3.0.0 and here is the steps that I had taken before this error occurred.

  1. Compiled OpenCV with the following command:

    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv300 -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D 
    WITH_CUDA=OFF -D WITH_OPENMP=ON -D OPENCV_EXTRA_MODULES_PATH=/home/lenovo/opencv-3.0.0/opencv_contrib/modules ..
    
    sudo make install -j4

    /home/lenovo/opencv-3.0.0/opencv_contrib/modules includes the line_descriptor module copied from StVO-PL-master/3rdparty and the installation was 100% successful.

  2. Use cmake-gui and assign OpenCV_DIR to /home/lenovo/opencv-3.0.0/release

  3. make, and the error occurred.

It should be the same version.

rubengooj commented 7 years ago

Well, I just updated my OpenCV version, and I compiled the project without any issues...

  1. Are you compiling it with or without the MRPT? If you're using the MRPT, you have to compile it with the updated OpenCV version (including the line_descriptor)

  2. How many OpenCV versions do you have in your computer? Is it possible that you previously installed a different version without the line descriptors, and you're linking the wrong version without the line_descriptor module to the project?

RichardChe commented 7 years ago

OK, it seems that there was something wrong with my computer(hard drive problem : ( ). The source code and the OpenCV version are both correct. I just reinstalled my Ubuntu and repeated the steps above and finally the compilation succeeded.