ZED2 depth captures saving

I am trying to capture depth and point cloud data using python scripts of ZED2 provided by stereo labs. I am able to visualize depth and point cloud data after running the scripts but somehow I am not able to save the depth and point cloud 2D images using usual opencv imwrite() or any other functions. After saving, all images are blank. That is why I have to take snapshots every time for getting depth/ point cloud data images.

Is there any other functionality to save data. Any suggestions would be appreciated.


Which sample are you using?

To visualize the depth map and save it on disk, you need to add the following line in your code :

            depth_to_save = sl.Mat() zed.retrieve_image(depth_to_save, sl.VIEW.DEPTH, sl.MEM.CPU) err = depth_to_save.write('depth.png')

Stereolabs Support