网上已经有很多相关帖,但试过之后不好使,研究了一下相关资料。
首先给出官网资料,可以翻墙的话直接看原资料[http://wiki.ros.org/rosbag/Tutorials/Exporting image and video data]。
创建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="xx/xx"/>
</node>
</launch>
注意
1:将$(find image_view)/test.bag更换为自己的bag;
2:在bag所在文件夹使用rosbag info xx.bag查看bag信息如下,将topics替换代码中
<remap from="image" to="