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

Could not find a configuration file for package opencv

asked 2014-01-28 00:00:08 -0500

Safeer gravatar image

updated 2014-04-20 14:09:34 -0500

ngrennan gravatar image

I am trying to compile the code given at this page

I am using ROS Groovy on Ubuntu 12.04

When I run catkin_make, I get the following error:

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

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

    opencvConfig.cmake
    opencv-config.cmake

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

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

learning_image_transport is my package name.

Cmake file:

cmake_minimum_required(VERSION 2.8.3)
project(learning_image_transport)
find_package(catkin REQUIRED COMPONENTS cv_bridge image_geometry image_transport opencv)
find_package(OpenCV)    
include_directories(include  
 ${catkin_INCLUDE_DIRS} /opt/ros/groovy/share/OpenCV)

Package.xml:

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>cv_bridge</build_depend>
  <build_depend>image_transport</build_depend>
  <build_depend>opencv2</build_depend>
  <build_depend>image_geometry</build_depend>
  <build_depend>opencv</build_depend>  
  <build_depend>OpenCV</build_depend>
  <run_depend>cv_bridge</run_depend>
  <run_depend>image_transport</run_depend>
  <run_depend>opencv2</run_depend>

I have tried to follow the methods describe in various questions, with same problem, such as this and some more. However, the problem still exists in my case.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
8

answered 2014-01-28 00:56:39 -0500

Wolf gravatar image

Remove OpenCv Opencv2 etc. from your run and build depends (in package.xml) as well as from the line find_package( catkin REQUIRED COMPONENTS .... (in CMakeLists.txt)

With catkin in groovy/hydro OpenCV is always embedded as stand-alone package using:

find_package( OpenCV REQUIRED )

(Note than I've added the REQUIRED)

Note that you have also to add OpenCV include directories like

include_directories(  ${catkin_INCLUDE_DIRS}  ${OpenCV_INCLUDE_DIRS} )

and for each of your execs/libs you created as target like

add_executable( my_exec my_cpp_file.cpp )

you need to link against both catkin and OpenCV libs:

target_link_libraries ( my_exec ${OpenCV_LIBRARIES} ${catkin_LIBRARIES} )
edit flag offensive delete link more

Comments

Thanks alot! The code built like a charm! But still the code is showing no output. It is publishing and subscribing successfully to the topics but it's not opening any window as stated in the link of the code, mentioned above

Safeer gravatar image Safeer  ( 2014-01-28 20:56:11 -0500 )edit

Try adding a cv::startWindowThread(); after cv::namedWindow();, see http://answers.ros.org/question/63570/problem-facing-in-integration-of-ros-and-opencv/#118206

Wolf gravatar image Wolf  ( 2014-01-28 21:20:15 -0500 )edit

Thanks for your response. The window is now showing but still there is no image in it.

Safeer gravatar image Safeer  ( 2014-01-28 22:09:36 -0500 )edit

Do input and output image show up on rosrun image_view image_view image:=/camera/image_raw and rosrun image_view image_view image:=/image_converter/output_video? At which rate is your input image published approx.?

Wolf gravatar image Wolf  ( 2014-01-28 23:43:31 -0500 )edit

I have tried these commands rosrun image_view image_view image:=/camera/image_raw rosrun image_view image_view image:=/image_converter/output_video A window is opening but no output is shown.

Safeer gravatar image Safeer  ( 2014-01-29 00:14:31 -0500 )edit

Are there images published on topic /camera/image_raw ? At which rate? The node you mentioned processes images coming in there, so it depends on a second node, e.g. camera driver/rosbag which publishes to this topic...

Wolf gravatar image Wolf  ( 2014-01-29 00:22:05 -0500 )edit

Thanks for your quick reply. Our problem is solved.

Safeer gravatar image Safeer  ( 2014-01-31 21:08:20 -0500 )edit
1

Hi all,

I am also unable to catkin_make my package. I am following the same tutorial. I tried doing what Wolf said, but it doesn't help. My ROS version is indigo and my OpenCV version is 3.1.0. Could someone help me?

Shantnu gravatar image Shantnu  ( 2016-05-31 02:12:16 -0500 )edit

Question Tools

4 followers

Stats

Asked: 2014-01-28 00:00:08 -0500

Seen: 27,434 times

Last updated: Jan 28 '14