Ask Your Question
2

OpenCV CMake Error [closed]

asked 2013-02-28 16:00:17 -0500

Dave Coleman gravatar image

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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Dave Coleman
close date 2013-03-04 09:21:17

Comments

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.

zweistein gravatar imagezweistein ( 2013-03-04 00:25:20 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
6

answered 2013-03-04 09:19:58 -0500

Dave Coleman gravatar image

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})
edit flag offensive delete link more

Comments

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.

lifelonglearner gravatar imagelifelonglearner ( 2013-10-07 14:54:59 -0500 )edit

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.

GeneralSpoonFul gravatar imageGeneralSpoonFul ( 2014-01-08 14:20:16 -0500 )edit
1

answered 2013-03-04 01:11:24 -0500

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.

edit flag offensive delete link more

Comments

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.

Dave Coleman gravatar imageDave Coleman ( 2013-03-04 09:14:56 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-02-28 16:00:17 -0500

Seen: 8,670 times

Last updated: Mar 04 '13