ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
5

converting a bag file to images

asked 2011-04-27 10:08:13 -0500

Lee Redden gravatar image

updated 2011-04-29 08:46:31 -0500

kwc gravatar image

I am following the tutorial here for exporting images from a bag file to jpegs. http://www.ros.org/wiki/rosbag/Tutori...

when I run rosbag info BAGFILE I get rosbag info 2011-02-08-22-11-49.bag

path:        2011-02-08-22-11-49.bag
version:     2.0
duration:    13.3s
start:       Feb 08 2011 22:11:49.81 (1297231909.81)
end:         Feb 08 2011 22:12:03.15 (1297231923.15)
size:        235.6 MB
messages:    201
compression: none [201/201 chunks]
types:       sensor_msgs/Image [060021388200f6f0f447d0fcd9c64743]
topics:      /down_camera/camera/image_raw   201 msgs @ 15.0 Hz : sensor_msgs/Image

I have created a launch file and when I run roslaunch export.launch with this as my export file

<launch>
  <node pkg="rosbag" type="rosbag" name="rosbag" args="play -d 2 /media/Ubuntu/RosBagFiles/TestFolder/2011-02-08-22-11-49.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="node">
    <remap from="image" to="/down_camera/camera/image_raw"/>
  </node>
</launch>

this is what runs.

leeredden@ubuntu:/media/Ubuntu/RosBagFiles/TestFolder$ roslaunch export.launch
... logging to /home/leeredden/.ros/log/dae934d2-7113-11e0-9fd4-00216a65216e/roslaunch-ubuntu-2516.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:41180/

SUMMARY
========

NODES
  /
    rosbag (rosbag/rosbag)
    extract (image_view/extract_images)

starting new master (master configured for auto start)
process[master]: started with pid [2530]
ROS_MASTER_URI=http://ubuntu:11311/

setting /run_id to dae934d2-7113-11e0-9fd4-00216a65216e
process[rosout-1]: started with pid [2543]
started core service [/rosout]
process[rosbag-2]: started with pid [2546]
process[extract-3]: started with pid [2547]
[ INFO] [1303939092.680590263]: Initialized sec per frame to 0.100000
[ INFO] [1303939096.111425424]: Saved image frame0000.jpg
[ INFO] [1303939096.270134130]: Saved image frame0001.jpg
[ INFO] [1303939096.407313803]: Saved image frame0002.jpg
[ INFO] [1303939096.539443192]: Saved image frame0003.jpg
[ INFO] [1303939096.669743998]: Saved image frame0004.jpg
...............
[ INFO] [1303939109.207290966]: Saved image frame0098.jpg
[ INFO] [1303939109.342248572]: Saved image frame0099.jpg
[rosbag-2] process has finished cleanly.
log file: /home/leeredden/.ros/log/dae934d2-7113-11e0-9fd4-00216a65216e/rosbag-2*.log

but it doesn't seem to save the frames anywhere. I have done a sudo updatedb and locate for some of the file names but can't find them saved anywhere.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-04-27 13:27:18 -0500

Lee Redden gravatar image

updated 2011-04-27 21:38:06 -0500

tfoote gravatar image

With a little (actually a lot) of help from Morgan it was determined that the files were being saved to a location that was read only. They were re-directed to be saved in my current directory.

The new launch file looks like this. It is setup to save pictures from two down facing cameras saved into one bag file.

<launch>

  <node pkg="rosbag" type="rosbag" name="rosbag" args="play -d 2 /media/Ubuntu/RosBagFiles/TestFolder/2011-02-08-22-11-49.bag"/>

  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="node">

    <remap from="image" to="/down_camera/camera/image_raw"/>
    <param name="filename_format" value="/media/Ubuntu/RosBagFiles/TestFolder/frame%06i.jpg"/>
  </node>
  <node name="extract2" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="node">

    <remap from="image" to="/elite_camera/camera/image_raw"/>
    <param name="filename_format" value="/media/Ubuntu/RosBagFiles/TestFolder/elite_frame%06i.jpg"/>
  </node>

</launch>
edit flag offensive delete link more

Comments

Hi, I am doing the same thing as you did. Why do you appear to have 201 msgs on your image_raw topic and at the end when you convert you have only until 099.jpg that means 100 frames created? Thanks for your help.

fabbro gravatar image fabbro  ( 2016-03-16 12:02:59 -0500 )edit

Hello, if you look at "args" in the launchfile posted here you see "play -d 2". The -d means the duration, meaning that the bag file is played for 2 seconds while image_view extracts the images. This should be why there are less frames.

andrea-nisti gravatar image andrea-nisti  ( 2016-04-06 08:12:38 -0500 )edit

Thank you - that was a great help. The tutorial could still do with updating to incorporate this information.

Will Chamberlain gravatar image Will Chamberlain  ( 2016-07-27 22:56:06 -0500 )edit

Question Tools

Stats

Asked: 2011-04-27 10:08:13 -0500

Seen: 9,285 times

Last updated: Apr 27 '11