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

max value of /camera/depth/image_raw is 8 bit 256 not 16bit!?

asked 2012-04-29 01:58:59 -0500

Maltenrazer gravatar image

updated 2016-10-24 09:03:56 -0500

ngrennan gravatar image

i'm running ros diamondback.

Documentation states that is should be uint16 to represent mm. So i'm expecting values two bytes long, but instead all I get is values one byte long, max of 256! I require the depth values so I can know how far an object is, that is all I need, I dont need to work with any other library. I have searched and searched for days and cannot find a proper solution!

So again, all i need is a registered depth value image, I want to be able to get the value and calculate the distance in that pixel.

depth/image_raw (sensor_msgs/Image)
Raw image from device. Contains uint16 depths in mm.

what to do? thanks

edit retag flag offensive close merge delete


Please list the output from "rostopic echo /depth/image_raw/encoding"

joq gravatar image joq  ( 2012-04-29 06:26:17 -0500 )edit .. I used cout << image.get()->encoding << "\n"; to get the encoding output

Maltenrazer gravatar image Maltenrazer  ( 2012-04-29 06:32:41 -0500 )edit

I have a bizarre problem where the left top and right edges are completely black any ideas? I have tried turning on and off depth registration by using rosparam get /openni_node1/depth_registration to see if it has an effect, but no help.

Maltenrazer gravatar image Maltenrazer  ( 2012-04-29 06:41:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-04-29 03:15:03 -0500

joq gravatar image

updated 2012-04-29 06:49:32 -0500

In sensor_msgs/Image, the data field is uint8 [0..255], but is interpreted according to the encoding and is_bigendian fields. Unfortunately, the 16-bit encodings did not work correctly in some Diamondback tools. They work better in Electric and Fuerte.

What encoding do your messages report?

UPDATE: 32FC1 is an opencv 32-bit float encoding. Perhaps this answer is helpful.

edit flag offensive delete link more

Question Tools


Asked: 2012-04-29 01:58:59 -0500

Seen: 1,904 times

Last updated: Apr 29 '12