Re: How to build rtabmap_ros with own opencv instead of ros's opencv

Posted by simon.xm.lee on
URL: http://official-rtab-map-forum.206.s1.nabble.com/How-to-build-rtabmap-ros-with-own-opencv-instead-of-ros-s-opencv-tp3113p3120.html

Hi Mathieu,

Sorry, I let you misunderstand with my poor expression. I already do as your mention. I build opencv(3.2.0) by source and install to /usr/local really. This opencv support Cuda and xfeatures2d module. Then I build rtabmap by source and make install. Then I build rtabmap_ros in catkin_ws/ by catkin_make. Below are information which I make sure I build rtabmap and rtabmap_ros with the opencv which I want.

I follow your suggestion. I modify .bashrc and make sure /usr/local/bin is first in $PATH and /usr/local/lib is first in $LD_LIBRARY_PATH. Then I re-build rtabmap and rtabmap_ros by clean build.

[rtabmap cmake command]

$ cmake -DOpenCV_DIR=/usr/local/share/OpenCV -DCMAKE_INSTALL_PREFIX=~/catkin_ws/devel ..


[rtabmap cmale info]

rtabmap_cmake_log.rtabmap_cmake_log
..
Found CUDA: /usr/local/cuda-8.0 (found suitable exact version "8.0")
..
--   With OpenCV 3 xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = YES (License: Non commercial)


[rtabmap_ros cmake command]

$ catkin_make -j1 -DOpenCV_DIR=/usr/local/share/OpenCV


[rtabmap_ros build info]

rtabmap_ros_build_log.rtabmap_ros_build_log
I print OpenCV_INCLUDE_DIRS, OpenCV_CONFIG_PATH, CUDA_FOUND environment parameters in CMakeLists.txt. And it correspond what I want.

-- [Simon] OpenCV_INCLUDE_DIRS:
-- ----------------------
-- /usr/local/include/usr/local/include/opencv
-- ----------------------
...
-- [Simon] OpenCV_CONFIG_PATH:
-- ----------------------
-- /usr/local/share/OpenCV
-- ----------------------
..,
-- [Simon] CUDA found



But finally I still got the same result. The rtabmap still use ros's opencv instead of the opencv I build. I have no ideas for this.
OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/include/opencv2/core/private.cuda.hpp, line 97
[ INFO] [1494565865.802606297]: Parameters are not saved! (No configuration file provided...)
rtabmap: Saving database/long-term memory... (located at /home/ubuntu/.ros/rtabmap.db)



Regards.