Grayscale images also have 3 channels, except all three channels have the same values.
Writing some basic notes from the Visual SLAM book.
- A pixel’s grayscale can be recorded as an 8-bit unsigned integer, which is a value of 0~255
- For distance, usually measured in millimeters, and the range of RGBD cameras is usually around a dozen meters, exceeding 255. At this time, people will use 16-bit integers (unsigned short in C++) to record the depth map information, that is, the value at 0~65535. When converted to meters, it can represent up to 65 meters, which is enough for RGB-D cameras.
Pillow the color order assumes RGB (red, green, blue).
To convert from Numpy array to a jpeg image, you do something like this
im = Image.fromarray(rgb_array) im.save(filename)