Accurate Image Manipulation for Desktop Publishing
Techniques
 

Better USM

This tech page is Photoshop specific, a closer look into the Unsharp Mask filter. Is there a good starting point for the three variables in the USM dialog? There is, but it is necessary to first familiarize with the tool in order to to understand it properly.

The first general rule for better USM is:

The main image window should be viewed at 100% zoom when applying the USM. This is because it is the same zoom value that the image will be presented also.

Keeping the zoom in the image window at 100% allows to preview the enhancement normally. Toggling the preview check box is also very helpful.

The small preview-box in the USM dialog is for zooming and needs to be used for that purpose. Using the mouse, click over the image to get the region of interest into the preview-box in the USM dialog and then press the small "+" button a few times to zoom it up.

You can slowly toggle the Preview check-box in the USM dialog, it enables/disables the USM effect in the main image window, this is a very good way to refresh the visual system (eye/brain), it wants to adapt to a poor quality image rather rapidly. So the toggling helps to see what the effect actually us that you are about to apply.

In order to get the best out of this exercise please download the usm.zip that contains the usm.psd cgi that is used with this exercise, shown below.

The cgi has two layers that are exactly the same, USM is applied to the top layer that has the view mode in Difference. This arrangement will show nicely what really is happening.

All the illustrations below are show at 200% zoom in order to allow more accurate evaluation of the effect, (for normal work always keep the zoom at 100% for the image window).

The usm.psd cgi has a smooth swatch from level 0 to level 255 over different backgrounds (level 0, 64, 128, 192 and 255 gray backgrounds). At the right side each of these backgrounds has a noise wedge that consists RGB level 1, 2, 3 and 4 uniform noise patches.

The initial arrangement of the layers, two exact layers and the upper layer in the Difference mode causes the image window to appear initially completely black since there is no difference at this time.

Familiarizing with the controls

Have the usm.psd open in Photoshop, set the zoom to 200%, have the "USM evaluation copy" -layer as the active layer choose:
Filter/Sharpen/UnsharpMask....

And set USM for: Amount = 500%, Radius =0.5 and Threshold = 0


Amount = 500%, Radius = 0.5 and Threshold = 0

The edges of the gray swatches become visible. The short drop-out in the sharpened edges that now show as light gray is due to the fact that the background is at or near the level of the gray value of swatch, no edge there so no sharpening either. Also the noise patches becomes visible.

The Amount Slider

Using the mouse, click over the image window on top of an edge in the image to get that region into the preview-box in the USM dialog and adjust the zoom of the preview box to 800%.

You will notice that the sharpening effect is limited to the two pixels that define the intensity edge. This is so everywhere in the cgi.

Now adjust the Amount slider to 400%, 300%, 200%, 100% and you will notice that only the strength of the effect changes, just as it should do.


Amount = 100%, Radius = 0.5 and Threshold = 0

The Radius Slider

Again starting from Amount = 500%, Radius = 0.5 and Threshold = 0 adjust the Radius upwards. (To do this easily click with the mouse into the Radius input-box to make it active and then tap the UpArrow -key on the keyboard once, the Radius amount increases by 0.1 to 0.6).

Readily at Radius = 0.6 you will notice that the sharpening effect is spread over 4 pixels. (slowly repeat DownArrow then UpArrow to see how the effect changes).

At Radius=0.9 the effect is spread over 6 pixels and at Radius=1.3 the effect is spread over as much as 8 pixels. It gets spreading still more if the Radius is increased.

Now experiment how the Amount affects to the spreading. Start from Amount=500%, Radius=1.3 and Threshold=0,


Amount = 500%, Radius = 1.3 and Threshold = 0

and then decrease the Amount to 400% 300% and 200%. You will see that Amount does not affect to the spreading.

The Threshold Slider

The Threshold defines the minimum difference in RGB levels that the edge has to have in order to be sharpened. This is mainly useful in keeping the noise down. Increase the Threshold over the noise level and noise will not be sharpened.

Large amount of Threshold has adverse effect, there will be regions in the image that are sharpened effectively and other, possibly nearby areas, that also do have real edges but are not sharpened at all. This will give the image rather disturbing appearance.

Now experiment how the Threshold functions at different Amount and Radius Settings. You will notice that at higher Amount you can use higher Threshold and have the same non-sharpening safeguard against the noise. Let us see a comparison:


Amount = 100%, Radius = 1.0 and Threshold = 4


Amount = 300%, Radius = 0.5 and Threshold = 10

As can be seen the lower graph has much stronger sharpening and appears to be more accurate (effect is not spread) and yet the area that is not sharpened is the about same. The Threshold was set visually so that the noise patches on the right were kept down. The Threshold range that is not sharpened is seen where the gray swatch RGB level is at or near to its background level, the white line in the difference view breaks.

If you do more experimenting you can see that the matching Threshold value goes, about, by the ratio of Amount, Threshold=2 at Amount=100% equals Threshold=4 at Amount=200% and it equals Threshold=10 at Amount=500%.

In general the Threshold should be kept as small as possible, but high enough that the noise is not amplified.

Conclusions

The most important finding is that:
Radius value higher than 0.5 will always spread the effect over several pixels.

Using higher value than Radius=0.5 will give the image more sharp appearance, but it happens at the expense of fine image detail and apparent resolution get lower.

In order to keep the sharpening effect within the two pixels that define the edge, Radius values 0.2, 0.3, 0.4 and 0.5 are usable (value 0.1 gives no effect at all) but in general the best effect is achieved at Radius=0.5.


Amount = 500%, Radius = 0.3 and Threshold = 14

Hence the procedure for the very highest quality USM could be:
  1. start at Amount = x00%, Radius = 0.5 and Threshold = 0
  2. increase Threshold until noise level is down.
  3. if it look cranked decrease Amount until good appearance is perceived.
  4. Decrease threshold, to just above the noise level.
The Amount x00% depends on the quality of the acquire device, images from high noise devices can not tolerate Amount=500%.

Does it work in reality?

Let's finally experiment with a real image. The below is from Mustek 12000P scanner (that is rather noisy). The original (before image) is a product of 4 X noise reduction scan + color calibration. USM was then applied over that at Amount=500%, Radius=0.5, Threshold=4.

Before After

Editing was performed in the linear space and the images were then compensated by gamma 1/2.5 for viewing with an uncalibrated PC system then saved as JPG at quality=6 using Photoshop.

Just out of curiosity let's compare the above linear space editing with gamma space 2.5 editing, the same USM was applied as above.

Edited in gamma space 2.5 Edited in linear space (gamma 1.0)


Please download the linear original in case you like to experiment yourself.

Please also see the Better Than USM page, explaining and demonstrating convolution. It will give better results than USM.


Accurate Image Manipulation for Desktop Publishing

Copyright Timo Autiokari, 1999-2007. Contact info