Troubleshooting Inaccurate Gripping: Robot Aspect

I can obtain a depth map from the Vision step, but it’s a depth map that includes color information. Is it possible to convert it into a single-channel grayscale image with only height information?

The depth map obtained in Mech-Vision is a single-channel, 32-bit image. In other words, each pixel stores a float to represent height information. In Vision, the depth map is visualized in color, while some software visualizes it in black and white. Can you provide more details about the issue to see if there is a suitable solution?

How to convert it into a 16-bit or 8-bit depth map? Typically, standard 2D algorithms do not support images in the CV_32FC1 format

Mech-Vision uses 8-bit, 4-channel format to save 32-bit, single-channel depth maps.

import numpy as np
import cv2

def change_image(img):
img_depth = np.frombuffer(img.tobytes(),dtype=np.float32)
img_depth = img_depth.reshape(img.shape[0:2])
return img_depth

if name == ‘main’:
img = cv2.imread(‘depth_image_00000.png’,-1)
img_depth = change_image(img)
cv2.imwrite(‘depth_image_00000.tiff’,img_depth)