Accessing an Image Buffer

This example shows the how to handle image buffers of differenc MediaSubtypes.

The source code for the C# version of this sample program can be found under samples\C#\PixelFormat in your My Documents/IC Imaging Control 3.5 directory.

Common stuff for all PixelFormats

The GrabImage tries to fetch an image from the currently selected device in the passed in MediaSubtypes type.

The BufferAccessHelper class provides array style access to the bytes backing the IFrame.Ptr.

Available Data Formats

Y800

The Y800 color format is an 8 bit monochrome format. Every pixel is represented by one byte. The organization of the pixels in the image buffer is from left to right and top down. In other words: The first byte of the image buffer corresponds to the first pixel of the first line of the image.

RGB24

RGB24 is a 24 bit color format. Every pixel is represented by 3 bytes, while every byte of this triple corresponds to one color value. The letters 'RGB' mean Red, Green and Blue, so one byte represents the red value, one byte represents the green value and the last byte represents the blue value.

RGB32

RGB32 is a 32 bit color format. It is like RGB24, except that every pixel has an additional byte to store an alpha value. An alpha value describes the transparency of the pixel. Therefore, every pixel consists of 4 bytes. RGB32 is also referred to as RGBA, where the A stands for Alpha. The A value is not used in IC Imaging Control and is therefore always 0. As for the RGB24 pixel format, IC Imaging Control uses the BGRA byte order for the RGB32 pixel format. The organization of the pixels in the image buffer is from left to right and bottom up.

Y16

Y16 is a 16-bit grayscale format. The organization of the pixels in the image buffer is from left to right and top down.

<< Programmer's Guide