Ubuntu18.04 ros-melodic opencv版本冲突问题解决

2022/3/27 7:23:17

本文主要是介绍Ubuntu18.04 ros-melodic opencv版本冲突问题解决,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

原链接:https://blog.csdn.net/Shushan1/article/details/116588614

问题描述

ros自带的opencv版本和自己安装的opencv版本冲突导致如下报错
在这里插入图片描述

解决办法

修改cv_bridge指定的opencv版本

sudo gedit /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake

修改如下两个地方

#if(NOT "include;/usr/include;/usr/include/opencv " STREQUAL " ")
if(NOT "include;/usr/local/include/opencv;/usr/local/include/opencv2 " STREQUAL " ")
  set(cv_bridge_INCLUDE_DIRS "")
  #set(_include_dirs "include;/usr/include;/usr/include/opencv")
  set(_include_dirs "include;/usr/local/lib;/usr/local/include/opencv;/usr/local/include/opencv2;/usr/local/include;/usr/include")

这里注意改成自己的版本

#set(libraries "cv_bridge;/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0;/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.3.2.0;/usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2.0")
set(libraries "cv_bridge;/usr/local/lib/libopencv_core.so.3.4.16;/usr/local/lib/libopencv_imgproc.so.3.4.16;/usr/local/lib/libopencv_imgcodecs.so.3.4.16")

然后重新catkin_make即可



这篇关于Ubuntu18.04 ros-melodic opencv版本冲突问题解决的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程