Mike Chaney's Tech Corner

Technical Discussions => Articles => Topic started by: admin on May 27, 2009, 12:12:14 AM



Title: December 2004: In a Fog over Sharpening?
Post by: admin on May 27, 2009, 12:12:14 AM

In a fog over sharpening?


What is sharpening?

Simply put, sharpening is an image editing technique that allows us to make slightly blurry or out of focus images look in focus, clear, or "sharp". While sharpening cannot fix obvious focus problems where the subject in our photo is simply not focused properly, it can allow us to add that final "punch" to the photo to make the jump from just "in focus" to "tack sharp". Sharpening doesn't really add any real detail to images, however, it can accentuate details to make them more obvious on screen or in print. Our task with sharpening is to find that delicate balance that makes our photos look clear and sharp without making them look overdone.


Why do we need sharpening?

The first step in understanding how to use sharpening is understanding why we need it in the first place. In a perfect world, our cameras would record every pixel in our images perfectly and those pixels would be rendered perfectly on screen and in print. Unfortunately, devices like cameras and printers have their limitations and one of these limitations involves sharpness. Due to the way cameras capture an image, for example, there is always some smoothing which "leaks" information from one pixel into surrounding pixels.

Imagine a single point of light in an image such as a star in the distance in a perfectly focused frame. Even if that point falls on only a single pixel on the camera's sensor, the algorithms that put together the final image will spread that point of light into neighboring pixels making the point look less focused (blurry). Add to this the fact that most cameras have antialiasing filters that blur the image slightly before it even gets to the sensor and the fact that no lens is perfect, and we start to understand why there is a need for sharpening to undo the appearance of some of this blurring. Sharpening can take that point of light that was spread into neighboring pixels and bring some of that spread out information back closer to what should have been recorded (a single pixel of light). The mechanisms in the image capture process that cause blurring are not limited to point sources of course since edges/lines are also affected such as a sharp edge on a car door, power lines against sky, and other fine details. Sharpening can help reverse blurring in those areas as well.


Where to apply sharpening

Sharpening should be viewed as a way to compensate for deficiencies in the way devices capture or render images. If we use sharpening to undo the inherent blurring effects of a device, we have done the best we can do because the result will be closer to reality with respect to sharpness. There is often a state of confusion with respect to where and when to apply sharpening so here are a few recommendations.

Sharpening the original image:

The sharpness of an image that just came out of your camera depends on many factors: focus, lens, whether you shot in raw or JPG mode, etc. In general, we want the image to have a realistic level of sharpness when viewed on screen at 100% zoom (1:1). The first sharpening step is viewing the image you intend to display/print in your image editing software at 100% (1:1) zoom and setting the sharpness level so that the image on screen has the correct amount of sharpness. If the image came from a JPG stored on your camera, you may not need any sharpening because the camera may have already applied an appropriate level of sharpening. When dealing with the original image from the camera (or an image converted through raw conversion software), the goal is to apply an appropriate level of sharpening (if needed) to make the image look as accurate as possible on screen at 100% (1:1) zoom. Doing so will insure that we have the best rendition of the original image possible and will insure that we have effectively reversed the appearance of blurring as much as possible to give us an image that is true to the original scene.

Sharpening at print time:

There is a lot of confusion on the web and in imaging circles in general regarding how to sharpen images for print. There are even numerous programs and plugins out there designed to take the guesswork out of this step. Let's start by looking at the print sharpening step at a high level. The purpose of print sharpening is to make the print appear clear and sharp at any print size. That is, we've already set the sharpness of the original image by sharpening the image itself and now we want to make sure that the appropriate level of sharpness is carried through to our prints no matter what size we decide to print.

Sounds easy but there are actually a lot of factors that need to be considered when sharpening prints. The larger the print for example, the more sharpening needs to be applied because you are stretching the same number of pixels (from the original image) over a larger space. You also don't want your sharpened edges to be so tiny that they become lost in the print, so you don't want to upsample an image to 720 PPI for your Epson printer and then apply an unsharp mask of radius 1 because your edges will be so fine that the sharpening will not show up in print (more on actual sharpening parameters in the next section below).

"Smart Sharpening" in Qimage is designed to take all these factors (and more) into consideration to allow you to set the appropriate level of sharpening at print time based on your own printer and paper. Software and plugins such as Nik Sharpener Pro also allow you to take control of sharpening factors in both images and printing and are a bit more feature rich than Qimage, but are a bit less "automatic" and generally take more time and experience to grasp.


We understand "when" but what about "How"?

There are actually a lot of different techniques that allow sharpening of images. Sharpening can be as simple as clicking "Sharpen" in your photo editor, or as complex as converting images to Lab color space and sharpening only the luminance channel using unsharp mask. Let's try to keep it simple and just focus on the most common and one of the most flexible sharpening techniques: unsharp mask.

Unsharp mask, unlike the name implies, is actually a method of sharpening. It is called "unsharp mask" because it uses a blurred copy (an unsharp copy) of the image to compare to the original in order to sharpen. Here are the parameters associated with unsharp mask:

  • Radius: the radius defines how "thick" the sharpened edges will be after the sharpening process. A radius of 1 will produce very fine/thin edges while a radius of 3 will produce "fatter" edges that are more noticeable.

  • Strength: strength defines how obvious the sharpening effect will be. Higher strength will result in more sharpening. Note that radius and strength work together. If you sharpen with a larger radius, you might need less strength than if you sharpen with a small radius. As an example, radius 1 and strength 100 will be less noticeable than radius 2 and strength 75.

  • Threshold: threshold or "clipping" defines which parts of the image are affected by the sharpening. When the threshold is set to zero, the entire image is sharpened equally. When the threshold is set higher, less prominent edges are excluded so that things like backgrounds, sky, and other smooth objects are not made noisy by the sharpening algorithm.

Notes on sharpening:

Typical "starting values" for applying moderate sharpening using unsharp mask might be radius 1, strength 80 up to about radius 3, strength 120. In general, when sharpening an original from your camera, you want to use a radius of between 1 and 2 pixels with whatever strength you feel appropriate because the in-camera blurring effects normally don't reach beyond about a 2 pixel radius.

There are various "artifacts" that can get you into trouble when using sharpening. For example, picking a radius that is too large and/or a strength that is too high can cause "sharpening halos" which look like a ghost of the original edge just beside/around that edge. For example, oversharpening can cause power lines against a blue sky to get darker and sharper, but can also cause a light halo on the outside of the power lines that can make them look like they are glowing. Using a threshold that is too high can often cause strange effects in the image because unless you sharpen the entire image the same way, you can break the relationship between less/more prominent edges. One negative effect of setting threshold too high is the image having a "charcoal painting" or embossed look.

There is a lot of information on the web regarding sharpening techniques, a lot of which can be confusing and even incorrect. Some of the best resources I have found are those at digitalsauces.com :

Digital Sauces Sharpening Introduction

Using the Sharpening Functions in Qimage

Sharpening in Adobe PhotoShop

If you would like more information on the Sharpening Equalizer in Qimage, see this article .

In Summary:

Sharpening is a technique that is so broad that you can make it as simple or as complex as you like. Unless you are sharpening for artistic expression, I recommend using sharpening functions to compensate for deficiencies that cause blurring in images. That is, we compensate for any blurriness or softness in the original by applying an unsharp mask to sharpen the image back to its original/intended clarity (or perception thereof). We also apply sharpening at print time to insure that our prints are as sharp as the image viewed on screen. Hopefully this article has given you a baseline understanding of when to use sharpening and has touched on a few of the methods of how to apply that sharpening.


Mike Chaney