# Are all the 16 bits of Realsense D415 depth message valid?

Hi! I am using an Intel Realsense camera D415 and I have got the depth message from a ros topic. The depth values for each pixel in RGB image is in the range of 0~65535. It is obvious that the depth value is of 16-bit. But I wonder whether all 16 bits are valid ? I mean how can I get the true depth value from the 16-bit value ? Are some bits useless if I want to restract true depth values ?

Originally posted by zmchen on ROS Answers with karma: 1 on 2019-03-14

Post score: 0

Comment by cowboygary on 2020-02-25:
Hi @zmchen How do you get the depth message from rostopic? Can you teach me?

The convention for depth values on most of the RGB-D cameras I have used is to use a 16 bit integer in units of mm. So the data format has an effective range of just over 65 meters, which is more than any depth camera I've seen.

All the bit are valid, but I don't know of any depth cameras that come close to using the full range. Which is exactly what you want because the convention will need to be changed if the range needs to change.

Originally posted by PeteBlackerThe3rd with karma: 9529 on 2019-03-14

This answer was NOT ACCEPTED on the original site

Post score: 2

Comment by zmchen on 2019-03-16:
Thanks ! The maximum range for D415 is about 10 meters. But I also got some values like 13525 which indicates the distance is 13.525 meters in real world (my camera's depth scale is 0.001) when I used the camera in a 3m size room. So is such value just an error or not ?

In my experience (Kinect V1 & V2, orbbec astra, RealSense)

Kinect V1 had a really weird depth format, where you have to shift bits, etc.

Kinect V2, RealSense, Astra, and probably the rest, use the standard of 1 Unit = 1mm as PeteBlackerThe3rd says...

But there's also special values:

If you get a pixel with value 0, it doesn't mean that at that pixel the measure was zero, it actually means "unknown" value. This usually happens when the sensor is not able to acquire a value for that particular pixel.

To some degree, zero value pixels can be considered as "transparent".

This is important, because it needs to be taken into account for processing the depth image. For example, RealSense has a "Spatial Hole Filling" post processing technique that fills the empty gaps using the surrounding bits, but I think it's not enabled by default.

I've also recall a depth camera that also had a non zero special value to indicate some sort of overload in the pixel measurement.

Originally posted by Vicente Penades with karma: 130 on 2019-03-14

This answer was NOT ACCEPTED on the original site

Post score: 2