Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

I have ROS in the system and it comes with opencv2.4.2. I have also installed opencv from sourceforge.net which is opencv2.4.8 following samontab blog.

Now I have a source 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 {OpeCV_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