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

Cannot exract image from bag file

asked 2014-03-10 12:30:54 -0500

Mechatronics gravatar image

updated 2014-03-11 08:34:36 -0500

ahendrix gravatar image

I 'm using ROS and I'm trying to follow the tutorials on how to export image and video data from a bag file.I keep having this error When I execute roslaunch export.launch I got this error

> [FATAL] [1394490530.406789364]: Error opening file: play
[rosbag-1] process has died [pid 14368, exit code 1, cmd /opt/ros/hydro/lib/rosbag/play play -d 2 /home/khmarehman/test.bag __name:=rosbag __log:=/home/khmarehman/.ros/log/7b66fb3a-a896-11e3-b8eb-f4b7e2c88a9b/rosbag-1.log].
log file: /home/khmarehman/.ros/log/7b66fb3a-a896-11e3-b8eb-f4b7e2c88a9b/rosbag-1*.log

My code

<launch> 
   <node pkg="rosbag" type="play" name="rosbag" args="play -d 2 /home/khmarehman/test.bag"/> 
   <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="node"> 
      <remap from="image" to="/camera/image_raw"/> 
   </node>
</launch>

UPDATE: I change my code to this

<launch>
  <node pkg="rosbag" type="play" name="rosbag" args="-d 2 /home/khmarehman/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"/>
  </node>
</launch>

Now it got stuck at

core service [/rosout] found
process[rosbag-1]: started with pid [15230]
process[extract-2]: started with pid [15242]
[ INFO] [1394492914.265667303]: Initialized sec per frame to 0.100000

UPDATE: I change the code

<launch>
  <node pkg="rosbag" type="play" name="rosbag" args="play -d 2 /home/khmarehman/test.bag">
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="node">
  <remap from="image" to="/front/camera/image_rect_color/compressed"> </remap>
  </node>
  </node>
</launch>

still having this error

WARNING: WARN: unrecognized 'node' tag in <node> tag. Node xml is <node args="play -d 2 /home/khmarehman/test.bag" name="rosbag" pkg="rosbag" type="play"> <node cwd="node" name="extract" output="screen" pkg="image_view" respawn="false" type="extract_images"> <remap from="image" to="/front/camera/image_rect_color/compressed"> </remap></node></node>

[FATAL] [1394533222.650188690]: Error opening file: play
[rosbag-1] process has died [pid 20032, exit code 1, cmd /opt/ros/hydro/lib/rosbag/play play -d 2 /home/khmarehman/test.bag __name:=rosbag __log:=/home/khmarehman/.ros/log/2b6a1e2e-a903-11e3-aca7-f4b7e2c88a9b/rosbag-1.log].
log file: /home/khmarehman/.ros/log/2b6a1e2e-a903-11e3-aca7-f4b7e2c88a9b/rosbag-1*.log

BAG info

path:        test.bag
version:     2.0
duration:    2:10s (130s)
start:       Feb 03 2014 07:21:42.82 (1391394102.82)
end:         Feb 03 2014 07:23:53.55 (1391394233.55)
size:        47.3 MB
messages:    1056
compression: none [61/61 chunks]
types:       sensor_msgs/CompressedImage [8f7a12909da2c9d3332d540a0977563f]
topics:      /front_camera/camera/image_rect_color/compressed   1056 msgs    : sensor_msgs/CompressedImage
edit retag flag offensive close merge delete

Comments

1

Is there anything in the logs that it mentions? Have you tried running the same command by hand?

ahendrix gravatar image ahendrix  ( 2014-03-10 12:32:55 -0500 )edit

Sorry, I couldn't understand, what do you mean by hand?

Mechatronics gravatar image Mechatronics  ( 2014-03-10 12:55:18 -0500 )edit

My updated code worked, But I couldn't find images, they are not in .ros

Mechatronics gravatar image Mechatronics  ( 2014-03-10 13:14:43 -0500 )edit
1

Rather than running those commands as part of a launch file, try running each command via rosrun and examining the output.

ahendrix gravatar image ahendrix  ( 2014-03-10 14:19:16 -0500 )edit
1

I suspect you're not seeing any images because there aren't any images in your bag file on the topic you've specified. You should be able to see which topics are in your bag file, what their types are, and how many messages were recorded on each topic by running `rosbag info` on your bag file.

ahendrix gravatar image ahendrix  ( 2014-03-10 15:28:39 -0500 )edit

I have edited and posted bag info

Mechatronics gravatar image Mechatronics  ( 2014-03-11 08:09:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-03-11 08:40:52 -0500

ahendrix gravatar image

Looking at your bag file info, your camera topic is /front_camera/camera/image_rect_color/compressed ; you should use this topic to extract images.

The third launch example that you posted doesn't close the first <node> tag properly, which is why you're seeing an error there.

Therefore, your launch file should be something like:

<launch>
  <node pkg="rosbag" type="play" name="rosbag" args="-d 2 /home/khmarehman/test.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/front_camera/camera/image_rect_color/compressed"/>
  </node>
</launch>

And this may or may not work because you've only recorded compressed images in your bag file. You may also need to set the image_transport parameter to compressed to the extraact_images node.

edit flag offensive delete link more

Comments

[ WARN] [1394587065.265630274]: [image_transport] It looks like you are trying to subscribe directly to a transport-specific image topic '/front_camera/camera/image_rect_color/compressed', in which case you will likely get a connection error. Try subscribing to the base topic '/front_camera/camera/image_rect_color' instead with parameter ~image_transport set to 'compressed' (on the command line, _image_transport:=compressed). See http://ros.org/wiki/image_transport for details.

Mechatronics gravatar image Mechatronics  ( 2014-03-11 15:18:20 -0500 )edit

[ERROR] [1394587065.463501301]: Client [/extract] wants topic /front_camera/camera/image_rect_color/compressed to have datatype/md5sum [sensor_msgs/Image/060021388200f6f0f447d0fcd9c64743], but our version has [sensor_msgs/CompressedImage/8f7a12909da2c9d3332d540a0977563f]. Dropping connection.

Mechatronics gravatar image Mechatronics  ( 2014-03-11 15:18:32 -0500 )edit

I am stuck again :(

Mechatronics gravatar image Mechatronics  ( 2014-03-11 15:18:44 -0500 )edit

As noted, it looks like you should set the image_transport parameter to compressed for the extract_images node.

ahendrix gravatar image ahendrix  ( 2014-03-11 16:10:28 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2014-03-10 12:30:54 -0500

Seen: 2,429 times

Last updated: Mar 11 '14