PDA

View Full Version : Color palette



Nico28
April 19, 2005, 15:58:39
Hello:



I would like to change the color palette of an RGB8 image.

How can i access to the palette in my "CurrentBuffer"

(CurrentBuffer = IcImagingControl1.ImageBuffers[e.bufferIndex];)


thanks.

Stefan Geissler
April 19, 2005, 18:03:35
Hello,

To make it short, you can't. Because the color format in memory is Y8, not RGB8. Y8 has no color palette, only brightness values are available.
To change a color palette, you would have to create an RGB 8 with a color palette and copy the image data from the memory buffer into the data memory of your new image. Then you could change the color palette.

The other way would be to use an RGB24 format as MemoryCurrentGrabberColorFormat. In that format, each pixel has three bytes. If the source video format was a RGB8 monochrome or Y800 format, then the three color components (BGR) are all the same within a pixel. You can access the bytes of each pixel and change them to the color you need.