www.creativephotobook.co.uk   •   © 2008 Colin Bell and Phil Thomas

 

Contact us

   

Click one of the icons above to contact us by e-mail or through our blog.

 

Basic Enhancements (part 2)

Image Sharpening

Sharpening is one of the most useful forms of image processing that can be done on a digital image.  The effect is to bring out image detail that was not visible in the original image.  Of course it is not possible to create detail that is not in the original image.  So what it does is to emphasize any edges in the image which has the effect of making the image appear sharper.

Image sharpening is necessary in digital cameras as there is a filter over the front of the sensor called an "anti-aliasing" fliter; this has the effect of reducing some image sharpness.

When you shoot images in JPEG format, all compact cameras will apply a considerable amount of sharpening to the image in the camera.  DSLRs will usually do this too, but you are usually able to control the amount of this in one of the settings menus.  The default setting is often lower than for a compact camera which is why beginners to DSLRs often claim their images are not as sharp as the little compact they used to have.

If you shoot in RAW format, no sharpening is applied to the data - it is up to you to do this in the processing of the RAW file on your PC.

The Theory of Image Sharpening

It may seem strange but the first step to sharpening any image is to blur it.  You then compare every pixel in the blurred image with the original image and look for differences.  If the pixel in the original image is brighter than in the blurred image, then it is lightened even more ; if the pixel in the original is darker than in the blurred image, then it is darkened more.

The overall effect is to increase the contrast between the pixel and it's surrounding pixels.  Let's look at a picture example and then a more detailed explanation with the help of a graph.

Take a look at this simple shape - a light grey and a dark grey box.  The boundary between them forms an edge.  Note that the image is actually only 38 pixels wide - I have scaled it up so you can see the bluring and sharpening effect.

Now lets apply a fairly large blur to that image...

You now compare each pixel in the original with the same pixel in the blurred image. If the pixel is brighter in the original image, then its brightness is increased further - if it is darker in the original image, it is made even darker.  The amount the brightness is governed by how big the difference between the original and blurred pixels are.  Here's the result ...

In this illustration - the effect has been spread over quite a number of pixels - if you applied this much sharpening on a real photograph, the effect would be quite unnatural.

For the mathematicians amongst you - here's a graph showing what's happening for the same image shown above.  The x-axis is the pixel column - the y-axis is the grey value (0-255).

The green line is the original image - it jumps from dark grey (value = 64) to light grey (value = 192).  The pink line shows the blurred image.  You can see that the change from dark grey to light grey is more gradual (spread over about 24 pixels).  The exact shape of this line will depend of the blurring algorithm used.

If you take the original image and subtract the blurred image - you get the brown line.  You now simply add this difference back onto the original data (shown by the green line) and this gives you the sharpened image.

Potential Problems with Sharpening

To truly create a sharper image you need more data - so the first thing to remember is that when sharpening an aimge, you are faking it!  You are not really creating any additional data - you are altering the data in the image to give the appearance that the image is sharper by increasing the contrast close to distinct edges in the image. 

There is obviously going to be a limit as to how far you can push this before it starts to look false.  Oversharpening and image can:

  • create white halo effects around dark objects.
  • create dark halo effects around light objects.
  • lead to unnaturally pronounced edges.
  • emphasise the noise in the image as you are also sharpenning and making more noticable something that you don't really want in the image.
  • a speckly effect as pixels start to break up differ from their neighbouring pixels.

The 6 pictures below show the effects of sharpening (and oversharpening) an image.  The numbers will mean something when we talk about the unsharp mask later on.


1. Original image


2. Radius 0.8 ; Amount 70

3. Radius 2.0 ; Amount 100

4. Radius 4.0 ; Amount 150

5. Radius 8.0 ; Amount 200

6. Radius 16.0 ; Amount 400

Image 1 (the original) is a reasonably sharp image - however it can be improved with some subtle sharpening as in image 2.  Some might go as far as image 3 for on screen display, although this might be too much for prints.  Images 4-6 start to look increasingly false (but it does sometimes make an interesting effect).

In most photo software you will usually find a range of options for sharpening images.  There will usually be a couple of quick fix options usually labelled something like 'sharpen' and 'heavy sharpen'.  This apply to the whole image and give you minimum control (other than maybe an amount slider).  Paint Shop Pro's 'Sharpen' and 'Sharpen More' don't even allow you to control the amount.  We would recommend avoiding these and only to use what is called the 'unsharp mask'.

The Unsharp Mask

You've seen in the blue box (unless you skipped over it) how the unsharp mask works.  The unsharp mask is the most popular method of sharpening an image as you have more control over the sharpening process to get the precise amount you require.  The dialog box has 3 sliders.

Radius:  this indicates (in pixels) how large a radius should be used when sharpening the image.  The larger the number, the wider the band of pixels around an edge will be sharpenned.  If this value is too large, then you start to get white or black halos appearing around the sharpened edges

Amount:  as you would expect, this is how much the local contrast is adjusted.  For the mathematician, it is K in the following equation:

      Pixel_sharpened = Pixel_original + K (Pixel_original - Pixel_blurred)

The effect the actual value has can differ between different image editing programs so experiment and see what works.

Clipping / Threshold: specifies the difference there must be between a pixel and adjacent pixels before it is sharpened.  If this is set to zero, then every pixel is sharpened, and this can lead to sharpening of the noise in areas of smooth colour.  Therefore, this should usually be set a little above zero.

As a little side note - Photoshop's unsharp mask is a lot better than Paint Shop Pro's.

What are Sensible Values?

It is difficult to specify a "good" set of overall values for the Unsharp Mask filter as it depends on ther image being sharpened (that's why these controls are there after all). A portrait would not benefit from the same sharpening as a picture with a lot of detail such as an insect macro for example.

The amount of sharpening required will also depend on the sharpness of the lens used and the strength of the anti-aliasing filter on the camera.

There is a balance to be struck between the three values, it is perfectly possible to use an Amount of 300 if the radius is set fairly small (less than 1 pixel) whereas a smaller amount can be used quite succesfully with a bigger radius. Increasing the radius too much is a sure way to introduce halos so keep a close eye on areas of high contrast to make sure this is not happening.

Where the image consists of large amounts of block colour such as skin in a portrait you will usually want to have a fairly high threshold to avoid noise in those areas. Whereas in the insect macro mentioned above you will be able to get away with a much smaller threshold.

If you have a high resolution image a pixel will often appear very small and therefore you will require a larger radius to get a noticable increase in sharpness. If you have an image with a fairly low pixel dimension (i.e. a web page image), then a smaller radius should be used.

We would suggest as a starting point that for large images, you use a radius of 1 - 2, an amount of about 100, and a clipping value of about 5 - 10 in Photoshop (5 in Paint Shop Pro).  If you want a really sharp image, you can see how far you can push it but make sure it doesn't look false.

You may also want to consider selective sharpening (i.e. only sharpening parts of the image). You can do this in Photoshop by creating a composite layer of your photo as a new layer Ctrl&Alt&Shift&E sharpening that layer and masking out the areas you don't wish to be sharpened such as skin, sky or out of focus areas in the image.

And one last tip - don't waste time trying to sharpen an image that suffers from camera shake - you can't.  Just throw the image away or call it intentional art.

 

 

Photographs

This is a site about photography so I'm sure you are expecting to see plenty of pictures.

For now, why not take a peek at the flickr galleries belonging to the two authors of this site.

Colin's Flickr Page

Phil's Flickr Page

 

"Every time someone tells me how sharp my photos are, I assume that it isn't a very interesting photograph. If it was, they would have more to say."
              - Anonymous