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

ROS hydro opencv2 linking error during 'catkin_make'

asked 2014-10-08 14:54:47 -0500

Greave gravatar image

I have little problem with my ROS hydro distro. I need to use it for one project so can't change to Indiko.

Problem is that I have used catkin_create_pkg packname opencv2 ... for creating my project package. But when I try to invoke catkin_make I get following errors:

CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:75 (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.

I know that opencv2 is installed, because I can find it with rospack find opencv2 and I can use it in other projects not related to ROS.

I have following lines in CMakeLists.txt and package.xml

CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS opencv2)

include_directories( ${catkin_INCLUDE_DIRS} ${opencv2_INCLUDE_DIRS} )

target_link_libraries(BasicObstDetect_node ${catkin_LIBRARIES} ${opencv2_LIBRARIES} )

package.xml:

<build_depend>opencv2</build_depend>

<run_depend>opencv2</run_depend>

I have tried to use OpenCV instead of opencv2 but that didn't make any difference. Any advices?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2014-10-08 19:28:01 -0500

ahendrix gravatar image

updated 2014-10-08 22:20:27 -0500

OpenCV is a system package in Hydro; not a ROS package.

According to the vision_opencv docs, you should have a build_depend and a run_depend on opencv2 in your package.xml, and you should add the following to your cmakelists:

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(my_awesome_library ${OpenCV_LIBRARIES})
edit flag offensive delete link more

Comments

The question refers to Hydro.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-08 19:45:14 -0500 )edit
Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-08 22:49:14 -0500 )edit

Yes. opencv2 is distributed as a third-party cmake package.

ahendrix gravatar image ahendrix  ( 2014-10-08 23:09:32 -0500 )edit

Thanks that helped.

Greave gravatar image Greave  ( 2014-10-09 01:20:09 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-10-08 14:50:16 -0500

Seen: 412 times

Last updated: Oct 08 '14