0
$\begingroup$

Rosanswers logo

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?


Originally posted by Greave on ROS Answers with karma: 1 on 2014-10-08

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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})

Originally posted by ahendrix with karma: 47576 on 2014-10-08

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Dirk Thomas on 2014-10-08:
The question refers to Hydro.

Comment by Dirk Thomas on 2014-10-08:
Are you sure about that? https://github.com/ros/rosdistro/blob/87e6d5907066d7a753a533c42e9e3bb43497d993/hydro/distribution.yaml#L4615

Comment by ahendrix on 2014-10-08:
Yes. opencv2 is distributed as a third-party cmake package.

Comment by Greave on 2014-10-09:
Thanks that helped.

$\endgroup$

Your Answer

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