Using external opencv version - kinetic

asked 2019-08-19 06:06:42 -0600

teshansj gravatar image

I need to use OpenCV dnn for a ROS node. Since the default OpenCV version that comes with kinetic does not have support for all the functionality that I need, I installed OpenCV4. Then I did the following in the CMake to get it to work.

set(OpenCV_DIR "/usr/local/lib/")
FIND_PACKAGE(OpenCV 4 REQUIRED)

This works fine. Problem arises when I try to use some image related packages (which might be trying to use the ROS OpenCV).

In my node, next I need some image_geometry functionalities. But when I put image_geometry in the find_package, it starts to give me compile errors starting from the message error: ‘dnn’ in namespace ‘cv’ does not name a type. These are the same compile errors I get if I use the cv_bridge instead of OpenCV4.

Does anybody have a workaround for this? Some way to point image_geometry (or any other ROS package using OpenCV) to an OpenCV version other than the ROS OpenCV version.

edit retag flag offensive close merge delete

Comments

1

I believe OpenCV is no different from other system dependencies in this case. See whether #q289264 helps.

gvdhoorn gravatar imagegvdhoorn ( 2019-08-19 08:21:49 -0600 )edit

Try running the following code at top:

import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
parzival gravatar imageparzival ( 2019-08-19 15:31:25 -0600 )edit

@parzival This node is in c++

teshansj gravatar imageteshansj ( 2019-08-19 22:43:07 -0600 )edit