创建launch文件,如下:
export.launch

 <launch>
      <node pkg="rosbag" type="play" name="rosbag" args="-d 2 $(find image_view)/test.bag"/>
      <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
        <remap from="image" to="/camera/image_raw"/>
      </node>
 </launch>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

将$(find image_view)/test.bag改为你自己的bag文件路径

然后,运行launch文件。

打开一个终端,运行
roscore

打开一个终端,cd到export.launch所在路径下,运行
roslaunch export.launch
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

所提取的图片在~/.ros路径下,将其移到你的目标文件中,如:

cd ~
mkdir Example
mv ~/.ros/*.jpg ~/Example
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

参考ROS wiki: How to export image and video data from a bag file,另该wiki中还有将图片制作成视频的内容。

相关文章:

  • 2023-01-12
  • 2021-04-11
  • 2021-05-17
  • 2021-10-26
  • 2022-12-23
  • 2021-12-24
  • 2021-06-14
  • 2022-12-23
猜你喜欢
  • 2021-05-22
  • 2022-01-10
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
相关资源
相似解决方案