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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

simon.xm.lee
Hi ,

    I build a opencv version in /usr/local/ and make install to catkin_ws/devel. And I also add below codes in rtabmap_ros/CMakeLists.txt to force rtabmap use my opencv. But it seems rtabmap still use ros's opencv. How do I force rtabmap using my opencv version?

[CMakeLists.txt]

set(OpenCV_INCLUDE_DIRS "/usr/local/include" "/usr/local/include/opencv2")
set(OpenCV_INSTALL_PATH "/usr/local/")



[Log]

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] [1494502652.519841544]: Parameters are not saved! (No configuration file provided...)
rtabmap: Saving database/long-term memory... (located at /home/ubuntu/.ros/rtabmap.db)
[rtabmap/rtabmap-2] process has died [pid 22363, exit code -11, cmd /home/ubuntu/catkin_ws/devel/lib/rtabmap_ros/rtabmap --delete_db_on_start odom:=/odom rgb/image:=/kinect2/qhd/image_color_rect depth/image:=/kinect2/qhd/image_depth_rect rgb/camera_info:=/kinect2/qhd/camera_info __name:=rtabmap __log:=/home/ubuntu/.ros/log/f642fe2c-363b-11e7-baca-00044b669d37/rtabmap-rtabmap-2.log].
log file: /home/ubuntu/.ros/log/f642fe2c-363b-11e7-baca-00044b669d37/rtabmap-rtabmap-2*.log


Regards.
















Reply | Threaded
Open this post in threaded view
|

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

matlabbe
Administrator
Hi,

don't build opencv in /usr/local, but install it in it:
$ cd ~
$ git clone https://github.com/opencv/opencv.git
$ cd opencv
$ mkdir build
$ make
$ sudo make install
This will install in /usr/local by default.

You don't need to change anything in the CMakeLists.txt. By default cmake will try the default paths to find OpenCVConfig.cmake. Make sure in the PATH, "/usr/local/bin" is first:
$ export PATH=/usr/local/bin:$PATH
Make sure to clean the build directory of rtabmap to force cmake to look up again for opencv.

On runtime, if opencv libraries in /usr/local/lib are not taken first, you can update LD_LIBRARY_PATH environment variable:
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Also which version of opencv are you installing? If it is opencv 2 on Kinetic, there will be conflicts when building rtabmap_ros. See installation instructions for more info.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

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

simon.xm.lee
This post was updated on .
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.
Reply | Threaded
Open this post in threaded view
|

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

simon.xm.lee
This post was updated on .
Hi Mathieu,

Here is the similar problem.

I follow the suggestion to build vision_opencv by source. Then the problem is resolved. It is really caused by cv_bridge. The cv_bridge let rtabmap_ros use ros's opencv.

Thanks for your help.

Regards.