How to convert a depth map saved in Mech-Vision's 32-bit PNG image format with a grid into the TIFF format image as saved by Mech-Eye Viewer

How can RGBA four-channel data be converted into single-channel depth data?


In simple terms, it means converting 4 eight-bit channels into one 32-bit channel;

Diagram as follows:
Reference code:
cv::Mat img32FC1 = cv::Mat(img8UC4.size(), CV_32FC1,

You can also use OpenCV’s convertTo() function for the conversion. Change from 8UC4 to 32FC1. The binary values remain the same; it’s all about how you interpret it.