What Is the Byte Layout of IMAQ Buffer for RGB and HSL Images?
Primary Software Version: 3.0
Primary Software Fixed Version: N/A
Secondary Software: N/A
I have acquired an image in RGB (or HSL) format and need to manually extract the red, green, and blue (or hue, saturation, and luminance) portions of the image from the acquisition buffer. How is the buffer laid out in these image formats?
A color image is stored in memory in one of two formats: Red, Green, and Blue (RGB); or Hue, Saturation, and Luminance (HSL). These formats refer to the four channels that comprise each pixel. They also correspond to the order in which the bytes are stored in memory.
RGB 32 images store color information in 32 bits, using 8 bits each for the red, green, and blue planes and the remaining 8 bits for the alpha plane. The alpha plane represents the transparency of the image. For images coming from a camera, this plane is typically empty, because the image is not at all transparent. The alpha plane is primarily used for images on a computer, for example when overlaying two images, the alpha layer dictates how strongly the background shows through the image. The byte order is (from MSB to LSB) alpha - red - green - blue.
HSL 32 images store color information using 8 bits each for hue, saturation, and luminance channels. The last 8 bits also represent the alpha channel. The byte order is (from MSB to LSB) alpha - hue - saturation - luminance.
RGB 64 images store color information using 16 bits (half word) each for the red, green, and blue planes and the remaining 16 bits for the alpha plane. The half word order is (from MSB to LSB) alpha - red - green - blue.
IMAQ Vision Concepts Manual (see Chapter 1, specifically)
National Instruments Image Acquisition and Vision Support Homepage
KnowledgeBase 25TBKAOA: How Do I Convert 32-bit Color Images to 8-bit Grayscale Images in Vision Assistant?
Report Date: 10/08/2004
Last Updated: 01/29/2008
Document ID: 3E7HPRWX