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

Issue extracting images from bagfile

asked 2016-06-23 08:07:20 -0600

ROSkinect gravatar image

I recorded a bagfile which contains rgb and depth images:

path:        kinectrgbdepthnew.bag
version:     2.0
duration:    6.7s
start:       Jun 23 2016 14:55:41.10 (1466686541.10)
end:         Jun 23 2016 14:55:47.85 (1466686547.85)
size:        395.9 MB
messages:    386
compression: none [386/386 chunks]
types:       sensor_msgs/Image [060021388200f6f0f447d0fcd9c64743]
topics:      /camera/depth/image     193 msgs    : sensor_msgs/Image
             /camera/rgb/image_raw   193 msgs    : sensor_msgs/Image

But when I try to extract the rgb images

  <node pkg="rosbag" type="play" name="rosbag" args="$(find imagesequencekinect)/kinectrgbnew.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/camera/rgb/image_raw"/>

I don't get all the images, it stops for this example at frame0062.jpg and if I keep openni2 running it starts saving images in live from frame0063..

[ INFO] [1466686708.317537964]: Saved image frame0062.jpg
[rosbag-1] process has finished cleanly
log file: /home/jros/.ros/log/977b5f76-3941-11e6-8b71-5c260a35b6aa/rosbag-1*.log
[ INFO] [1466686708.452904753]: Saved image frame0063.jpg

I don't know why it doesn't save all the frames and why it starting color stream automatically

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-23 10:58:55 -0600

updated 2016-06-23 11:00:00 -0600

The answer most likely has to do with the ~sec_per_frame parameter of extract_images. It defaults to 0.1 seconds per frame, and your Kinect data is likely recorded at 30 seconds per frame. In fact (10/30)*193 ~= 64 which is right about where your extract_images node stops. Using this setup, I've never had very good luck getting out the exact number of images that were originally recorded. Presumably, if you change ~sec_per_frame to be 0.033, you'll get most of the images.

One thing that I have had some luck with is bag2video (not sure if you are ultimately trying to get videos).

edit flag offensive delete link more


Yes you are right it works better but still don't get all the msg

ROSkinect gravatar image ROSkinect  ( 2016-06-28 04:35:37 -0600 )edit

Question Tools

1 follower


Asked: 2016-06-23 08:07:20 -0600

Seen: 1,106 times

Last updated: Jun 23 '16