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

Problems in extracting images from bag file

asked 2019-09-16 14:41:43 -0500

nujdilla gravatar image

updated 2019-09-17 11:06:00 -0500

jayess gravatar image

Hi, I'm a newbie to ROS (and Linux too) so probably this is the most stupid question ever, but I swear I have followed the first tutorials on the wiki and I'm starting to learn little by little. I have downloaded a bag file (named carrello1.bag) which contains a lot of topic, including some images that I need to extract in order to process them with some image processing programs.

I've seen the tutorial "export image and video data from a bag file" that is literally the thing I have to do, and I setup my system doing all the Beginner Level Tutorials and creating a new package (provatesi) with the launch file (named provatesi.launch) - as in the tutorial and changing the directory

$(find image_view)/test.bag


~ /home/mattia/Desktop/carrello1.bag

since the tutorial assumes that you have a .bag file previously created that is named test.bag and that this bag file is stored in the image_view package directory. But when I execute

$ roslaunch provatesi provatesi.launch

I get:

[FATAL] [1268662434.297981030]: Error opening file: ~/home/mattia/Desktop/carrello1.bag

Where am I making the mistake?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-16 15:00:13 -0500

gvdhoorn gravatar image

You're passing a path that is not an absolute path. See #q331346 for a related question.

To be precise, there are two issues here:

  1. ~/home/mattia/.. is not a valid path: ~ already evaluates to /home/mattia, so this would evaluate to /home/mattia/home/mattia.
  2. ~ is evaluated (ie: replaced) by the shell (ie: bash), not roslaunch. So roslaunch doesn't do anything with it and passes the path directly to whatever tool/node/script it is that you're trying to start. As ~ is not a valid path, it will fail to open it (as evidenced by the "Error opening file" that you see).
edit flag offensive delete link more


Thank you! . Now that I corrected that, I have another type of error:

REQUIRED process [rosbag-2] has died!

This is my launch file

  <node pkg="rosbag" type="play" name="rosbag" required="true" args="/home/mattia/Desktop/carrello1.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/home/mattia/Desktop/camera"/>
nujdilla gravatar image nujdilla  ( 2019-09-16 15:35:03 -0500 )edit

@nujdilla Since you have a new problem, you should probably open a new question

jayess gravatar image jayess  ( 2019-09-16 18:12:34 -0500 )edit

I found the problem: the "to=" argument was wrong: it has to be the topic of the bag that contains the images. I have just finished successfully in extracting the images. Thank you nonetheless!

nujdilla gravatar image nujdilla  ( 2019-09-17 01:33:30 -0500 )edit

Question Tools


Asked: 2019-09-16 14:41:43 -0500

Seen: 805 times

Last updated: Sep 17 '19