c++opencvrosrobotics

linking issue with opencv and ros indigo while trying to install vision_opencv


Hi my question is of two folds. First, I am confused as why there are opencv3 and OpenCV-3.1.0-dev packages is in /opt/ros/indigo/share as i have read that opencv 2.4.8 is the default version of ROS indigo.

Also, I have opencv 2.4.13 version installed on ubuntu 14.04 with ROS Indigo, I want to use opencv for vision part for my project and for that i tried to install vision_opencv package from source. However when I try to build the package using catkin_make following error occurs

similar question is asked here ROS, opencv3 and CMake - unable to remove the library

-- ==> add_subdirectory(vision_opencv/image_geometry)

CMake Error at /opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVModules.cmake:183 (message): The imported target "opencv_xobjdetect" references the file

 "/opt/ros/indigo/lib/libopencv_xobjdetect3.so.3.1.0"

but this file does not exist. Possible reasons include:

Call Stack (most recent call first): /opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake:86 (include) vision_opencv/image_geometry/CMakeLists.txt:5 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/hemang/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/hemang/catkin_ws/build/CMakeFiles/CMakeError.log".


What I dont understand is why is it trying to link with Opencv3 when system does not have opencv3 installed or ROS indigo comes with opencv3 now ??


Solution

  • so I figured it out so in the CMakeLists.txt files of both cv_bridge and image_geometry, find package(OpenCV REQUIRED) should be find package (OpenCV 2.4.13 REQUIRED) . This is in my case as I have OpenCV 2.4.13 installed, one can replace it with any version one is using.