Tuesday, August 23, 2011

What is the Y800 color space?

The FOURCC code Y800 refers to a color space with 256 different shades of gray. Each pixel takes up 1 byte of data and pixel data is stored from left to right, and top to bottom in the image. Thus, given a pixel buffer, we can access pixels in the image as such:
    typedef unsigned char BYTE;
    BYTE getPixel(const int imageLength, BYTE* pixBuf,
                  int x, int y)
    {
        return *(pixBuf + y*imageLength + x);
    }


Important Note: Unlike in .NET Bitmaps, there is no usage of a stride or scan width. Thus, when converting to Y800 color space, it is important to remove any "empty pixels" introduced by strides.

Also note that the FOURCC code GREY is identical to Y800.

No comments:

Post a Comment