Extract images from rosbag file

asked 2020-09-18 20:10:41 -0500

Leeor gravatar image

updated 2020-09-19 07:34:21 -0500

gvdhoorn gravatar image

Hello, I build a small robot with two cameras, which records what it sees and saves it to a bag file. The images are in compressed form. I want to extract the images from each camera to a different directory. I followed this tutorial to extract the images

and I came up with with the following launch file (slight modifications)

<launch>
  <node pkg="rosbag" type="play" name="rosbag" required="true" args="$(find image_view)/<bag_file_name>.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/camera_out/image"/>
  </node>
</launch>

(sorry it looks bad, I can't upload a picture, and I can't find a way to fix it, but it's very similar to the one in the tutorial)

I then run roscore and in a different terminal I run this command

rosrun image_transport republish compressed in:=camera1/image_compressed raw out:=camera_out/image

But nothing happened (the terminal is "thinking" but also waiting for 10+ min doesn't help; there are about 200 images there) I saw other similar questions (such as this one, But I'm still unable to move forward. What am I doing wrong?

Another question, every time I turn on the robot, I create a new bag file, is there a smarter way to use for the 'args' instead of every time open the launch file and manually change the name? For example, pass the name as an argument, or something similar?

I'm using Ubuntu 18.04 x86 and using ROS melodic. Thank you

edit retag flag offensive close merge delete

Comments

sorry it looks bad,

No need to apologise.

I can't upload a picture

perfect. Don't upload screenshots of terminals or code. It's all text, so there is no need. Just copy-paste whatever terminal content or code you want to show us into your question.

and I can't find a way to fix it

Select everything which is code or terminal text and press the Preformatted Text button (the one with 101010 on it), or use ctrl+k.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-19 07:35:48 -0500 )edit

Final comment:

Another question

please don't ask multiple questions in a single post. This is not a regular forum, but an AskBot instance (similar to Stack Overflow). This works best with a 1-to-1 ratio of questions and answers.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-19 07:36:41 -0500 )edit