5

ubuntu16.04下安装cv_bridge遇到的问题

 3 years ago
source link: https://blog.csdn.net/k_NGU_L/article/details/115494053
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ubuntu16.04下安装cv_bridge遇到的问题

系统是Ubuntu16.04。记录一下最近遇到的各种坑

在接手师兄的code时,catkin_make失败,说是找不到cv_bridge。是链接opencv和ROS之间的桥梁。我安装的有opencv3,但是不晓得为啥子没有这个。就直接搜了一下怎么回事。

好多的解决方法就只是轻描淡写:

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

好像这类方法是通用的模板似的,但是我就是不好使,甚至都会显示

E:无法定位到ros-kinetic-cv-bridge
(更新一下这个问题:好像是因为我不小心把ros-kinetic的源给注释掉了,运行:
sudo gedit /etc/apt/sources.list
然后加入:
deb http://packages.ros.org/ros/ubuntu xenial main
deb http://packages.ros.org/ros-shadow-fixed/ubuntu xenial main
然后在update一下就可以解决一系列这种问题:
sudo apt-get install ros-kinetic-xx-xx )

后来就还是选择老老实实下载cv_bridge,再安装的方法,下面是方法,以及遇到的问题和解决方法:

下载vision_opencv包

可以直接git clone https://github.com/ros-perception/vision_opencv.git。但是比较慢,我都是进网站,下载zip压缩包

然后解压缩,将解压后的文件,放在了/home文件下

  • cd vision_opencv/cv_bridge
  • mkdir build
  • cd build
  • cmake …(应该是两个点,但是不知道为啥第三个删不掉)
  • sudo make install

在cmake的时候,出现了个小问题。没有弹出来红色的error,我还以为没什么问题,结果出现了

—————————————————————

CMake Error at /usr/share/cmake-3.5/Modules/FindBoost.cmake:1677
(message): Unable to find the requested Boost libraries.

Boost version: 1.58.0

Boost include path: /usr/include

Could not find the following Boost libraries:

      boost_python37

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR
to the directory containing Boost libraries or BOOST_ROOT to the
location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)

—————————————————————

提示我没有boost,解决方法就是安装咯:

  1. 安装boost库:
    https://blog.csdn.net/zym1348010959/article/details/87821713

    (就按照这个链接下的走就行,亲测好用,不麻烦)

  2. 修改CMakeLists.txt文件
    删除掉第12行:find_package(Boost REQUIRED python37),修改为:

    set(boost_DIR /home/ouc/install/boost_1_69_0)
    

    (这个find_package我没有删除,加了#注释,怕以后有用)

参考链接:https://www.it610.com/article/1282152021410988032.htm

boost我已经有了,后来在make的时候又出现问题了。是到66%的时候:

在这里插入图片描述

(自己的图当时没有截,选用了网上的)

解决方法是,修改/home/kuang/version_opencv/cv_bridge/src/module.hpp(根据自己的路径),将最后一段(36~40)行改为

static void do_numpy_import( )
{
    import_array( );
}

(一定要保证一模一样,void后面的*都要去掉)

参考链接:https://zhuanlan.zhihu.com/p/347455336

上面两个问题解决后,本机确实有了cv_bridge,但是catkin_make的时候还是找不到,所以就需要在CMakelist中set一下路径,找到该文件:

在这里插入图片描述

参考链接:https://blog.csdn.net/a7691176/article/details/101353197?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.control&dist_request_id=&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.control


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK