Home > Tutorials > Image Processing – Sharpening Image

Image Processing – Sharpening Image


Sharpening effect make uses of Convolution Matrix, you might need to refer to my previous post on Convolution Matrix.

The applied matrix is:

[  0 | -2 |  0 ]

[ -2 | 11 | -2 ]

[  0 | -2 |  0 ]

The factor is 3 and offset is 0.

This is how effect looks like:

Original Image

Original Image

Sharpened Image

Sharpened Image

Here the implementation:

	public static Bitmap sharpen(Bitmap src, double weight) {
		double[][] SharpConfig = new double[][] {
			{ 0 , -2    , 0  },
			{ -2, weight, -2 },
			{ 0 , -2    , 0  }
		};
		ConvolutionMatrix convMatrix = new ConvolutionMatrix(3);
		convMatrix.applyConfig(SharpConfig);
		convMatrix.Factor = weight - 8;
		return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
	}

Hope you enjoy it!

Cheers,
Pete Houston

  1. Oko
    February 27, 2015 at 1:33 am

    I have one question – if I want to customized set intensivity of this effect, which parametrs I should to change?

  2. SHAMA
    December 16, 2014 at 11:49 am

    Do you have tutorial for how to make photo editing apps?
    Please if you can provide ome suggestion
    Would Be really thankful
    Thanks in advance
    I(If possible, mail me)

    • Koko
      February 27, 2015 at 1:31 am

      Hey, it’s tutorial. You only to want a little bit thinking about this problem 😉

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: