0
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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')". $\endgroup$ – Evil Oct 16 '16 at 4:16
  • $\begingroup$ 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 $\endgroup$ – Plain_Dude_Sleeping_Alone Oct 16 '16 at 4:24
  • $\begingroup$ 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. $\endgroup$ – Evil Oct 16 '16 at 4:53
  • $\begingroup$ 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? $\endgroup$ – Plain_Dude_Sleeping_Alone Oct 16 '16 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.