Correct way to convert AVDepthData.depthDataMap to gray depth image

Hi all. I can get disparity/depth data map from AVDepthData.depthDataMap and directly use it to generate a depth image. I found that under some situations, objects on the depth image cannot be clearly distinguished.

  1. When using disparity data, objects below 1 meter can't be clearly distinguished.
  2. When using depth data, objects larger than 1 meter can't be clearly distinguished.

Does anyone know why this happens and how to fix it ?

Hello,

The depthDataMap stores values in meters. When you attempt to convert this data to a color image and display it, you can normalize the depth values into the range of color values that you are able to display (usually that range is zero-to-one).

If you don't map the depth values into the valid color range, anything outside that range is clamped when the image is rendered.

Hi, gchiste thanks for your reply. Some questions about normalization.

  1. Is there a general normalization for reference ?
  2. If I want the real distance values between 30cm and 1.5m to be easily distinguished, I must create a customized normalization feature?
Correct way to convert AVDepthData.depthDataMap to gray depth image
 
 
Q