# Image sharpening : Adding prewitt's filter resulted images. Is it correct?

I'm reading that 'Prewitt' filter is high-pass filter, which means that it can sharpening the image (via edge highlight).

But I'm not sure to implement the sharpening process (not just edge detection) to the original image in this case.

So I mimic Laplacian process :

• x-direction 1st order derivate is define as : f(x+1),y) + f(x-1,y) -2 f(x,y)

so , the filter approximation :

 0  0 0
1 -2 1
0  0 0

• y-direction 1st order derivate is define as : f(x,y+1) + f(x,y-1) -2 f(x,y)

so , the filter approximation :

 0  1 0
0 -2 0
0  1 0


Now adding both of these filters we get :

 xy =    0  1 0
1 -4 1
0  1 0


So I get the new image Laplacian filtered image;

A = im2double (I);
I4 = imfilter(A,xy); % new image Laplacian filtered image


Substracting the original Subtracting the Laplacian filtered image from the original image can help sharpen edges and remove blur.

X = A - I4; % new sharper image


So now I apply this same principal but using Prewitt's filter instead.

w = fspecial('prewitt')
I4= imfilter(A,w)+imfilter(A,w'); % new image Prewitt filtered image


Subtracting the Prewitt filtered image from the original image can help sharpen edges and remove blur.

X = A - I4; % new sharper image


Is it a correct approach? I need your help. Thanks

• Could you transform Matlab into pseudocode? Prewitt is the edge detection operator, as far as I know there are 8 kernels not 2, and you add edges to the original image to obtain enhancement, since edges are white. Maybe there is a subtraction because the presented kernel looks inverted. So the answer depends on what is hidden under "fspecial('prewitt')". – Evil Oct 16 '16 at 4:16
• Hi, w= fspecial('prewitt') shows w = 1 1 1; 0 0 0; -1 -1 -1 and w' shows w= 1 0 -1; 1 0 -1; 1 0 -1 – Plain_Dude_Sleeping_Alone Oct 16 '16 at 4:24
• Have you tried and run your idea? Does it work? In the title there is add, but in the body subtract. I am not sure ehat is your question, but programming questions are off-topic here. – Evil Oct 16 '16 at 4:53
• I mean add (as Prewitt contains 2 filters for Gx and Gy) so when we add it, we combine the edges detected along x & y axis. Now in Laplacian we could get sharpen image by OriginalImage - (Gx+Gy), and now I apply this but for Prewitt instead.My question is that wheter I can just do that but to prewitt instead. And the codes here barely for describing the behaviours. I said that Is it a correct approach means It worked, but Is it a correct approach? – Plain_Dude_Sleeping_Alone Oct 16 '16 at 5:49