Convert rosbag topic to image

1. Setup


$ sudo apt-get install ros-kinetic-image-view
$ roscd image_view
$ rosmake image_view
$ sudo apt-get install mjpegtools

2. Create a roslaunch file (ex: export.launch) with following content and put your bag file in the path: /opt/ros/kinetic/share/image_view

<launch>
          <node pkg="rosbag" type="play" name="rosbag" required="true" args="$(find image_view)/test.bag(your bag file name)"/>
          <node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="ROS_HOME"> <remap from="image" to="/camera/image_raw(your topic name)"/>
          </node>
</launch>

3. Exporting images

$ roslaunch export.launch

4. Copy exported images to the directory you want

$ ~cd
$ mkdir image_data
$ mv ~/.ros/frame*.jpg image_data/

留言

這個網誌中的熱門文章

Tuing PID parameters in QGroundcontrol (2)

Useful PX4 Parameters

Burn linux image to eMMC storage on Banana Pi M3