Camara cannot captured valid depth maps with python api?

When I use python code to capture the depth image, the depth image shown using opencv is as follows
But the depth image saved with the code is as follows
The array of depth images is as follows
‘depth’: array([[ nan, nan, nan, …, 28.595, 28.603, 28.603],
[ nan, nan, nan, …, nan, nan, nan],
[ nan, nan, nan, …, nan, nan, nan],
[ nan, nan, nan, …, 1.3295, 1.3295, 1.3297],
[ nan, nan, nan, …, 1.3327, 1.3328, 1.3347],
[ nan, nan, nan, …, 1.3333, 1.3347, 1.3349]], dtype=float32)
Why is this a problem, is it a problem with my depth image capture?
Here’s my code:
def main():
global image_net, exit_signal, run_signal, detections
capture_thread = Thread(target=torch_thread,
kwargs={‘weights’: opts.weights, ‘img_size’: opts.img_size, “conf_thres”: opts.conf_thres})

print("Initializing Camera...")
zed = sl.Camera()
input_type = sl.InputType()
if opts.svo is not None:
    cv2.imwrite('./visualization/my_new_depth.png', depth_frame)

This is the picture mentioned above

Hi @XueFu,

The depth image you have saved seems correct. The nan values correspond with the values for which the depth data isn’t computed because of stereo occlusion, the depth value is infinity, or the value is filtered by the confidence threshold. This is expected behavior, and corresponds with the black values on your first image.

The difference between the first and the second image is that the first one has been normalized between 0 and 255 values, whereas the depth images saves the actual depth values, which are not converted into pixel grayscale values.

If you normalize the image between the 0-255 range, you should find similar results.