Ask Your Question
0

[SOLVED] rtabmap fails to run a bag of depth and rgdb images

asked 2019-01-21 18:52:50 -0500

Avner gravatar image

updated 2019-01-24 13:18:10 -0500

Hi,

I am playing a bag of 16 bits-per-pixel depth and 8 bit rgb images. While playing the bag, I can extract both the rgb and the depth images into files (to verify that the data is ok) (I used the thread here to create and extract the depth images)

The way the depth image is stored in the bag is by using a python script that uses the PIL package to read a pgm image from file into a PIL object, serialize the object data into byte array (using io.BytesIO()), and save the byte array in PPM format.

To verify the data, I wanted to view the images first, before running rtabmap In rviz I can view the rgb image, but I cannot view the depth image. According to here:

"RVIZ cannot view 16 bit images natively. You'll have to convert them to an 8 bit format."

So I assume that the images are correct and move on to use rtabmap I launch rtabmap using the launch file below:

roslaunch ~/avner/PGR/vision/trunk/ros/catkin_ws/src/bpc_slam_rtabmap/launch/rgbd_slam.rgbd_dataset4.launch

But I cannot see the 3D map in rviz, and I do see error messages from rgbd_odometry

...
BEG getCvType
terminate called after throwing an instance of 'cv_bridge::Exception'
  what():  Image is wrongly formed: height * step != size  or  385 * 1280 != 492817
Aborted

The depth file is stored the bag in PPM format. The data payload is 492800 (6402385)

  • width: 640
  • height: 385
  • bytes per pixel 2
  • step size 640*2 = 1280

The size of the file is 492817, due to the header payload

So actually, the details in the error message are correct ("height*step" should not be equal to "size") Can someone tell me what am I doing wrong and how to satisfy rgbd_odometry?

Thanks,

Avner

edit retag flag offensive close merge delete

Comments

Looking at http://docs.ros.org/jade/api/cv_bridg... , the data in sensor_msgs::Image topic should not include the header.

matlabbe gravatar image matlabbe  ( 2019-01-22 11:50:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-24 13:16:46 -0500

Avner gravatar image

I solved the problem by changing the way that the depth image is stored in the bag in the python script, to use cv_bridge instead of using the PIL.

After using cv_bridge to store the image without the header, rgbd_odometry does not abort anymore

See here for more details

edit flag offensive delete link more

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

Stats

Asked: 2019-01-21 18:52:50 -0500

Seen: 155 times

Last updated: Jan 24 '19