Ask Your Question
1

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

Hi,

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

<launch>   
  <!-- 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"/>
  </node>
</launch>

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
1

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

Comments

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.

/webcam1/image
/webcam1/image/compressed
/webcam1/image/compressed/compressed

shoemakerlevy9 gravatar imageshoemakerlevy9 ( 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 imagePeteBlackerThe3rd ( 2018-07-23 10:43:34 -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

2 followers

Stats

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

Seen: 389 times

Last updated: Jul 23 '18