Another type of sharpening effect is mean removal. It works similarly to the standard sharpening, except it subtracts values from all the surrounding pixels evenly.

The grid which we used for this effect is as follows

-1 -1 -1
-1 11 -1
-1 -1 -1

This gives a much more noticeable sharpening effect on the image.

Mean removal

Mean removal


You can download the full code for the sample application which contains code for all the image effects covered in the series here.

public void ApplyMeanRemoval(double weight)
{
    ConvolutionMatrix matrix = new ConvolutionMatrix(3);
    matrix.SetAll(1);
    matrix.Matrix[0, 0] = -1;
    matrix.Matrix[1, 0] = -1;
    matrix.Matrix[2, 0] = -1;
    matrix.Matrix[0, 1] = -1;
    matrix.Matrix[1, 1] = weight;
    matrix.Matrix[2, 1] = -1;
    matrix.Matrix[0, 2] = -1;
    matrix.Matrix[1, 2] = -1;
    matrix.Matrix[2, 2] = -1;
    matrix.Factor = weight - 8;
    bitmapImage = Convolution3x3(bitmapImage, matrix);

}
Share