public static double[,] GetMaskY(EMask name) { switch (name) { case EMask.Robert: return(Robertsy); break; case EMask.Sobel: return(Sobely); break; case EMask.Prewitt: return(Prewitty); break; default: return(null); break; } }
public static Bitmap HighPassFilter(EMask name, Bitmap bitmap) { Bitmap b = (Bitmap)bitmap.Clone(); double[,] maskx = MaskBox.GetMaskX(name); double[,] masky = MaskBox.GetMaskY(name); for (int i = 1; i < bitmap.Width - 1; i++) { for (int j = 1; j < bitmap.Height - 1; j++) { double sigma = Math.Sqrt(Math.Pow(Convolution(GetArea(new Point(i, j), 3, bitmap), maskx), 2) + Math.Pow(Convolution(GetArea(new Point(i, j), 3, bitmap), masky), 2)); byte byt = (byte)(sigma + 0.5); b.SetPixel(i, j, Color.FromArgb(byt, byt, byt)); } } return(b); }