ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How can I reference a standalone OpenCV installation inspite of having other version of Opencv version in ROS

asked 2014-01-08 18:02:48 -0600

sai gravatar image

updated 2014-05-12 20:31:07 -0600

130s gravatar image

I have fuerte version of ROS on ubuntu 12.04 and it comes with opencv2.4.2. I have also installed opencv from which is opencv2.4.8 following samontab blog.

I have a source code(not ROS, but a standalone C++ code) which when run automatically selects the opencv2.4.2. I want the program to run using opencv2.4.8.

I tried adding this to CMakeLists.txt


find_package(OpenCV 2.4.8 REQUIRED) 

target_link_libraries(exec {OpenCV_LIBS})

But still it uses Opencv that comes with ROS and also gives an error like this

 from /home/sai/workspace/loop_detector_on_depth_images/depth_loops/generic/src/dbow/FBit.h:5,
 from /home/sai/workspace/loop_detector_on_depth_images/depth_loops/generic/src/dbow/FBit.cpp:1:
 /opt/ros/fuerte/include/opencv2/flann/lsh_table.h: In member function ‘void cvflann::lsh::LshTable<ElementType>::add(cvflann::Matrix<T>)’:
 /opt/ros/fuerte/include/opencv2/flann/lsh_table.h:196:14: error: ‘use_speed_’ was not declared in this scope


pkg-config --cflags opencv says

-I/opt/ros/fuerte/include/opencv -I/opt/ros/fuerte/include

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-01-12 21:59:07 -0600

sai gravatar image

Finally its solved.

From the link

I cheated and went to /opt/ros/fuerte/include and changed the name of opencv2 to opencv2bak. This way it finds the right includes. I don't think it's the right way to do it, though.

Also, went to /opt/ros/fuerte/share/OpenCV/OpenCVConfig.cmake and edited the Install path variable to /usr/local (where I installed)

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-01-08 18:02:48 -0600

Seen: 1,314 times

Last updated: May 12 '14