I\'m currently writing a C# implementation of a little program which I have written in Java.
I had used BufferedImage.getRGB(int startX, int startY, int w, int
It depends how fast you need to do it.
Bitmap has GetPixel() method which works fine for a pixel.
If you need to do fast image processing you need to use LockBits which you can find a sample here.
Bitmap img = (Bitmap) Image.FromFile(imageFileName);
BitmapData data = img.LockBits(new Rectangle(0,0,img.Width, img.Height), ImageLockMode.ReadWrite, img.PixelFormat);
byte* ptr = (byte*) data.Scan0;
for (int j = 0; j < data.Height; j++)
{
byte* scanPtr = ptr + (j * data.Stride);
for (int i = 0; i < data.width; i++, scanPtr+=NO_OF_CHANNELS)
{
for (int m = 0; m < NO_OF_CHANNELS; m++)
Console.WriteLine(*scanPtr); // value of each channel
}
}
img.UnlockBits(data);