0
$\begingroup$

Rosanswers logo

I have been using OpenCV without issue for months, but today when I catkin_make my workspace I now get the error:

-- +++ processing catkin package: 'clam_vision' -- ==> add_subdirectory(clam_vision) CMake Error at /opt/ros/groovy/share/catkin/cmake/catkinConfig.cmake:71 (find_package): Could not find a configuration file for package vision_opencv.

Set vision_opencv_DIR to the directory containing a CMake configuration file for vision_opencv. The file will have one of the following names:

vision_opencvConfig.cmake
vision_opencv-config.cmake

Call Stack (most recent call first):
clam_vision/CMakeLists.txt:7 (find_package)

CMake Error at /opt/ros/groovy/share/catkin/cmake/catkinConfig.cmake:71 (find_package): Could not find a configuration file for package opencv2.

Set opencv2_DIR to the directory containing a CMake configuration file for opencv2. The file will have one of the following names:

opencv2Config.cmake
opencv2-config.cmake

Call Stack (most recent call first):
clam_vision/CMakeLists.txt:7 (find_package)

I have tried reinstalling ros-groovy-vision-opencv and ros-groovy-opencv2. Searching my computer I found lots of files named opencv.cmake in different locations.

I have made no changes except updating ROS, and everything seems to be installed and working correctly, so I do not understand what the issue is.


Originally posted by Dave Coleman on ROS Answers with karma: 1396 on 2013-02-28

Post score: 2


Original comments

Comment by zweistein on 2013-03-04:
I'm also using OpenCV in ROS Groovy and I need to use the cvblob library. I have the same linking error while compiling, just for the cvblob lib can not be found.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You should have something like this in your CMakeList.txt to link OpenCV with your pkg:

include_directories(include  
 ${catkin_INCLUDE_DIRS}
 /home/elod/opencv/cmake/
) 
 ...
add_executable(bagDetect src/main.cpp)
find_package(OpenCV REQUIRED)
target_link_libraries(bagDetect ${OpenCV_LIBS})

I'm working with ROS Groovy therefore my package.xml has this rows to:

<build_depend>OpenCV</build_depend>
<run_depend>cvBlob</run_depend>

If you build it with make VERBOSE=1, than ur able to check the linked libraries.


Originally posted by zweistein with karma: 231 on 2013-03-04

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Dave Coleman on 2013-03-04:
Thanks for the answer, that's about what I did after Vincent helped me. Also, I'm pretty sure having "/home/elod/opencv/cmake/" hard coded into your CMakeLists is bad practice.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Vincent Rabaud helped me through this issue via Email:

Ok, so vision_opencv is a stack so you cannot depend on it/find_package it: you have to depend/find_package any of its packages (cv_bridge ...).

opencv2 is not a ROS package so you cannot find_package it through catkin. You need to find_package it as any user would do: find_package(OpenCV). I'll update the wiki for that.

So now in my package.xml I have:

  <build_depend>image_geometry</build_depend>
  <build_depend>cv_bridge</build_depend>
  <build_depend>OpenCV</build_depend>

And in my CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS cv_bridge image_geometry ...)
...
find_package(OpenCV REQUIRED)
...
add_executable(calibrate_kinect_checkerboard
  src/detect_calibration_pattern.cpp
  src/calibrate_kinect_checkerboard.cpp
  )
target_link_libraries(calibrate_kinect_checkerboard ${catkin_LIBRARIES} ${OpenCV_LIBS})

Originally posted by Dave Coleman with karma: 1396 on 2013-03-04

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by lifelonglearner on 2013-10-07:
I am facing the same problem, but this explanation seems to be a little more complicated for a beginner like me, can you please explain in a little easy way. Thanking you.

Comment by GeneralSpoonFul on 2014-01-08:
I have the same problem and I'm still facing the same problem even if I added the lines Dave Coleman said to in the package and CMakeLists files... I still can't find the cv_bridge package when using catkin_make.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.