赞
踩
安装opencv过程省略,具体可查找其他博主的教程。
在catkin_make时,出现以下错误:
CMake Error at /opt/ros/melodic/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. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
probot_vision_pick/probot_ocr/CMakeLists.txt:12 (find_package)
查看error
网上很多都说改CMakeList.txt,然后添加set(…)的路径。
一开始改了我的工作空间的src下的CMakeList.txt,发现不对,其实应该是打开error中显示的路径的CMakeLists.txt
Call Stack (most recent call first):
probot_vision_pick/probot_ocr/CMakeLists.txt:12 (find_package)
如图所示:
set(OpenCV_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev)
find_package(catkin REQUIRED COMPONENTS
.........省略
修改成
# set(OpenCV_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev)
set(OpenCV_DIR /usr/share/OpenCV)
find_package(catkin REQUIRED COMPONENTS
......省略
!!!注意,/usr/share/OpenCV,为OpenCVConfig.cmake的路径,可以在终端输入
locate OpenCVConfig.cmake
得到其所在目录。
保存,重新catkin_make即可。
PS:注意要多看终端的报错,有时第一个error即是问题关键,后边的只是连锁反应而已。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。