Post Go back to editing

How to get a valid depth map in python?

Hi,

What I am trying to do is to obtain a valid depth map from AD-3DSMARTCAM1-PRZ that can later be processed by OpenCV.

So I .run the first-frame.py and found that after the following line:

image = np.array(frame.getData(tof.FrameDataType.Depth), dtype="uint16", copy=False)

the shape of image is (1560, 2560). So my question is what's the proper pre-processing for such image?

I also tried to follow the pre-processing steps in the dnn.py:

new_shape = (int(depth_map.shape[0] / 2), depth_map.shape[1])
depth_map = np.resize(depth_map, new_shape)
depth_map = cv.flip(depth_map, 1)
distance_map = depth_map
depth_map = distance_scale * depth_map
depth_map = np.uint8(depth_map)
depth_map = cv.applyColorMap(depth_map, cv.COLORMAP_RAINBOW)

However, it is still not a proper depth map from the result of cv.imshow().

I would be very grateful if anyone can help with this.