Focus Magic logo

How Unsharp Mask Works

Unsharp Mask has been around for a long time. It gets it's name because it unsharpens (de-focuses) the image and uses the difference with the original image as a mask to increase the contrast of the image. The end result is that the contrast is increased at the edges which give the illusion that the image is sharper.

The Math

The math for Unsharp Mask is quite simple and is demonstrated with the following images and graph.

Image A

This is the original "In Focus" test image with a single edge in it. This is what the edge of a sharp image would look like.

Image B

This is the original "Out of Focus" test image and is what the image would look like if it was taken with a camera that is out of focus. This is our input image for the Unsharp Mask.

Image C

This is the first step of the Unsharp Mask process. The image is an unsharpened (de-focused) version of image B.

Image D

This is image C subtracted from image B and could be thought of as being the Mask.

Image E

This is the final Unsharp Masked Image which is Image B and Image D added together. The Amount in Unsharp Mask simply specifies how much of Image D to add, and the Threshold (or clipping) is the level of difference that must exist in image D before it is added to image B.

Focus Magic

This image is not part of the Unsharp Mask process but has been included to demonstrate the effectiveness of Focus Magic in sharpening an image. It is a lot closer to Image A than Image E.


A cross section of the above images is shown below.

Side Effects of Unsharp Mask

Unsharp Mask does sharpen the image a little (Image E is a little closer to image A), but it does have two side effects which limit the amount that can be applied:-

  • There is overshoot at the top and the bottom of the step. Images which have had Unsharp Mask applied to them can easily be spotted by looking for this side effect.
  • The noise is amplified. The final image (E) consists of B * 2 - C. Any noise in image B is multiplied by two (for an Amount of 100%). Image C which is an unsharpened (de-focused) version of image B does not cancel the noise out.

Conclusion

Unsharp Mask increases the contrast at the edges of an image to give the illusion that the image is sharper. This works fine for images which are only a tiny bit out of focus.

Focus Magic produces much better results. It has a much smaller Halo effect and does not amplify the noise very much (if at all).

For more comparisons between Unsharp Mask and Focus Magic click here.