Sharpening 101Probably the one area for which lots has been written but little understood is the topic of sharpening. This article attempts to clear up some of the confusion, and offer a few useful options.
Sharpening is easy to understand at the simplest level—given two digital photos, one sharpened and one not, you’ll always point to sharpened one as having more detail and being “better focused.” Yet, if you were confronted with two sharpened photos, one well done, and the other less so, you might not be able to differentiate between the two.
Unfortunately, most digital photographers have learned sharpening by fixed rules that specify exact values to use in Photoshop's filters, and therefore neither understand why they use the tools they do, or how they might be using them rightly or wrongly. This article attempts to clarify the problems created by digital imaging, and how to apply the correct amount and type of sharpening to fix them.
The nasty truth underlying all digital recording techniques is that they turn analog signals into discrete samples of the original. CD players, for example, sample sounds at 44 kilohertz (i.e., 44 thousand times a second) and record each sample using 16 bits of data. The frequency of digital sampling and the amount of data sampled determine how well the analog original can be reproduced. The coarser the sampling, the less the digital recording is like the original.
State of the art consumer digital cameras have a sampling frequency of 4500 by 3000 pixels (e.g., Kodak Pro 14n), with the amount of data recorded being 12 bits for each of the red, green, and blue colors. These numbers are actually relatively crude compared to the analog reality, where detail and color variations are nearly infinite. The real world sports an infinite number of shades of blue in the sky and an endless amount of detail, but your digital camera only captures between 1000 and 4500 pixels of horizontal detail in perhaps thousands of shades of possible blues. While that’s pretty darn good, it does cause two resolution-oriented problems:
This second problem is what makes details in your photographs look fuzzy. The classic example is that of a diagonal transition line that transects a pixel. The pixel can either be white, black, or some in between value. If the camera were to render the pixel as entirely white or black, then you’d see an artifact known as the stairstep, so named because a diagonal line gets rendered as a series of pixel blocks that resemble a set of two-dimensional stairs. The alternative is to record the pixel as an "in-between" gray (which still produces a bit of a stairstep effect, but isn't quite as obvious). Neither case is correct, and both tend to reduce apparent sharpness.
All digital cameras use in-camera interpolation to detect edge transitions, and use some form of digital sampling to create “in-between” values for those diagonal lines. The result? Instead of a precise transition from one pixel value to another, diagonal details (and sometimes small horizontal and vertical details) are rendered as a more gradual transition from one color to another. Our brains have been programmed to see blurry or soft edges as being out-of-focus, thus unmodified digital photographs always tend to look just a tad soft. That’s even true of higher resolution cameras and scanners—film images I’ve had scanned on 4000 dpi drum scanners still look a little soft in the detail areas.
Worse still, most digital cameras employ what is known as an anti-aliasing filter--essentially a diffusion filter over the sensor. (The exception is the Kodak Pro 14n). Why? Because the Bayer pattern sampling used in digital cameras has a tendency to produce colored artifacts and moire patterns on small detail. By blurring the light slightly so that multiple photosites get some of the information from a particular detail, this lessens the chance that these hard-to-remove artifacts appear. Unfortunately, it also has a further tendency to make edges less distinct.
The method by which most digital photographs are “corrected” is to apply a sharpening “filter” using an image-editing program, such as Photoshop. What these filters do is to detect transitions (edges) and make them more pronounced. The easiest way to see this is to use two gray blocks:
Note how the software lightened a single pixel column on the light gray side and darkened a single pixel column on the dark gray side (just each side of the cursor in the image, above). Essentially, the transition is being exaggerated. At this close view, your eye can easily see the change, but now select Actual Pixels (View->Actual Pixels). Since you know what to look for, you can probably still make out the light gray column (though I bet you can’t see the dark gray one, especially if your monitor has been correctly color calibrated). Use the Undo command (Ctrl-Z in Windows, Apple-Z for Macs) to toggle back and forth between the unsharpened and sharpened versions. The sharpened version should indeed look sharper. (For extra credit, rotate the unsharpened version 45 degrees and repeat the sharpening step; the unsharpened version should seem significantly softer than the sharpened version).
Okay, now you know what to look for in sharpening: sharpened digital images have a slight “halo” at edges, one that can usually only be seen by enlarging the pixels or knowing exactly what to look for. If you performed the extra credit assignment in the last paragraph, you also are aware that diagonal edges can obtain interesting "artifacts" when sharpened (the vertical artifacts are rather mild-mannered in comparison, aren't they?).
For our simple example, we used a straight Sharpen filter, which worked fine. Unfortunately, the real world is a little more complicated than two shades of gray with a straight-line edge between them. We need to be able to control the amount of sharpening that is done and how it is applied, and for that we use the Unsharp Mask. Contrary to its name, it does actually sharpen your image. An Unsharp Mask gets its name from the fact that back in film days, a small piece of glass was placed between the original negative and a positive mask to exaggerate contrast along dark/light junctions; the glass put the positive mask slightly out of focus from the negative (in other words, an unsharp positive mask was used to "sharpen" an underlying image). The software variant attempts to reproduce that effect. In areas where there isn't a lot of detail, there wouldn't be much difference (the "Threshold" value controls how much it considers to be a significant difference), so the function won't try to change values (changes are controlled by the "Amount" in the Unsharp Mask settings). In areas where there was detail, the original data and the blurred data would be significantly different, and thus the function senses there is detail or an edge there.
Probably the biggest problem in using the Unsharp Mask is determining how to set the three controls (Amount, Radius, and Threshold for Photoshop users; other programs often use different terminology, apparently so that they don't receive nasty letters from Adobe lawyers). Most written advice I’ve seen always gives one set of starting points, then leaves the rest up to you to determine visually. And every writer’s starting point seems to be different. But if you read the last paragraph carefully, you'll already have some ideas about what these values might be.
First, let’s get rid of one notion, that there’s a magic starting place that applies to all images. Instead, let me suggest that there are at least two starting places, and many images need to use selections to apply different sharpening techniques to different areas. More on that in a bit.
Next, let’s make sure you know what each of the controls refers to:
Follow along at home: Start up Photoshop. Recreate your own simple gray block document to match the example (above). The lefthand block should have an RGB value of 86, 86, 86 and the righthand block a value of 43, 43, 43. If you use the Paint Bucket tool to create the blocks, make sure that anti-aliasing is off. You want solid blocks of a single color value.
Sharpening makes the edge of the lighter block a lighter value of gray, and the edge of the darker block a darker value of gray. Select Unsharp Mask from the Filters menu and set starting values of 100 for Amount, 2 for Radius, and 0 for Threshold.
Okay, I wrote earlier that there isn’t a magic starting place that applies to all images. While that’s true for Amount, both the Radius and Threshold probably should be started at specific points:
Before continuing, let’s set some specific rules down for dealing with standard sharpening:
Some books and seminars recommend converting your document to the Lab Color space (Image->Mode->Lab Color), and then applying an Unsharp Mask to the Lightness channel (Click on the Channels tab in the Layers window and make sure that Lightness is the only channel selected before applying the filter). After you’ve sharpened your image this way, you convert it back to RGB Color (Image->Mode->RGB Color).
The reason for using a technique like this is that sharpening colored edges means that the Unsharp Mask uses the color data to determine how to modify the edge. This sometimes results in minor shifts in color in the sharpened areas. But the changes are small. For example, the small blue area between the pole and the building front in the image below shifts ever so slightly bluer when using the Unsharp Mask on the original RGB (a value of 90, 132, 187 shifts to 107, 153, 210 using Lab Color sharpening, but to 109, 155, 213 using RGB Color sharpening). If you aren’t using color profiles for all of your equipment and attempting to maintain color matching between acquisition and print, sharpening using only the luminosity data is probably overkill, though, as any miscalibration between your monitor and printer likely produces a bigger shift.
If you are minding every last little bit of color change, be aware that changing color space introduces rounding errors in color values (and the error is more severe in 8-bit images than in 16-bit images). That same pixel value I noted before changes from 90, 132, 187 to 90, 133, 188 after converting to Lab Color and back to RGB Color, without making any other changes to the document.
While I’ve never seen a color changed in ways that I found destructive or problematic by rounding or shifting, I have noted very subtle changes in areas of gradated color patterns. At 1000% view I sometimes see a few random pixels shift in sky tones when making these changes. (Best way to see for yourself: make the adjustment from RGB Color to Lab Color and back to RGB Color. Then zoom way in to an area that has a subtle gradation, then use the History palette to click back and forth between the original RGB and the reconverted RGB. If you’re satisfied you’re not seeing any color shifts worth worrying about, then go ahead and use the Lab Color sharpening method.) If you do decide to use the Lab Color method for sharpening, convert to Lab Color and back only once. Rounding is cumulative, so bouncing back and forth between RGB and Lab Color is a no-no!
A better way to sharpen just the luminosity channel without changing to Lab Color is to perform sharpening as you usually would (e.g., using Unsharp Mask), then choose Fade Unsharp Mask from the Edit menu. In the dialog that appears, change the Mode from Normal to Luminosity and click on the Okay button.
Portrait and nature photographers have one thing in common: we hate seeing sharpening artifacts on large blocks of color. Any underlying noise in the image tends to bubble up to visible, and skies or skin tones with too much detail in them don't look as good as gently gradated ones. And if you know what bokeh is (the character of out-of-focus areas) and care about it, you'll be particularly bothered by what happens to noise in out-of-focus areas. Indeed, the first thing I look at in an image to see if sharpening is detectable is the non-detailed, out-of-focus areas. I've seen all kinds of techniques that attempt to deal with the problem of pulling up sharpening artifacts (deselecting the continuous tone areas before sharpening, using history brushes to paint out sharpening in certain areas, etc.). But the following technique is my favorite. Essentially, you build a mask of just the edges in your image, then apply sharpening to the areas under the mask. Here's one set of steps you can use in Photoshop:
Yes, that's a lot of steps, but you can easily make them into a Photoshop Action (make sure to click on the icon to make Steps 8 and 13 editable during playback). This, by the way, isn't the only way to perform an edge sharpening technique. I've seen at least a half dozen variants on the idea of making a mask for the details, then sharpen only at the mask.
Here's something I hadn't noticed before. Then one day I made accidentally entered some "stupid" values into the Unsharp Mask filter and noticed a change to the image that was interesting. So I did some research. It seems that a number of digital cogniscenti have been using the Unsharp Mask to make slight bumps in image contrast. It's really quite simple to do: just select a low value for Amount (10-25%), a very high value for Radius (200-300 pixels), and a 0 Threshold. This technique actually produces a more likeable contrast boost, in my opinion, than does the Contrast command. Just be sure to save a version of your image before using this technique (it's not undoable at a later date). You also perform this action prior to doing a "real" sharpening.
If you want to apply sharpening only to some areas (say the eyes of a portrait but not the facial skin, do this: