ROS 中 cv_bridge模块 ImportError: libopencv_core3.so.3.3: cannot open shared object file

在ROS Kinetic  上使用python开发opencv程序,硬件使用树莓派平台,系统ubuntu1604, 程序中调用bridge.imgmsg_to_cv2(data, 'bgr8')函数时报错:

cv_img = bridge.imgmsg_to_cv2(data, 'bgr8')
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 163, in imgmsg_to_cv2
    dtype, n_channels = self.encoding_to_dtype_with_channels(img_msg.encoding)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 99, in encoding_to_dtype_with_channels
    return self.cvtype2_to_dtype_with_channels(self.encoding_to_cvtype2(encoding))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2
    from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: libopencv_core3.so.3.3: cannot open shared object file: No such file or directory

检查libopencv_core3.so.3.3 文件存在于/opt/ros/kinetic/lib/arm-linux-gnueabihf/中,但cv_bridge包就是找不到。

搜遍谷歌未决,一小时后失去耐心遂暴力解之:把这opencv库复制到所有它有可能应该存在的地方,后发现将所有文件复制到/opt/ros/kinetic/lib后即可解决:

 sudo cp opt/ros/kinetic/lib/arm-linux-gnueabihf/libopencv_*   /opt/ros/kinetic/lib

 

你可能感兴趣的:(搬砖杂记)