Why _Un_sharp Mask Makes Images Look Sharper

With a name like “unsharp mask,” it would be reasonable to assume that such a thing would make a blurry image even blurrier.  The opposite is true, of course: unsharp mask is a popular technique for improving the perceived sharpness of photos.  It works by increasing the edge contrast — the “acutance” — of an image.

But what’s going on when you slap “Unsharp Mask” in Photoshop?

Let’s walk through an example.  Say we have a have a slightly soft image of some text that we want to improve:

Our image is blurry. Oh no!

Pretty, no?

The first step for unsharp masking is, surprisingly, to make the image even blurrier.  Here we apply a 1 pixel Gaussian blur to the blurry original:

Our image, blurred even more.

Next is the key to the technique.  We want to use the extra-blurry image as a mask.

Subtract the really-blurry image from the somewhat-blurry image, and we get…

The difference between the extra-blurred image and the original blurred image

…a black rectangle.  Not really; there are actually difficult-to-see lines roughly tracing the edges of the letters.  Here’s the difference result again, this time level-shifted to be more visible:

Same difference mask, but level-shifted to be more visible

Set that aside for a moment, and make another copy of the original blurred image.  To this image, increase the contrast significantly.

High-contrast version of the original blurry image

It’s sharper, sure, but the overall colors have been shifted.  Where we once had shades of gray everywhere, we’re now left with just black and white.  This would be even worse if it were a color image.  Not good.

Intuitively, we want to use the high-contrast version of the image near the edges, but we want to use the original version everywhere else so that our entire picture doesn’t get the high-contrast look.  This turns out to be easy: just use the difference map from a couple of steps ago as a mask for the high-contrast version of the image.  Layer the masked high-contrast image over the original image, and…

The original blurred image again, for comparison

The final unsharp-masked image. Sharper!

Voila!  A sharpened version of our image.   Note that there is a bit of a halo effect here around the edges due to overshoot, but applied conservatively, unsharp masking can provide a pleasant crispness to many images and even fix slight blurs.

Major blurs require a different approach, but we’ll save that for another day.

Categories: Imaging | 2 comments

Comments (2)

  1. Pingback: Blurity! - Blog

  2. Right. This is explaining the definition of unsharp mask. But the why? That lies in how human eyes perceive. Now I’m slightly nearsighted, maybe unsharp mask does the deconvolution of the focus blur by my lens?