| Customize Help

RGB buffers



By default, MIL allocates color image buffers in an RGB color format. The pixels are internally stored in little-endian order, that is, they are stored in memory from their least-significant to the most significant bytes. The definitions of the RGB formats that are available are shown here. The corresponding MIL constant is shown in brackets beside the common format name.

RGB data formats

BGR24 packed (M_PACKED + M_BGR24) and RGB24 packed (M_PACKED + M_RGB24) are formats whereby each pixel is internally stored as three consecutive bytes. In BGR24 packed format, the blue band is stored in the first byte of the sequence; in RGB24 packed, the red byte is stored in the first byte of the sequence.

BGR32 packed (M_PACKED + M_BGR32) is a format whereby each pixel is internally stored as four consecutive bytes. The first byte of the sequence stores the blue band of the image, and the last byte is a "don't care" byte, as shown below:

RGB15 packed (M_PACKED + M_RGB15) is a format whereby each pixel is internally stored as a 16-bit word with a 5-bit blue value (least significant), a 5-bit green value, a 5-bit red value, and a "don't care" bit (most significant), in little-endian order, as shown below. Note that when accessing an M_PACKED + M_RGB15 buffer as a 3-band 8-bit buffer, the least significant bits of each band are set to 0.

RGB16 packed (M_PACKED + M_RGB16) is a format whereby each pixel is internally stored as a 16-bit word with a 5-bit blue value (least significant), a 6-bit green value, and a 5-bit red value (most significant), in little-endian order, as shown below. Note that when accessing an M_PACKED + M_RGB16 buffer as a 3-band 8-bit buffer, the least significant bits of each band are set to 0.

RGB planar are formats whereby the color components of all the pixels are stored contiguously: (RRR...., BBB..., GGG...).