As we noted in the previous section, some of the channels of a depth camera use a range larger than 8 bits for their data. A large range tends to be useful for computations, but inconvenient for display, since most computer monitors are only capable of using an 8-bit range, [0, 255], per channel.
OpenCV's cv2.imshow function re-scales and truncates the given input data in order to convert the image for display. Specifically, if the input image's data type is unsigned 16-bit or signed 32-bit integers, cv2.imshow divides the data by 256 and truncates it to the 8-bit unsigned integer range, [0, 255]. If the input image's data type is 32-bit or 64-bit floating-point numbers, cv2.imshow assumes that the data's range is [0.0, 1.0], so it multiplies the data by 255 and truncates it to the 8-bit unsigned integer range, [0, 255]. By...