Ejemplo n.º 1
0
Archivo: G.cs Proyecto: 1extra/prog2015
 public static Bitmap LaplaceGreyscale(Bitmap b)
 {
     ImagerBitmap i = new ImagerBitmap(b.Clone() as Bitmap);
     ImagerBitmap i2 = new ImagerBitmap(b.Clone() as Bitmap);
     for (int column = 1; column < i.Bitmap.Width - 1; column++)
     {
         for (int row = 1; row < i.Bitmap.Height - 1; row++)
         {
             int[,] c = i.GetGrey3x3(row, column);
             int val = (((c[0, 0] + c[0, 1] + c[0, 2] + c[1, 0] + c[1, 2] + c[2, 0] + c[2, 1]
                 + c[2, 2]) * -1) + (c[1, 1] * 8)) + 128;
             if (val >= 128) val = 0; else val = 255;
             i2.SetPixel(column, row, Color.FromArgb(val, val, val));
         }
     }
     i.UnlockBitmap();
     i2.UnlockBitmap();
     return i2.Bitmap.Clone() as Bitmap;
 }