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

Extracting compressed image data from bag file results in doubled up or dropped frames

asked 2018-07-22 20:13:56 -0500

updated 2018-07-23 08:58:00 -0500


I'm trying to extract compressed images from a bag file. Here is my launch file:

  <!-- Play Bag File -->   
  <node pkg="rosbag" type="play" name="rosbag" required="true" args="-r
  0.2 /media/nick/Samsung\ USB/bag_files/_2018-07-20-16-30-09.bag"/>

  <!-- Uncompress images -->   
  <node pkg="image_transport" type="republish" name="decompress_node" args="compressed in:=/webcam1/image out:=/webcam1/image" />

  <!-- Extract images -->
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/webcam1/image"/>

This results in some frames not being saved and some frames being saves multiple times. Also a lot of frames are saved out of order so the video I make out of the frames is really choppy.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-23 02:58:34 -0500

You are re-publishing the decompressed images on the same topic as the originals.

in:=/webcam1/image out:=/webcam1/image

So your file extraction node is receiving both, possibly with a time delay pushing them out of order. If you use a different topic name for the decompressed images it should solve this.

Hope this helps.

edit flag offensive delete link more


It appears that image transport adds /compressed to the topic name.

For instance when I change it to "in:=/webcam1/image/compressed out:=/webcam1/image" this is what I get in rostopic list.


shoemakerlevy9 gravatar image shoemakerlevy9  ( 2018-07-23 08:57:22 -0500 )edit

Try running the launch file without the bag file playback. rostopic echo each of these topics then publish a single image to the input topic. Looking closely at what happens may shed some light on what's going on.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-23 10:43:34 -0500 )edit

Question Tools



Asked: 2018-07-22 20:13:56 -0500

Seen: 1,623 times

Last updated: Jul 23 '18