1、通过cam/image_raw话题
创建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>
将$(find image_view)/test.bag改为你自己的bag文件路径。
然后,运行launch文件。
roscore
打开一个终端,cd到export.launch所在路径下,运行
roslaunch export.launch
所提取的图