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

Could not find a package configuration file provided by "opencv2"

asked 2016-05-27 06:00:49 -0500

spkulgod gravatar image

updated 2016-05-27 12:16:34 -0500

I was following the Converting between ROS images and OpenCV images (Python) tutorial and i came across the following problem while running catkin_make. I am new to ros and i am still finding my way around it. I have installed opencv and have tried out the solutions suggested in other threads, but none of them seem to work. This is the error i get while executing catkin_make.

  CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "opencv2" with any
  of the following names:

    opencv2Config.cmake
    opencv2-config.cmake

  Add the installation prefix of "opencv2" to CMAKE_PREFIX_PATH or set
  "opencv2_DIR" to a directory containing one of the above files.  If
  "opencv2" provides a separate development package or SDK, be sure it has
  been installed.

my CMakeLists file has the following content

cmake_minimum_required(VERSION 2.8.3)
project(opencv_test)
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  opencv2
  rospy
  sensor_msgs
  std_msgs
)
find_package(OpenCV)
include_directories(
  ${catkin_INCLUDE_DIRS}
)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(opencv_test ${OpenCV_LIBRARIES})
edit retag flag offensive close merge delete

Comments

Could you share the CMakeLists?

ROSkinect gravatar image ROSkinect  ( 2016-05-27 09:42:36 -0500 )edit

Please add a link to any tutorials you are following and / or pages you are referring to. It's hard to figure out what you are doing otherwise.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-27 14:07:44 -0500 )edit

This is the link for the tutorial http://wiki.ros.org/cv_bridge/Tutoria...

spkulgod gravatar image spkulgod  ( 2016-05-27 21:12:03 -0500 )edit

That page only tells you to update your manifest, which is not CMakeLists.txt, but package.xml.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-28 01:35:26 -0500 )edit

yeah but the vision_opencv page asks me to edit the CMakeLists.txt the link for the isvision_opencv

spkulgod gravatar image spkulgod  ( 2016-05-28 11:59:02 -0500 )edit

Again: that is for C++ only. Python programs/scripts/nodes are never linked against C++ libraries, nor do you setup an include path for them (or at least, not in the way that CMake snippet is doing).

gvdhoorn gravatar image gvdhoorn  ( 2016-05-28 12:31:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
6

answered 2016-05-27 12:37:38 -0500

gvdhoorn gravatar image
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  opencv2
  ..

opencv2 is not a package, which is why CMake fails when it tries to find the config file.

Remove it from the catkin components. Just the find_package(OpenCV ..) should be enough.

edit flag offensive delete link more

Comments

i tried doing that and i get a different error as shown below

CMake Error at opencv_test/CMakeLists.txt:121 (target_link_libraries):
  Cannot specify link libraries for target "opencv_test" which is not built
  by this project.


-- Configuring incomplete, errors occurred!
spkulgod gravatar image spkulgod  ( 2016-05-27 14:01:01 -0500 )edit

This is probably because i have added opencv2 as a dependency while creating the package as told in the tutorial. Should i change it to opencv?

spkulgod gravatar image spkulgod  ( 2016-05-27 14:03:06 -0500 )edit

Which makes sense, since you don't have any executable target named opencv_test anywhere in your CMakeLists.txt.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-27 14:04:06 -0500 )edit

Converting between ROS images and OpenCV images (Python)

Is this in Python? If so, then none of this is needed. Python nodes are not compiled, and you have to do completely different things for them. See the catkin docs.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-27 14:06:50 -0500 )edit

thank you, i will try that out and get back.

spkulgod gravatar image spkulgod  ( 2016-05-28 11:59:42 -0500 )edit

Thank you for the help, it seems to be working.

spkulgod gravatar image spkulgod  ( 2016-05-30 02:33:00 -0500 )edit

spkulgod, How can you do that ? Teach me, pls

ToanJunifer gravatar image ToanJunifer  ( 2018-09-18 04:08:50 -0500 )edit

I trying to change follow the guide but it's not working. And then i access on catkin docs,then i click on install Cmake file dont know what is was: `catkin_package(CFG_EXTRAS your_macros.cmake your_modules.cmake)

ToanJunifer gravatar image ToanJunifer  ( 2018-09-18 04:12:29 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-27 06:00:49 -0500

Seen: 17,080 times

Last updated: May 27 '16