ROS "catkin_make" cannot find OpenCVConfig.cmake

Hi there,

I’m trying to build a ROS package which requires OpenCV using the “catkin_make” command.

Upon trying to build, I get the following error for CMakeList command “find_package(OpenCV REQUIRED)”:

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

OpenCVConfig.cmake
opencv-config.cmake

Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory containing one of the above files.

I found the “OpenCVConfig.cmake” file at /usr/share/OpenCV/ and have set this location within the “OpenCV_DIR” env variable.
Despite this, I still get the error listed above.

Any ideas?

Hi Will,

first of all you must verify that you have installed cv_bridge and image_geometry ROS packages on your machine.

sudo apt-get install ros-indigo-cv-bridge ros-indigo-image-geometry

Then try to recompile your node… if you are still getting the error try to follow my guide:

http://myzharbot.robot-home.it/blog/software/ros-nvidia-jetson-tx1-jetson-tk1-opencv-ultimate-guide/

Let me know

Walter

Thanks Walter!

Will give that a try tomorrow

I tried what you mentioned as well as following your blog post but it didn’t fix the issue, thanks anyway!

Are you sure that you have installed opencv4tegra on your system?

What do you get if you put “pkg-config --libs opencv”?

ubuntu@tegra-ubuntu:~/catkin_ws$ pkg-config --libs opencv
-L/usr/local/cuda-7.0/targets/armv7-linux-gnueabihf/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_detection_based_tracker -lopencv_esm_panorama -lopencv_facedetect -lopencv_imuvstab -lopencv_tegra -lopencv_vstab -lcufft -lnpps -lnppi -lnppc -lcudart -ltbb -lrt -lpthread -lm -ldl

EDIT: fixed the problem by adding “set(OpenCV_DIR /usr/share/OpenCV/)” before the find_package() command in my cmakelists file

I’m happy you solved it, but I cannot figure out why you need that command… I do not use it in my CMakeLists

odd! Thanks for all your help

Hello,
I am using the jetpack image on the sdk which is supposed to come with the opencv4tegra preinstalled.

My results for pkg-config --libs opencv4”:

bam@bam-desktop:~/catkin_ws/src/tests_cv$ pkg-config --libs opencv4
-lopencv_dnn -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core

I still get the same error even when I add the

set(OpenCV4_DIR /usr/share/OpenCV4/)”
before my CMakeLists
The opencv version installed is opencv4.

I am building a completely new package with dependency on opencv4