Ask Your Question

Cannot extract image from *.bag

asked 2014-04-17 14:08:42 -0500

zy66669 gravatar image

updated 2014-04-18 01:52:12 -0500

demmeln gravatar image

I am using Fuerte to extract images from my bag file, here's my bag file info:

version:     2.0
duration:    7:29s (449s)
start:       Feb 21 2014 10:38:13.79 (1392975493.79)
end:         Feb 21 2014 10:45:43.62 (1392975943.62)
size:        3.5 GB
messages:    2218096
compression: none [4404/4404 chunks]
types:       audio_common_msgs/AudioData [f43a8e1b362b75baa741461b46adc7e0]
             geometry_msgs/Wrench        [4f539cf138b23283b520fd271b567936]
             qualisys2ros/RigidBody      [90b4bc390e2e3e76d923053ba82e3a88]
             sensor_msgs/CameraInfo      [c9a58c1b0b154e0e6da7578cb991d214]
             sensor_msgs/CompressedImage [8f7a12909da2c9d3332d540a0977563f]
             std_msgs/Float64MultiArray  [4b7d974086d4060e7db4613a7e6c3ba4]
/FT_palpation_probe                         444831 msgs    : geometry_msgs/Wrench       
/FT_ultrasonic_probe                        444892 msgs    : geometry_msgs/Wrench         
/ReMeDi_cam/image_raw/compressed              6725 msgs    : sensor_msgs/CompressedImaege
/camera/depth/camera_info                    13467 msgs    : sensor_msgs/CameraInfo     
/camera/depth/image/compressedDepth          11862 msgs    : sensor_msgs/CompressedImage
/camera/projector/camera_info                13467 msgs    : sensor_msgs/CameraInfo     
/camera2/rgb/image_color/compressed          13511 msgs    : sensor_msgs/CompressedImage
/doctor_glove_left                          449822 msgs    : std_msgs/Float64MultiArray 
/doctor_glove_right                         449821 msgs    : std_msgs/Float64MultiArray

I followed the tutorial and wrote my launch file as following:

<node pkg="rosbag" type="play" name="rosbag" args="-d 2 /home/marce/Documents/Recordings/exp_21_02_1st_doc/ultra_back.bag"/>
<node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
<remap from="image" to="/ReMeDi_cam/image_raw/compressed"/>

When I run my launch file, I get

[ WARN] [1397778148.269447449]: [image_transport] It looks like you are trying to subscribe directly to a transport-specific image topic '/ReMeDi_cam/image_raw/compressed', in which case you will likely get a connection error. Try subscribing to the base topic '/ReMeDi_cam/image_raw' instead with parameter ~image_transport set to 'compressed' (on the command line, _image_transport:=compressed). 

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

I searched on internet and they say it's about image_transport, but I am quite new to ROS, so there are some questions I did not understand:

1. I should extract image sequences from the bag file, but I do not know which topic I should extract, as you can see, there are RAW,COLOR,DEPTH 3 types of compressed images, should I export them all?

2. My launch file is to extract RAW image from bagfile and I do not know how to fix the error, it's about conversion between compressed image and image, so how should I revise my launch file?

Thank you guys!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-18 02:03:43 -0500

demmeln gravatar image

Well your bag files only contains the compressed images, not the raw ones. If you can, i suggest recreating the bag file with the raw images instead.

It seems that takes a second argument with the transport to use. Not sure if the following works, but you can give it a try:

  <node pkg="rosbag" type="play" name="rosbag" args="-d 2 /home/marce/Documents/Recordings/exp_21_02_1st_doc/ultra_back.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME" args="compressed">
    <remap from="image" to="/ReMeDi_cam/image_raw"/>
edit flag offensive delete link more


Thanks a lot! It worked! But as for other 2 compressed image topic (IMAGE_COLOR,DEPTHCOMPRESSED), what correlations do they have with the image_raw/compressed?

zy66669 gravatar image zy66669  ( 2014-04-18 02:25:09 -0500 )edit

OK. I have figured it out.Thanks again!! ;)

zy66669 gravatar image zy66669  ( 2014-04-18 02:34:39 -0500 )edit

If you mark the answer as accepted, it indicates to everyone that this probalem is solved ;-). Thanks.

demmeln gravatar image demmeln  ( 2014-04-18 02:42:39 -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

1 follower


Asked: 2014-04-17 14:08:42 -0500

Seen: 1,535 times

Last updated: Apr 18 '14