Truncated data from get_data() for depth measurement with MEASURE.DEPTH_U16_MM

When calling get_data() on a depth Mat that was generated by calling retrieve_measure(depth_map, sl.MEASURE.DEPTH_U16_MM), the function returns correct values for all rows that are less than half the height of the mat, but returns all zeros for all rows beyond that.

Example images, side by side:

I adjusted the levels in the depth image to make the issue more obvious, but I am correctly getting 16-bit values that accurately reflect the depth at each pixel where there are non-zero values.

Resolution: HD720
FPS: 30
Depth mode: Ultra
Coordinate units: Meter

Sensing mode: Standard
Reference frame: World

Minimum viable example:

import as sl
import sys
from pathlib import Path
import numpy as np
import cv2.cv2 as cv2

def main():

    if not sys.argv or len(sys.argv) != 2:
        sys.stdout.write("Usage: \n\n")
        sys.stdout.write("python <output path>")

    output_path = Path(sys.argv[1])

    zed = sl.Camera()
    init_params = sl.InitParameters()
    init_params.camera_resolution = sl.RESOLUTION.HD720
    init_params.camera_fps = 30
    init_params.depth_mode = sl.DEPTH_MODE.ULTRA
    init_params.coordinate_units = sl.UNIT.METER
    init_params.depth_maximum_distance = 3.0
    err =
    if err != sl.ERROR_CODE.SUCCESS:

    left_image = sl.Mat()
    depth_map = sl.Mat()
    point_cloud = sl.Mat()

    runtime_params = sl.RuntimeParameters()
    runtime_params.sensing_mode = sl.SENSING_MODE.STANDARD
    runtime_params.measure3D_reference_frame = sl.REFERENCE_FRAME.WORLD

    if zed.grab(runtime_params) == sl.ERROR_CODE.SUCCESS:
        zed.retrieve_image(left_image, sl.VIEW.LEFT)
        zed.retrieve_measure(depth_map, sl.MEASURE.DEPTH_U16_MM)
        zed.retrieve_measure(point_cloud, sl.MEASURE.XYZRGBA)

    color_path = "{}\\color.png".format(output_path)
    depth_path = "{}\\depth.png".format(output_path)

    color_array = left_image.get_data()
    depth_array = depth_map.get_data().astype(np.uint16)

    cv2.imwrite(color_path, color_array)
    cv2.imwrite(depth_path, depth_array)


if __name__ == "__main__":

Hi @nomaded,

The behaviour you describe is indeed strange. Could you please tell us what SDK version and OS you are working with ? We’ll look into the issue and let you know how it goes.

Thanks in advance

Thanks for your response! Details follow:

OS: Windows 10 (20H2, build 19042.1348)
ZED SDK Version: 3.6.1
Python: 3.7
Camera: ZED 2 firmware 1523