I – The Unsharp Mask Filter
By Hans Weichselbaum – www.digital-image.co.nz
We spend a lot of money to get the sharpest lenses, the latest cameras and the best printers. Why do we need to ‘sharpen’ our images?
Good question. The answer is that whenever we cross from the analogue world into the digital world, in other words – when we turn photons into pixels, we need to sharpen the captured image. This is not a weakness of your camera or the lenses. Digital cameras and scanners convert continuous tone and colour gradations to points on a regular sampling grid. Details finer than the sampling frequency get ‘averaged’ over the pixel grid, softening the overall appearance. When the pixels are small enough, they provide an illusion of continuous tone, but it is an illusion, and sharpening is one of the things we simply have to do to make the illusion convincing.
When we hit the print button, the reverse happens. Pixels have to be translated into real-world ink dots and that will again introduce softening, which needs to be compensated for.
When looking at an image, our eyes are scanning for edges. Visual information is broken down into ‘edge’ and ‘not edge’. Not every, but most good images have a strong edge definition. This gives us the impression of sharpness, and digital sharpening does make those edges more prominent.
You don’t need to worry about sharpening if you shoot in JPEG. The camera will apply a sharpening algorithm which enhances edges, making your images look sharper. Many cameras give you a few options to set the degree of sharpening. Compare these settings critically and reduce the amount of sharpening if you find ugly halos around sharp edges of your photos.
How Does Sharpening Work?
All sharpening filters just enhance the image edges by making the darker side of the edge darker and the lighter side lighter. Here is a simple example:
Image 1 shows you three areas with different grey tones against a white background. You can see from the pixilation of the diagonal line that we are looking at a very high magnification. The second image shows you what happens when you run it through a sharpening filter: all edges are enhanced by increasing the contrast along the borders. In other words, the darker side of the edge gets darker and the lighter side becomes lighter. You can also see that there are two variables here which can be controlled: the amount of lightening and darkening and the number of pixels affected by the process, going from the edge into the smooth areas.
How do we sharpen an image? As I said, if you set your camera to JPEG you don’t need to worry about sharpening, but it is good to know what the camera does to your images. You need to know that if an image is over-sharpened (which shows up as ugly halos along edges) it cannot be ‘de-sharpened’ anymore. The damage is permanent. I therefore recommend setting the in-camera sharpening to low or moderate and then apply some sharpening in post-processing, if necessary.
Sharpening can be done in stages and it doesn’t do any harm to give your images a second round of sharpening. It gives you more control and makes your images stand out better. In fact, you can (and should) give them an extra sharpening boost before hitting the print button.
There are a number of filters which you can use for sharpening; the most common one and the one you can find in every image editing program is the Unsharp Mask Filter.
The Unsharp Mask Filter
This may sound like the last thing you would want to do to your images to make them look sharper. The filter gets its name from a technique in the old film days, when the film was sandwiched in the enlarger with a slightly out-of-focus duplicate negative – the unsharp mask. This made the light side of an edge to print lighter and the dark side to print darker, which is exactly what the Unsharp Mask Filter does.
The filter goes through the entire image, pixel by pixel, comparing them to their neighbours. If there is a certain difference in contrast between adjacent pixels, the filter will exaggerate this contrast according to the parameters you set. And here is where the fun starts, because the filter gives you three sliders – Amount, Radius and Threshold. They all have an effect, but finding the optimum setting seems a hit and miss process, if you don’t know how the filter works.
How to Set the Controls on the USM Filter
Make sure to view the image at 100% magnification when you sharpen your image to see the effect on fine image details.
The best starting point is the second of the three sliders – Radius. This determines the width of the halo created by the filter along edges. The wider the halo, the more pronounced the sharpening. But you need to avoid an unnaturally over-sharpened look. The setting depends on the file size and the image content. A good starting point for a 10–40MB file with fine image details will be around 1.0 pixel. Use a high Amount setting, say 300% and a Threshold of 0. The Radius can be increased to 1.4 to 3.5 for larger files and images without fine details. Small files for monitor display require a much lower setting, around 0.4–0.7 pixels.
The next control is the Amount. This is the volume control of unsharp masking. It determines the intensity of the halo. At the high end, pixels will be forced into either pure white, solid black or to the maximum amount of a given colour. Start at 300% and work your way down until the image starts to look good.
The Threshold setting tells the filter not to sharpen image tones which are similar. For example, a Threshold setting of 5 will ignore all tones that are within 5 level values of each other. A setting of 3 is a good starting point for the average image. A figure of 6–8 will protect noisy shadow areas, skin pores and other small blemishes from being accentuated.
In the next issue we will look at other sharpening options.