static private void RewriteImage(BitMapImage image, Pixel[,] filteredImage) { for (uint x = 1; x < image.Width - 1; x++) { for (uint y = 1; y < image.Height - 1; y++) { image.SetPixel(x, y, filteredImage[x, y]); } } }
static public void Gray(BitMapImage image) { int mean; Pixel pixel; for (uint x = 0; x < image.Width; x++) { for (uint y = 0; y < image.Height; y++) { pixel = image.GetPixel(x, y); mean = (pixel.Red + pixel.Green + pixel.Blue) / 3; pixel.Red = (byte)mean; pixel.Green = (byte)mean; pixel.Blue = (byte)mean; image.SetPixel(x, y, pixel); } } }