Ask Your Question

Bagfile (containing depth and RGB data) to picture frames

asked 2014-12-12 07:26:57 -0500

shravan gravatar image

updated 2014-12-12 14:13:39 -0500

bvbdort gravatar image

When I convert a bagfile (containing depth and RGB data) to picture frames, I get different number of picture frames each time I launch the code given in the tutorial given below and the subsequent video I compile is totally wayward.

Please guide me through this

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-12-12 11:34:43 -0500

Wolf gravatar image

updated 2014-12-12 13:54:51 -0500

If the number of frames is different all the time probably your computer is not fast enough to save (and jpeg compress) all images with the same frequency they are coming out of the bag file.... Consider using the rosbag play -r (rate) option to slow down the message frequency (e. g. -r 0.2 to run at 20% of the original rate). Your computer should then be able to save all images without missing some. If therefore in the end your video looks kind of slow-mow you can speed it up using any common video processing program....

Edit example launch:

  <node pkg="rosbag" type="play" name="rosbag" args="-r 0.2 -d 2 $(find image_view)/test.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/camera/image_raw"/>
edit flag offensive delete link more


Sorry if I ask anything silly. But I am new to ROS. I convert the rosbag to frames using the roslaunch file created in the tutorial. I never use the rosbag play command while doing this. So how and where should I change it? Thanks in advance

shravan gravatar image shravan  ( 2014-12-12 13:24:14 -0500 )edit

I edited the answer; See where I added the -r 0.2 in the launch sample of the tutorial you linked....

Wolf gravatar image Wolf  ( 2014-12-12 13:55:55 -0500 )edit

Thanks a lot for the answer. It helped me a lot :)

shravan gravatar image shravan  ( 2014-12-13 14:15:29 -0500 )edit

answered 2018-10-23 17:47:20 -0500

nihalsoans91 gravatar image

I had written a code for this long back, If it helps.

edit flag offensive delete link more


Does your code extract the rdb image and the corresponding frame of depth? (Are they the same time frame for RGB and depth).

Beatrice gravatar image Beatrice  ( 2019-08-02 06:25:47 -0500 )edit

Hi Beatrice, Sorry about the delayed reply. I have updated the code to have it in sync . i.e have corresponding frame of depth. Also I have written c++ implementation for jpg files. Please let me know if you have any issues. You can also create an issue n the github repository.

nihalsoans91 gravatar image nihalsoans91  ( 2019-11-19 23:07:16 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2014-12-12 07:26:57 -0500

Seen: 1,123 times

Last updated: Oct 23 '18