Untitled
unknown
plain_text
a year ago
868 B
1
Indexable
Never
#TO DO: #(1) compute depth map from disparity map using the formula: depth = (focalLength * baseline)/disparity #(2) use the depth map to show only object within 10m/20m/50m (Tip: apply depth threshold for each pixel) disparity = precomputed_dipsmap depth = (baseline * focalLength) / (disparity + 0.0000001) depth_50m_mask = np.where(depth < 50, 255, 0).astype(np.uint8) depth_20m_mask = np.where(depth < 20, 255, 0).astype(np.uint8) depth_10m_mask = np.where(depth < 10, 255, 0).astype(np.uint8) depth_50m_img = left_img * (depth_50m_mask[...] / 255) depth_20m_img = left_img * (depth_20m_mask[...] / 255) depth_10m_img = left_img * (depth_10m_mask[...] / 255) # #display results print("original_image") cv2_imshow(left_img) print("depth_50m") cv2_imshow(depth_50m_img) print("depth_20m") cv2_imshow(depth_20m_img) print("depth_10m") cv2_imshow(depth_10m_img)