Why is the depth map so dark?

When you try to visualize on screen a depth map obtained with the `retrieveDepth` API function or saved from the Depth Viewer tool, you usually find it very dark because you are seeing a map and not an image.

Depth map and the ZED SDK API

The depth map obtained with the `retrieveDepth` API function (C++ - Python) is a matrix of depth values in 32-bit format, in the measurement units selected when the camera has been opened (default value: meters). To be able to visualize if, for example by using OpenCV, you must normalize the map and rescale it in the grayscale range 0-255 (8-bit image).

The formula to be applied to each pixel:

new_value = value/max_range * 255

`max_range` can be the maximum available range value selected when opening the camera, it can be the maximum depth value present in the depth map, or it can be a custom-selected value.

To correctly display a depth image, instead of performing a normalization of the depth map values, we suggest you exploit instead the `retrieveImage` API function (C++ - Python), using the `VIEW::DEPTH` parameter (C++ - Python).

Depth map and the ZED Depth Viewer tool

The image obtained by using the SAVE command of ZED Depth Viewer tool is a 16-bit depth map that contains depth values in millimeters in the range 0-65535 [0 m to 65.535 m].

Screenshot_from_2022-04-11_10-11-21.png

Objects close to the camera, have low depth values and are for this reason dark if the saved image is displayed by using a standard image viewer.

In order to visualize the objects in the depth map, it is required to open it with an image editor and use a normalizing filter, that will automatically rescale all the values to visible greyscale data.

Note: the color depth displayed in the bottom left frame of the ZED Depth Viewer tool is obtained by using the `retrieveImage` API function (C++ - Python) of the ZED SDK.