Ask Your Question
1

Exporting jpegs from bag file skips frames

asked 2016-03-16 12:16:57 -0500

fabbro gravatar image

Hi to everyone,

I am following this tutorial to generate a video from a bag file in which I put the frames of a vision sensor: http://wiki.ros.org/rosbag/Tutorials/...

I can go through it without problems but I have one problem.

If I do

$ rosbag info cameraVisionSensorRecord.bag

I get:

path:        cameraVisionSensorRecord.bag
version:     2.0
duration:    1:19s (79s)
start:       Mar 16 2016 17:26:51.45 (1458145611.45)
end:         Mar 16 2016 17:28:10.93 (1458145690.93)
size:        8.7 GB
messages:    1508
compression: none [1508/1508 chunks]
types:       sensor_msgs/Image [060021388200f6f0f447d0fcd9c64743]
topics:      /vrep/Vision_sensor   1508 msgs    : sensor_msgs/Image

This bag file has 1508 msgs inside.

When I try to generate the frames like described in the tutorial I get only 604 frames (605 actually, because it start from 0000.jpg):

.....................
process[rosbag-1]: started with pid [12579]
process[extract-2]: started with pid [12580]
[ INFO] [1458145752.700535439]: Initialized sec per frame to 0.100000
[ INFO] [1458145754.630371279]: Saved image /home/**********/Desktop/rosbag/bitmap/frame0000.jpg
[ INFO] [1458145754.747831132]: Saved image /home/**********/Desktop/rosbag/bitmap/frame0001.jpg
...............................
...............................
[ INFO] [1458148035.459727400]: Saved image /home/**********/Desktop/rosbag/bitmap/frame000602.jpg
[ INFO] [1458148035.620177921]: Saved image /home/**********/Desktop/rosbag/bitmap/frame000603.jpg
[ INFO] [1458148035.732808217]: Saved image /home/**********/Desktop/rosbag/bitmap/frame000604.jpg
[rosbag-1] process has finished cleanly
log file: /home/*******/.ros/log/a4201dd0-eb7f-11e5-bfc5-8cdcd4d399a8/rosbag-1*.log

I do NOT understand why I am not able to get 1508 frames like in the bag file.

Could you explain why this happens?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-31 21:48:15 -0500

raptiye gravatar image

You can try to change the "sec_per_frame" parameter of image_extract. It is set to 0.1 by default, and if you are capturing images with 30 fps, you would get 1/3 of the frames, which is close to what you are getting. Try setting it to 0.03.

Example launch file:

<launch>
  <node pkg="rosbag" type="play" name="rosbag" args="-d 2 $(find image_export)/input/file.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
    <remap from="image" to="[YOUR_TOPIC_NAME]"/>
    <param name="sec_per_frame" value="0.03"/>
  </node>
</launch>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-16 12:16:57 -0500

Seen: 683 times

Last updated: Mar 31 '16