I am trying to understand the logic behind unsharp filter in matlab. If I type:

image = imread('nameoffile');
filter = fspecial('unsharp', 0.5);
resultImage = imfilter(image, filter);

resultImage is sharper than image. I opened fspecial.m file and saw that unsharp filter is created as:

 h = [0 0 0;0 1 0;0 0 0] - fspecial('laplacian',alpha);

If I filter an image with this matrix:

[0 0 0;
 0 1 0;
 0 0 0;]

result image is the same with original one. I know laplacian filter detects sharp edges. So, if we subtract sharp edges from an image we must get blurred image, I suppose. However, if we filter an image with h matrix(unsharp filter), we get sharper image. I did not understand the logic.


1 Answer 1


The Laplacian filter does actually outputs values of 0 on edges, and positive/negative inside image regions. Edges are detected as zero-crossings of the Laplacian. This makes sense if you remember that the Laplacian is a second-order derivative, and not a first order.

So, the unsharp filter that you describe computes (identity - Laplacian) convoluted with the image, i.e., the image minus something that is zero on edges. Hence, high frequencies (edges) are not attenuated while lower frequencies are weakened.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.