Hi, I am new to C# and im working on image processing, im using this bit of code to invert the pixels on an image, how do I extract the RGB values from a pixel in C# using the image buffer?
Thanks.
unsafe
{
byte* p = (byte *)(void *)pBuffer;
int nWidth = Width * 3;
for(int y = 0; y < Height; y++)
{
for(int x = 0; x < nWidth; x++ )
{
p[0] = (byte)(255-p[0]);
p++;
DavePosted Jun 27, 2008, 7:36 PM
Color col = new Color();
Bitmap pic = // code to get the bitmap - perhaps an OpenFileDialog
col = pic.GetPixel(e.X, e.Y);
SomeTextBox1.Text = col.R.ToString();
SomeTextBox2.Text = col.G.ToString();
SomeTextBox3.Text = col.B.ToString();