Ask Your Question

ROS Kinetic OpenCV3.2.0 Contrib and CUDA

asked 2017-04-01 14:00:22 -0600

mondi gravatar image

updated 2017-04-01 14:12:41 -0600

Hallo community,

I working currently on a vision problem and want to use cuda to fulfill some real-time contraints. To solve the vision problem I want to utilize ROS Kinetic and OpenCV.

My question is now is it possible to replace the opencv version which is delivered with ROS Kinectic (OpenCV3.2.0) with the same opencv version with enabled CUDA?

The most information how to setup and compile the correct opencv version can be found on the ROS wiki page for the opencv3 package I guess ( section 5. Build the package). Here is described how to checkout the right repos and modify the CMAKE file in the right way. For CUDA I have to add the -DWITH_CUDA flag. Everthing right until now?

Now the complex part: Which software have to be uninstalled before installing the own compiled version and where I have to install it, so ROS can work with it naturally like with the opencv libs which are delivered with ROS Kinetic?

My second question is motivated by a statement which I also have found on the wiki page from ROS opencv3 package. There is stated that with opencv 3.2.0 it is now possible to build opencv contrib with installed opencv. This seems interesting for me because I want to modify or better add functionality to a algorithm which is implemented in opencv contrib rgbd.

Is it possible to build only the opencv contrib rgbd package as debug and working on it? At the moment I have no idea how to do it, so will be great when you can help me out.

When you have some question on your side, feel free to ask.

System: Ubuntu 16.04, CUDA8.0, ROS Kinetic, OpenCV 3.2.0

best regards,


edit retag flag offensive close merge delete


What I would do:

  • on Ubuntu, uninstall the OpenCV version shipped by ROS using Synaptic
  • compile from source OpenCV with the appropriate options
  • link the ROS packages that need OpenCV with this version of OpenCV
Eduardo gravatar imageEduardo ( 2017-04-03 04:18:38 -0600 )edit

Did you get how to solve it, this is a good question.

waschbaer gravatar imagewaschbaer ( 2018-03-16 13:21:51 -0600 )edit

@waschbaer, please do not post an answer here, if you have a question or a comment, thank you !

berak gravatar imageberak ( 2018-03-16 13:26:26 -0600 )edit

I am facing the same problem

please help me how to fix it?

redhwan gravatar imageredhwan ( 2019-08-26 03:45:50 -0600 )edit
  • Remove everythin related to OpenCV in ROS.
    • Build your own version of OpenCV.
    • Clone the removed package that depends on OpenCV (e.g. cv_bridge, build the source and link them to your OpenCV version.
Eduardo gravatar imageEduardo ( 2019-08-27 07:19:11 -0600 )edit

I built my own OpenCV, how to link package of ros with my opencv? please help me thanks in advance

redhwan gravatar imageredhwan ( 2019-08-27 07:26:58 -0600 )edit

It should be something like this:

  • catkin_make VERBOSE=1 --cmake-args -DOpenCV_DIR=your_opencv_build_dir
  • or catkin_make VERBOSE=1 --cmake-args -DOpenCV_DIR=your_opencv_build_dir/install/share/OpenCV

I don't remember exactly which OpenCV path. VERBOSE=1 to see if everything are correctly linked. Not sure if --cmake-args is needed or not...

Eduardo gravatar imageEduardo ( 2019-08-27 13:32:53 -0600 )edit

Thanks a lot for your helping

redhwan gravatar imageredhwan ( 2019-08-27 19:17:31 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-04-06 11:04:22 -0600

Vincent Rabaud gravatar image

You should probably ask that question on Build OpenCV like you would for any source package in ROS using (but have the rosinstall_generator only mention opencv3.

For creating one lib in debug only, I don't think it's feasible through CMake. You can still build OpenCV in Release and Debug mode and copy the files over, I believe that should work.

edit flag offensive delete link more

Question Tools



Asked: 2017-04-01 14:00:22 -0600

Seen: 3,755 times

Last updated: Mar 16 '18