從ROS bag文件中提取圖像
創建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
所提取的圖片在~/.ros
路徑下,將其移到你的目標文件中,如:
cd ~
mkdir Example
mv ~/.ros/*.jpg ~/Example
參考ROS wiki: How to export image and video data from a bag file,另該wiki中還有將圖片製作成視頻的內容。