Hi,
I have to get the value of each pixel of an image to do some comparaison. I used the class Bitmap and i loaded a 800x600 image. It takes me 20s to browse all pixel. (i used the method getpixel in a double for statement) I want to know if there is a class, or an other method to do this faster (around 1s would be perfect)
Thanks
David

Browse image's pixel
Matt Stum
cristi_bd
Use the following, I think it will be much faster.
"
int width = bmp.Width;
int height = bmp.Height;
int[] buffer = new int[width * height];
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(bmpData.Scan0, buffer, 0, buffer.Length);
"
Then you use bmpData to access the pixel-data of your image.
For instance:
int x = 10;
int y = 20;
if(bmpData[y*width + x] == Color.Green.ToArgb()) {
// Do something
}
Kind Regards
Moopy
ProxyPro
SCRunner