Image Sharpening Using the Unsharp Mask
by Brian Johnston (Canada)
One might assume that if an excellent quality lens is used to form the final image in a digital camera, no further sharpening would be necessary. This is not usually the case for two reasons. First, the optics of the layer of tiny plastic lenses used to focus the light onto the light sensing sites on the CCD or CMOS chip, degrades the image slightly. For this reason, almost all digital cameras have built-in sharpening algorithms. Many photographers believe, however, that a better result is obtained if the sharpening is done in the computer, after the fact. The second reason to sharpen an image is more controversial. Depending on the use to which the image is to be put, increasing the apparent sharpness may produce a more pleasing final photograph.
My intention in this article is not to weigh the relative merits of whether to sharpen, or not to sharpen. Instead, I hope to show graphically, how the most common sharpening technique, the unsharp mask actually 'works'.
Consider the two images below. The one on the left is unsharpened, exactly as it was captured by the camera as a Fine Quality JPEG image. The one on the right has had an unsharp mask applied. It should be obvious that the one on the right appears sharper. Even though no more information about the microscope exists in the second image, to the naked eye it looks sharper and more detailed.
The concept of sharpness is a strange one. If we magnify the digital image of the number 2 in the 20 marking of the fine focussing knob, it is obvious that it is not sharp. The square pixels (picture elements) can be clearly seen to make a very rough, blocky approximation of the number. What makes the 2 look sharp at a distance, is largely our brain. At a distance, our optical system is fooled into seeing something that is simply not true. (Paint Shop Pro 6 was used to produce the following image only.)
This naivety can be exploited to make images appear to be sharper than they are. The unsharp mask is a technique to do just this. For the purposes of this article, I have used the unsharp mask as implemented in the software Photoshop Elements 2. (Other softwares' implementations are similar, but may use different terms.)
An increase in sharpness is achieved in the unsharp mask by looking for edges in the original image, and increasing their contrast by making the dark pixels of the edges darker and the light pixels lighter. (An edge, by definition, would be an abrupt change in contrast in the original image.) By this method, detail is enhanced.
As an analogy, imagine looking from a distance at a gray wall with a long narrow crack in the surface. It is just possible to resolve the crack under the lighting conditions present at the time. If we wish to make the crack more visible, we could paint the shaded side a darker shade of gray and the brighter side a lighter shade of gray. This would increase the contrast of the crack and make it more visible from a distance. In order to further enhance our perception, we could paint these darker and lighter stripes with a wider brush. This is essentially what the unsharp mask does to the abrupt contrast transitions (edges) in our image.
The dialog box for the unsharp mask in PE2 is shown below. Notice that there are three quantities that can be determined by the user. The 'Amount' controls how much the contrast is increased at the light-dark transitions (edges). (In the analogy, this is how dark and light we paint the stripes.) The second, 'Radius' controls the distance away from the edge that the contrast is enhanced. (In the analogy, this is how wide we paint the stripes.) The last, 'Threshold' controls how sensitive the test is for determining whether an edge exists. In the remainder of the article, each of these controlling factors will be investigated.
Note that some radius other than zero must be chosen, or no effect will be seen when the two other factors are modified.
The 'Amount' control
As the value of 'Amount' is increased, the contrast is increased. This means that the darker pixels in the radius chosen will be made darker and the light pixels lighter. This can be seen in the examples below by studying the 20 or graduation lines.
Original image (no sharpening)
Amount = 50 Radius = 1.0 Threshold = 0
Amount = 100 Radius = 1.0 Threshold = 0
Amount = 200 Radius = 1.0 Threshold = 0
Remember that if the value of 'Amount' is increased too much, detail will actually be lost since we are reducing the range of values as many pixels reach their minimum or maximum values.
The 'Radius' control
As the value of 'Radius' is increased, the area of influence of the 'Amount' control is increased. In the following three examples, look particularly at the curved white band at the edge of the focus knob in the bottom left corner. As the value of the radius increases, so does the width of the white band.
Amount = 100 Radius = 2.0 Threshold = 0
Amount = 100 Radius = 4.0 Threshold = 0
Amount = 100 Radius = 8.0 Threshold = 0
If the value of 'Radius' is increased too much, edges in the final image may appear to have a strange halo around them. It is this strange artifact that photographers find most objectionable in over-sharpened images.
The 'Threshold' control
If the value of 'Threshold' is left at 0, every light-dark transition will be considered an edge and will be sharpened. A high value of 'Threshold' means that only the most abrupt, noticeable transitions will be sharpened. If an image has much digital noise, it is best not to use zero for the value, or the final image will look very grainy. Look for the increasing smoothness of the image as the threshold changes from 10 to 50. (The effect is very subtle!)
Amount = 100 Radius = 1.0 Threshold = 10
Amount = 100 Radius = 1.0 Threshold = 20
Amount = 100 Radius = 1.0 Threshold = 50
A value of 0 for images with a very large amount of fine detail, (such as grass) may result in the final image appearing to have an unpleasant 'digitally sharpened' look.
Practical values for the controls
Caution: These are only suggestions. Experimentation with a particular image is best. The value of image sharpening is very subjective! If the 'radius' is between 0 and 5, an 'amount' up to 150 or 200 may be usable. A 'threshold' up to about 5 seems to work reasonably.
(Note: The sharpened image at the beginning of the article uses Amount = 150, Radius = 2.5,Threshold = 0 )
Finally, here is the original image with a disastrous choice of values for the parameters. You do not want your sharpened images to look like this!
Amount = 500 Radius = 10 Threshold = 0
An excellent discussion of sharpening with examples exists at:
Understanding the Digital Unsharp Mask http://www.luminous-landscape.com/tutorials/understanding-series/understanding-usm.shtml
All comments to the author Brian Johnston are welcomed.
Please report any Web problems or offer general comments to the Micscape Editor.
Micscape is the on-line monthly magazine of the Microscopy
site at Microscopy-UK