0
$\begingroup$

Rosanswers logo

I am following the tutorial here for exporting images from a bag file to jpegs. http://www.ros.org/wiki/rosbag/Tutorials/Exporting%20image%20and%20video%20data

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.


Originally posted by Lee Redden on ROS Answers with karma: 76 on 2011-04-27

Post score: 5

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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>

Originally posted by Lee Redden with karma: 76 on 2011-04-27

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by fabbro on 2016-03-16:
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.

Comment by andrea-nisti on 2016-04-06:
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.

Comment by Will Chamberlain on 2016-07-27:
Thank you - that was a great help. The tutorial could still do with updating to incorporate this information.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.