ROSERROR : CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message)

ROSERROR : CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message)
文章图片

产生这个的原因是:在tx2中我把原来opencv4.1.1版本卸载了,重新安装了opencv3.2
重新安装了cv_bridge,在cv_bridge中找opencv的默认路径不一样,所以要修改。在哪里修改呢?
这里:/opt/ros/melodic/share/cv_bridge/cv_bridgeConfig.cmake
修改哪里呢?下图的96行,阴影行
ROSERROR : CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message)
文章图片

【ROSERROR : CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message)】
原来是这样子:
ROSERROR : CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message)
文章图片

修改的内容是把 /usr/include/opencv 改为/usr/local/include/opencv

PS:原因是:使用sudo apt install ros-melodic-desktop-full安装的ros,那么会默认安装opencv版本到/usr/include,/usr/lib,/usr/share三个目录。但是如果我们从opencv官网源码编译安装的(以最常用的opencv3.2为例)opencv会默认安装到usr/local下对应的三个子目录。

    推荐阅读