Recently, I wrote about the demosaicing process, with particular reference to the Bayer pattern that most current camera sensors use. If you need a refresher, be sure to read that article. One of the downsides to demosaicing is the slight softening of fine details that is caused by interpolation. In this article, I will demonstrate how this occurs and how to use the pre-sharpening controls in software like Adobe’s Camera Raw and Lightroom to ameliorate the situation.
Imagine that one of the details in a portrait is a strand of auburn hair set against a cerulean blue sky. To your eyes, it appears quite sharp and distinct; and given that your lens is an optical instrument, the lens will see it sharply too, provided your focus and depth of field are correct. Here is my simulation of this optically sharp hair:
However, when you open the image in your raw converter, you notice the hair looks a little soft, perhaps like this:
Why does such softening happen? Recall how the interpolation process calculates (intelligently guesses) the full colour of each and every pixel. The pixels in the hair, according to the Bayer pattern, capture amounts of red, green and blue light. Since the hair is auburn, it will reflect more red light than green or blue, and thus the hair pixels that catch red light will have high intensities, or levels. The green pixels will have moderate levels, since reddish-orange hair has some green in it too, but the blue pixels will have low levels. Thus, when these pixels undergo interpolation, the reddish-orange colour will emerge.
Now consider the pixels in the sky. They will have very low amounts of red and green, and high amounts of blue, since the sky is reflecting mostly blue light. After interpolation, you get a predominantly blue sky. But what about the pixels that lie along the join betwixt hair and sky? There is a border of auburn pixels around the hair and a border of blue sky pixels set immediately against them. It is these borderline pixels that will cause trouble. Wherever there are pixels of one colour or brightness set against those of a different colour or brightness, an edge is visible. This is how our visual systems distinguish one object from another: they look for edges. Moreover, the quicker the transition from one tone to another, the sharper we perceive that edge to be. In the real world, the colour of the hair stops suddenly and the colour of the sky starts immediately. The result is something akin to what I’ve drawn in the first image above: a sharply defined strand.
Unfortunately, interpolation introduces a graduation along the edge, and this translates to blurriness, or softness, when viewed. Consider what happens as the pixels along the edge of the hair are interpolated. They contain high amounts of red, some green and little or no blue; but the sky pixels immediately adjacent to them contain high amounts of blue and little or no red. As a result, some of this blue is factored into the colour of the pixels along the hair’s edge, tempering its redness. The reverse problem occurs when the sky pixels along the edge are interpolated: now the high amounts of red in the adjoining pixels are factored into the blue, reddening it. The net result is a more gradual transition from the red hair to the blue sky, which our eyes perceive as a soft edge. Here is a zoom of the blurry detail:
Any raw image captured using a coloured filter array process, like the ubiquitous Bayer pattern, is prone to this softening effect during demosaicing. When opening a raw image, you should spend some time zooming into 100% or more and reviewing the fine details carefully. Pay especial attention to hair and fur, eyes, important textures and other reticulated details. They will almost certainly benefit from some pre-sharpening.
In my experience teaching Photoshop, pre-sharpening is widely misunderstood. Users often reject it for not producing a strong enough effect, or else overuse it and ruin delicate details. Pre-sharpening is available for application in Camera Raw and Lightroom and has some default values that typically don’t go far enough. The onus is upon you, the editor, to evaluate each image and dial in appropriate values. Software sharpening, of any kind, is essentially visual legerdemain, a conjuring trick designed to beguile your eyes into seeing sharper details. Pre-sharpening is a small amount of such trickery that is applied at the outset of image editing, in the raw processing stage. For this reason, it is sometimes known as input sharpening. Used judiciously, it can help to offset softening and ‘restore’ (read: simulate) the optical sharpness of the lens. The following graphic should help illustrate how software sharpening performs its magic:
To begin with, sharpening software is able to detect edges. How it does this beyond the purview of this article; it will suffice to say that it is programmed to locate regions of rapid transition in brightness which, as discussed above, form the edges that our eyes recognise. Having detected an edge, its centre point is found and traced, as indicated by the pink line in the graphic. Next, two corridors are traced parallel to the centre and along either side of it. One is on the lighter side of the edge and the other is on the darker side. The width of each corridor is controlled by a setting called Radius that all sharpening effects offer. It is measured in pixels and determines how far each corridor extends away from the edge’s centre.
Having traced these corridors, the software is ready to boost apparent sharpness. It does so by making the pixels in the lighter corridor brighter still, and the pixels in the darker corridor darker still. This increases the contrast all along the edge and offsets the tepidness of the transitional pixels caused by interpolation. How much contrast gets added is controlled, typically, by an Amount slider. Thus, Radius and Amount work in tandem to create the effect. The following three images tell the story:
In the first image, the edge is razor sharp from the lens’ optics; in the second, demosaicing has introduced softness; finally, some pre-sharpening has firmed up the detail. Here are the default sharpening settings on Camera Raw’s Detail panel:
When using raw pre-sharpening, be careful how high you take the Radius. The Camera Raw engine, which also powers Lightroom’s Develop module, sets a three-pixel limit. That’s three pixels either side of the detected edge, for a total of six. I recommend you zoom well beyond 100% and estimate how many pixels wide the important fine details are. For instance, in a woman’s portrait, I might locate the eye lashes and determine them to be about two pixels wide on average. This will allow me to gauge where to set the Radius, and it will be somewhere between half this value and the value itself: between one and two pixels in this case. Be careful not to overdo the Radius, else the corridors of contrast overrun the details themselves. The result is unsightly: thick borders trace the details, dark one side and bright the other. Since the eye is drawn more to the brighter edges, this ugly effect is called haloing, and lends a crunchy glow that indicates over-zealous sharpening:
Once the Radius is set, you adjust Amount to taste—enough to provide a good semblance of sharpness to the details, but not so much as makes these details crunchy and tactile. The idea is to downplay the softness, not bludgeon it away. I typically begin by increasing Amount to its maximum (150 in Camera Raw) so I can better judge the Radius, then I back it off later, often ending up with a value of 75–100. Holding [Alt] or [Option] while dragging Radius shows a preview of the corridors being traced along the edges, which proves very useful; with Amount, it renders the image in greyscale, making it easier to judge the effect.
The Masking slider allows you to back off the effect by limiting it to only the boldest edges. As you increase it, the finer, more delicate edges will not receive any sharpening. This helps to prevent the effect from being applied to noisy details or out-of-focus background areas. After all, you only want to enhance the sharpness of what is already good, intentionally sharp detail. [Alt] or [Option] drag this slider to see a dynamically drawn mask—black areas are being protected and only white areas are sharpened.
Finally, I recommend being careful with the Detail slider, which has a tendency to produce over-sharpened, scaly details. The slider produces a second pass of sharpening, which is prone to exaggerating noise and other unwanted variations. Not everything the edge-detection algorithm categorises as an edge should be sharpened, and when another dose of the effect is heaped on top the result can look unsightly:
The scaly effect is further exaggerated when additional work is done in Photoshop. Always bear in mind that pre-sharpening is supposed to be subtle and compensate only for the interpolation process. If you can readily appreciate its effect when zoomed out, you’ve gone too far. You’ll typically apply a heavier pass of sharpening—output sharpening—in Photoshop when you’re ready to go to print.