Ask Your Question

How to use GPU enabled OpenCV with ROS Kinetic?

asked 2017-05-27 21:49:23 -0600

naveenT1010 gravatar image

Hi, I want to use CUDA enabled OpenCV with ROS. I have kinetic which already has one OpenCV 3.2 but it is not cuda enabled and also doesn't have extra modules of opencv_contrib. For this reason, I built a new OpenCV in /usr/local with CUDA and opencv_contrib enabled and I got this new OpenCV working.

Now I have been through most of the question for implementing custom OpenCV with ROS and somehow, I am able to compile (catkin_make) my package using with custom OpenCV but when I run it, with rosrun, it again uses kinetic opencv and shows cuda not enabled. Any help in this regard would be appreciated.

P.S - I am able to use extra modules even with kinetic opencv also (It just worked by itself). Only that cuda part is not working for me.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-28 17:32:13 -0600

naveenT1010 gravatar image

I got this thing working now. I followed this : Similar Question

The key was that I had to rebuild all other packages also which were dependent upon OpenCV (vision_opencv which has cv_bridge). Also, in my cmakelist file, I have include all OpenCV packages and libraries for my project before the catkin packages. I dont know currently if it played a major role, but atleast its working now.

If the problem still persists, please check your $CMAKE_PREFIX_PATH and $LD_LIBRARY_PATH. They should have the /usr/local (where your custom OpenCV is present) path before any of the ROS paths.

edit flag offensive delete link more


I am facing the same problem, I uninstalled opencv library and leave kinetic which already has OpenCV 3.3.1-dev.

how to run the code with GPU.

please help me

Redhwan gravatar image Redhwan  ( 2019-08-22 00:06:26 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-05-27 21:49:23 -0600

Seen: 5,236 times

Last updated: May 28 '17