Could NOT find cv_bridge (missing: cv_bridge_DIR)

catkin_make:build报错信息显示如下:

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - line_det
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'line_det'
-- ==> add_subdirectory(line_det)
-- Could NOT find cv_bridge (missing: cv_bridge_DIR)
-- Could not find the required component 'cv_bridge'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "cv_bridge" with
  any of the following names:

    cv_bridgeConfig.cmake
    cv_bridge-config.cmake

  Add the installation prefix of "cv_bridge" to CMAKE_PREFIX_PATH or set
  "cv_bridge_DIR" to a directory containing one of the above files.  If
  "cv_bridge" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  line_det/CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/dzh/Demo/lineDet/build/CMakeFiles/CMakeOutput.log".
See also "/home/dzh/Demo/lineDet/build/CMakeFiles/CMakeError.log".
Makefile:852: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
终端进程“/bin/bash '-c', 'catkin_make'”已终止,退出代码: 1

由于安装ROS时没有安装它的opencv模块,导致没有cv_bridge库,输入命令安装即可:

sudo apt-get install ros-melodic-cv-bridge

然后会显示即将安装的软件列表,确认无误后输入y回车进行安装。

将会同时安装下列软件:
  liblept5 libopencv-calib3d-dev libopencv-contrib-dev libopencv-contrib3.2
  libopencv-dev libopencv-features2d-dev libopencv-highgui-dev
  libopencv-objdetect-dev libopencv-stitching-dev libopencv-videostab-dev
  libopencv3.2-java libopencv3.2-jni libtesseract4 python-opencv
建议安装:
  opencv-doc
下列【新】软件包将被安装:
  liblept5 libopencv-calib3d-dev libopencv-contrib-dev libopencv-contrib3.2
  libopencv-dev libopencv-features2d-dev libopencv-highgui-dev
  libopencv-objdetect-dev libopencv-stitching-dev libopencv-videostab-dev
  libopencv3.2-java libopencv3.2-jni libtesseract4 python-opencv
  ros-melodic-cv-bridge
升级了 0 个软件包,新安装了 15 个软件包,要卸载 0 个软件包,有 417 个软件包未被升级。
需要下载 8,128 kB 的归档。
解压缩后会消耗 36.8 MB 的额外空间。
您希望继续执行吗? [Y/n] y

再次catkin_make:build发现程序运行成功。

在这里插入代码片`-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - line_det
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'line_det'
-- ==> add_subdirectory(line_det)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- line_det: 1 messages, 0 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dzh/Demo/lineDet/build
####
#### Running command: "make -j12 -l12" in "/home/dzh/Demo/lineDet/build"
####
Scanning dependencies of target line_det
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_nodejs
[ 11%] Building CXX object line_det/CMakeFiles/line_det.dir/src/line_det.cpp.o
[ 11%] Built target _line_det_generate_messages_check_deps_Point
[ 22%] Built target line_det_generate_messages_lisp
[ 33%] Built target line_det_generate_messages_nodejs
[ 55%] Built target line_det_generate_messages_eus
[ 66%] Built target line_det_generate_messages_cpp
[ 88%] Built target line_det_generate_messages_py
[ 88%] Built target line_det_generate_messages
In file included from /opt/ros/melodic/include/ros/publisher.h:35:0,
                 from /opt/ros/melodic/include/ros/node_handle.h:32,
                 from /opt/ros/melodic/include/ros/ros.h:45,
                 from /home/dzh/Demo/lineDet/src/line_det/src/line_det.cpp:1:
/usr/local/include/boost/bind.hpp:41:1: note: #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.
 )
 ^
[100%] Linking CXX executable /home/dzh/Demo/lineDet/devel/lib/line_det/line_det`

你可能感兴趣的:(ROS,opencv,人工智能,计算机视觉,ubuntu,ros)