public static Bitmap ApplySmooth(Bitmap bitmapImage, double weight) { ConvolutionMatrix matrix = new ConvolutionMatrix(3); matrix.SetAll(1); matrix.Matrix[1, 1] = weight; matrix.Factor = weight + 8; return Convolution3x3(bitmapImage, matrix); }
public static Bitmap ApplyGaussianBlur(Bitmap bitmapImage, double peakValue) { ConvolutionMatrix matrix = new ConvolutionMatrix(3); matrix.SetAll(1); matrix.Matrix[0, 0] = peakValue / 4; matrix.Matrix[1, 0] = peakValue / 2; matrix.Matrix[2, 0] = peakValue / 4; matrix.Matrix[0, 1] = peakValue / 2; matrix.Matrix[1, 1] = peakValue; matrix.Matrix[2, 1] = peakValue / 2; matrix.Matrix[0, 2] = peakValue / 4; matrix.Matrix[1, 2] = peakValue / 2; matrix.Matrix[2, 2] = peakValue / 4; matrix.Factor = peakValue * 4; return Convolution3x3(bitmapImage, matrix); }
public static Bitmap ApplySharpen(Bitmap bitmapImage, double weight) { ConvolutionMatrix matrix = new ConvolutionMatrix(3); matrix.SetAll(1); matrix.Matrix[0, 0] = 0; matrix.Matrix[1, 0] = -2; matrix.Matrix[2, 0] = 0; matrix.Matrix[0, 1] = -2; matrix.Matrix[1, 1] = weight; matrix.Matrix[2, 1] = -2; matrix.Matrix[0, 2] = 0; matrix.Matrix[1, 2] = -2; matrix.Matrix[2, 2] = 0; matrix.Factor = weight - 8; return Convolution3x3(bitmapImage, matrix); }
public static Bitmap ApplyEmboss(Bitmap bitmapImage, double weight) { ConvolutionMatrix matrix = new ConvolutionMatrix(3); matrix.SetAll(1); matrix.Matrix[0, 0] = -1; matrix.Matrix[1, 0] = 0; matrix.Matrix[2, 0] = -1; matrix.Matrix[0, 1] = 0; matrix.Matrix[1, 1] = weight; matrix.Matrix[2, 1] = 0; matrix.Matrix[0, 2] = -1; matrix.Matrix[1, 2] = 0; matrix.Matrix[2, 2] = -1; matrix.Factor = 4; matrix.Offset = 127; return Convolution3x3(bitmapImage, matrix); }