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

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 -0500

sai gravatar image

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

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 sourceforge.net 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

include_directories("/home/sai/workspace/opencv-2.4.8/include/opencv") 
   link_directories("/home/sai/workspace/opencv-2.4.8/lib") 
   set(OpenCV_LIBS 
"opencv_gpu;opencv_contrib;opencv_legacy;opencv_objdetect;opencv_calib3d;opencv_features2d;opencv_video;opencv_highgui;opencv_ml;opencv_imgproc;opencv_flann;opencv_core") 

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

and

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
0

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

sai gravatar image

Finally its solved.

From the link http://answers.ros.org/question/61923/how-to-use-newer-versions-of-opencv-in-fuerte/

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

Stats

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

Seen: 1,319 times

Last updated: May 12 '14