public static double[,] GetMask(JMask name) { switch (name) { case JMask.GAUSS: return(Gauss); break; default: return(null); break; } }
public static Bitmap LowPassFilter(JMask name, Bitmap bitmap) { Bitmap b = (Bitmap)bitmap.Clone(); double[,] mask = MaskBox.GetMask(name); for (int i = 1; i < bitmap.Width - 1; i++) { for (int j = 1; j < bitmap.Height - 1; j++) { double sigma = Convolution(GetArea(new Point(i, j), 3, bitmap), mask) / (Math.Pow(mask.GetLength(0), 2)); byte byt = (byte)(sigma + 0.5); b.SetPixel(i, j, Color.FromArgb(byt, byt, byt)); } } return(b); }