| Graphics | ![]() |
8-Bit and 16-Bit RGB Images
The color components of an 8-bit RGB image are integers in the range [0, 255] rather than floating-point values in the range [0, 1]. A pixel whose color components are (255,255,255) displays as white. The image command displays an RGB image correctly whether its class is double, uint8, or unit16.
image(RGB);
To convert an RGB image from double to uint8, first multiply by 255.
RGB8 = uint8(round(RGB64*255));
Conversely, divide by 255 after converting a uint8 RGB image to double.
RGB64 = double(RGB8)/255
To convert an RGB image from double to uint16, first multiply by 65535.
RGB16 = uint16(round(RGB64*65535));
Conversely, divide by 65535 after converting a uint16 RGB image to double.
RGB64 = double(RGB16)/65535;
| 8-Bit and 16-Bit Intensity Images | Mathematical Operations Support for uint8 and uint16 | ![]() |