What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

a chautauqua on sharpening


Erik

Guru
Messages
1,534
Likes
2
This is not a tutorial as I don't know where this will be leading to: everything is linked with everything in digital art, and how can one talk about one option without invocating the rest? In the end, it all comes down to pixels. Pixels that, when made fine and dense enough, trick our eyes into believing we see a continuous form. But do these pixels come from scratch, from a scan or a digital camera? And what is their ultimate goal: the web? Print on a desktop printer at home, or a professional offset printer?
Many books have been written on the subject, and by peole who know infinitely more about Photoshop than I do. But no-one ever gave "my" answer. And it isthere that the spirit of this site and these forums can be found : experiment and try to find what your own answer is to that particular question, your own solution to that problem. And that is what I will try to explain here. So it will be more of a way of thinking than a clear answer.

Sharpening. Everyone who uses Photoshop does it. Some people do it even before they open the image in Photoshop as their scanner's software permits it, everyone observed at some time that it can produce artefacts and that it, bizarre as it may sound, can produce an image that seems to be less sharp than what they started with.

In fact: sharpening does not make anything more sharp. It only appears to do so. When there is more contrast between the edges of an object and its surroundings, we interpret this as being more sharp. But increasing the contrast does not really sharpen anything. So let's take a look at how Photoshop tries to make us believe it has sharpened our image.

Under Filters>Sharpen, we find three options that are quite useless when compared to the fourth one: sharpen, sharpen edges and sharpen more. The fourth one is Unsharp Mask. Bizarre that a sharpening tool can ber the name "Unsharp Mask" isn't it? But the explanation is simple. When one places two perfectly registered films on one-another, one that is sharp, and one that is blurred, the result after exposure will have clearer discernable edges because the contrast between edges and their surroundings is enhanced. Hence the name "Unsharp Mask".

When we look at the dialog window for this tool, we see three different settings: Amount, Radius, and Threshold. People who begin with Photoshop usually tend to use a trial and error method to get some acceptable result. Three sliders do offer a wealth of possible settings indeed. But which one is right? Right for you? Because it always comes down to a question of personal interpretation.

Let's use the little grey cells.
1/The Amount slider goes from 0 to 500%. If this should be the sharpening effect itself, it would not go beyond the 100% boundary. The Radius slider goes up to 250 , no matter how big your image is. It is measured in pixels. The Threshold slider goes up to 255 levels. The units are levels, and the number is one less than 256, the number of greyscale values we have in the 8 bit system, white and black included.

2/A little experimentation shows that higher values of Amount intensify the sharpening effect. And that the Radius controls the thickness of the edge.
When we set the Amount to maximum, meaning that the sharpenuing will be done with maximal intensity, we can drag the Radius slowly to the right. We can observe how the contrast between the edges and the surrounding pixels grows, simplifying the image as light becomes lighter, and dark becomes darker. We also observe that our computer needs more time as this is very processor-intensive, most certainly as we approach the right-hand side of the slider where the effect will be spread out over 250 pixels.
The third slider, Threshold, seems to do the opposite. Dragging this slider to the right nullifies the sharpening. Intermediate settings show how the pixeisation, the noise if you will, becomes less apparant. It sets, as its name says, a threshold value. This it does by comparing pixel values. The number you enter is the threshold. It decides whether a difference in brightness is enough to apply sharpening or not. In this way, it can be used to eliminate noise.

So the conclusion is that when we use Unsharp Mask for sharpening, we do best to set the Amount to maximum and then look for the lowest possible setting for radius, so as not to lose valuable pixel information. Then we try to set the Amount to a lower setting, once again as low as possible, but enough to make the effect clearly visible. If we see that we get noise (more about that in following parts of this chautauqua), we gently slide the Threshold a bit, but here also the value must be as low as possible.


Note: I take the liberty to keep this thread closed until I have finished with the subject. Then we can start a discussion. Be shure that many more related options will follow, like partial sharpening, channel sharpening and alternative methods.
 
This illustrates what I want to explain:. The edges are sharp, and of high contrast. All Unsharp Mask does is enhance the contrast between neighbouring pixels.
Radius adds a width to the edge, and Threshold limits to a minimum needed contrast before the contrast-enhancing can take place.
 
We seem to have found a sound method here. With Amount at maximum, we see the maximum intensity of the sharpening so that it becomes easier to find a correct setting for the edge thickness with Radius, after which we can lessen the intensity by dragging the Amount slider back to the left. If we leave it at too high a setting, then we will have artefacts. These artefacts are not of the kind Threshold can handle. In fact, Threshold is the weak spot of the Unsharp Mask filter. In many pictures, and in most scans or photographs, it just doesn't work as it should. The idea behind it is very good, but there's a whole galaxy between theory and the practical world. It does indeed give the ability to select edges, but it is too simple, like the Brightness/Contrast dialog. Photoshop can do better than that. But more on that later.

Right now, for the moment, I would like to assume we have found correct settings. But what we see on our monitor is not always what we get. Remember that a monitor typically displays 72 pixels per inch, and that for print, we need some four times more to get a good result. The edge we have chosen with so much care, and that looks perfect on our monitor simply disappears when printed. Pixels have no fixed size, and at 300pixels per inch our edge has become a bit less than one fourth of the width we had on our monitor. That is why we must increase the radius setting when we work for print. Of course this is also true for a deskjet printer we use at home. For print: sharpen correctly, and then increase the Radius setting.

Sound as this method may seem, it still has one big drawback: if we apply sharpening this way and it is not what we want after all, we can start all over. This we can solve in several ways:

1/ We can try to avoid having to start all over: Set Amount to maximum, set your Radius and then decrease Amount as has been said untill you have what seems to be a good setting. Now set Amount at approximately one fourth of the value you had, and use Ctrl/Cmd+F to repeat the application of the filter untill you're satisfied. Typically, you will need less sharpening this way: three times one fourth will usually equal, or even surpass, one time the ideal setting. And we have Ctrl/Cmd+Alt+Z at our disposal to go back one step.
This method has an extra advantage. The way we change pixel brightness with the Unsharp Mask is very fundamental, needing a lot of calculation to be done. And we know from downsampling that it is always better to limit this calculation to smaller values. In other words: we may indeed gain some accuracy.

2/ We can fade the effect with Edit>Fade. But this only works if sharpening was our latest effect. It has other advantages though, but more on these later.

3/ We can use the History Brush. Apply sharpening, and make a snapshot of this state. Then go back to the previous state and choose the sharpened snapshot as target. Now you can make use of all the advantages of brushes, allowing for selective sharpening. The drawback is that the flexibility is limited to one session of Photoshopping.

4/ We can duplicate our layer and apply sharpening to the top layer of the two. When we then add a layer mask, we can go on painting forever as it will always be there. This method offers us another advantage, namely that we can work with selective sharpening. More on that later. This way, we can adjust sharpening everytime we open Photoshop and this for as long as we have a good copy of our image at our disposal. The price for this is increased filesize.

Another option I like a lot can be found under Image>Duplicate. If you have enough ram, it is always a bonus to have one unaltered version at your immediate disposal, or even several states. It's amazing how quickly we tend to adjust to a situation and take things for granted. Duplicating is to Photoshop what "Remembering Yourself"is to Gurdjieff and the people who follow his ideas. Remember though that duplicates are not saved automatically. Which is why you have to do that yourself. Photoshop offers you the possibility to do so in the dialog box. Should you agree with Photoshop's own settings and name givings, then hold down Alt when you click on Duplicate.
 
Time for another illustration: because I want to start the issue "colour", I chose this clear example. I created a gradient ranging from grey to pink in one direction, and below it, in the other one. Then I cutted the result in half and copied this eight times on a new doc.

The colours were, of course, carefully chosen, but the issue is there, and can be found in most pictures. I chose a grey (145, 145, 145, RGB values) and as second colour one that had much difference in Red (255), less in Green (157) and nearly none in Blue (147).

Then I applied the Unsharp Mask filter to it with several settings that are noted on the picture:
 
The first thing we can observe is what we already saw in the previous illustration:because of the big difference with the black border, we get an accentuated, white edge next to it that smoothes into the image itself. And the higher the Radius setting, the thicker it becomes.
What we can do in this case is make a selection of what we want to sharpen, copy this to a new layer (Ctrl/Cmd+J) and apply sharpening to this layer instead of our basic image.
(Same goes of course for a photograph with a beautiful white border.)

We also see that there is a colour shift, and that this becomes more prominent when the contrast is greater: it is more visible on the left-hand side where the difference is at maximum, and it is non existent where the colours are the same, that is on the right-hand side. It also becomes more prominent when the radius increases and, although the effect diminishes with applying a Threshold setting, it cannot be undone by it.

What is happening is that we seem to apply the Unsharp Mask to the image we see, but in fact, it is applied to each channel of the image separately.
Let's take a look at the channels. I created this image by making a layer of the background, duplicating it twice, and adding a new black bottom layer for visibility. Then, to each duplicate, I added a Channel Mixer adjustment layer, set to monochrome and dragged the sliders to 100%. The top one is the Red channel, the middle one the Green, and the bottom one the Blue channel.
 
The Blue channel shows practically no gradient. Indeed: the Blue components of the Grey and the pink are almost the same: 145/147.
The Green channel is a bit more clear: 145/157
The Red one shows a lot of difference: 145/255

Applying the Unsharp Mask here will inevitably influence the colour as the edge in the Red channel is far more obvious than in the Blue one. As the Red component in the pink colour is at maximum, 255, the only way Unsharp Mask has to increase the difference in brightness is to cut down the Red component in the grey colour. This results in the green we see.

To solve this issue, we have to see that Unsharp Mask does not influence the colour, but only the brightness of each pixel. We have a few options to accomplish this:

1/ We stay in RGB mode. We apply Unsharp Mask as has been demonstrated above (with or without the small increments step), and we use the Edit>Fade command. We enter no specific value, but we set the blend mode to the one that influences neither the Hue, nor the Saturation of the colour: Luminosity. This way we force Photoshop to limit the Unsharp Mask to the brightness.

2/ Westay in RGB mode. We duplicate our image, apply a ChannelMixer adjustment layer to it, set to monochrome and drag the three sliders of RGB untill we have a satisfying greyscale image. We then apply Unsharp Mask to this, and then we set the blend mode of this channel to Luminosity.

3/ We change to LAB mode. This can be safely done because LAB encompasses all possible colours of even the widest RGB space. LAB offers us two colour channels and a lightness channel. Applying Unsharp Mask to only the Lightness channel guarantees us that the hues and saturations will not be affected.

4/ When we will use the image to be printed and we have to deliver a CMYK file, we change to CMYK and, as a last step we apply sharpening to the Black channel. This also will not influence the colour, but by adding contrast to the Black plate, the result will appear sharper. Don't forget to give more radius here!

Why can't we use the Black channel of CMYK and then reconvert to RGB mode? It would indeed be great if we could do so, but Photoshop converts every single hue from one colour space to another one, using LAB in the background. When converting to CMYK, many RGB colours have to be discarded as CMYK is contains less colours. Many colours that can be seen cannot be mixed with the four inks Cya, Magenta, Yellow and Black. When we would reconvert to RGB, the original colours can never be recovered as they aren't there anymore. What's more: Some CMYK colours cannot be reproduced in RGB, so this adds to the loss.

This loss between colour spaces also shows when we go from a larger RGB space to a smaller one, like from Adobe RGB to sRGB or Monitor RGB. (This might well become a next chautauqua!)

Next problem we attack is noise.
 
A scanner and a digital camera have a few things in common: first, they need light to be able to do something (a monitor doesn't: you can very well see it in the dark as it generates light itself), and second, they translate what we might call analog data into digital ones. Chopping it up into pieces to be able to store it into meory so as to say.
Depending on their quality (which, by the way has nothing to do with the number of megabyte a photograph can have in a digital camera) they can give more or less accurate translations. A scanner needs a good optical resolution and dynamic range to produce good results. What happenswith both is that, when light conditions are bad, the amount of light energy they need becomes too feeble and they cannot exactly discern between the different brighness values anymore. So they produce noise. A random kind of pattern with lighter and darker spots. Because the higher energy end of the spectrum is on the blue/ ultraviolet side, blues will be more affected. More energy is needed to register blue, so it will be first to suffer from noise.

Images from scanners and digital cameras indeed have usually more noise in the blue channel. People who have tried to restore an old photograph know about this. (traditional colour film can also shows this issue).

When we say that a pattern of lighter and darker spots is created, we immediately realise that this is problematic when we sharpen the composite image. (composite means the total image, not one of the separate channels of it) Indeed, Unsharp Mask will behave like any good soldier and do its job without a second though. And the noise will show up as a lot of new edges can be found in it.

But that was not what we wanted, did we?

It often happens that people, instead of sharpening the Blue channel with the noise do the opposite, and blur it a bit.
So, in the case one of the channels is weaker and contains noise, we better apply Unsharp Mask to the other channels, but not to the noisy one.

At first sight, yhis is an easy job. We apply a bit of Gaussian Blur to, say, the Blue channel, and apply Unsharp Mask to the other two. Problem is that it becomes difficult to arrive at a correct setting. This is where History makes itself useful. We can apply Unsharp Mask as was told above to the composite image. Then we go back in History to the previous state. We select the Blue channel in the channels palette and (Edit>) fill it with History. This has the advantage of having a good view of what Unsharp Mask does, and find the best settings, ignoring the noise of course, and then eliminate the sharpened noise with a few mouseclicks.

In the next part we will look at other ways of sharpening, or better: increasing edge-contrast to simulate sharpness. Because nothing compares to a sharp picture to start from.
 
There are several methods, and I am not going to add them all. In fact: I hope that others (you!?) will add them to this thread.

What I want to add are three methods/tools.

The first is the Sharpen tool which can be found docked with the Blur and the Smudge tool on the Tools palette. Shortcut R. I have no particular liking for this tool as the history brush, used with the method I described above if far better. Painting with history combines the advantage of a brush with its shape and transparancy, with the better control of sharpening the Unsharp Mask offers.

The second one makes use of the HighPass filter. I recently described one of its uses in another thread (on quake textures). It offers a good way to create edges as , with low settings, it enhances contrast where dark and light meet. It can be used on a greyscale copy that we use, manipulated, on a layer mask. This will allow us to use selective sharpening.
So, we make a copy of our background layer, use the ChannelMixer (Image menu) to make it monochrome (this offers the opportunity to optimise the image), and apply the Highpass filter to it, set to a low value that enhances the edges. Then we set the blendmode to one of the modes of the light group: overlay, soft or hard light etc. Various modes will give the idea of various sharpneses. Choose your own, and evt. you can use the opacity setting.

The Highpass filter can also be used to create a mask to work with, but there is another method for this so-called EdgeMask. The method can be found on various places on the Internet, but the authors usually startin a way I don't recommend.

Instead of choosing the channel with the best contrast, duplicating it and creating a mask from it, I prefer once again using the Channel Mixer because it offers the option to take the best from three worlds/channels. Very often, I found it difficult to chose between two channels. Of course, they can be combined with the calculate tool, but I find that this complicates the workflow without being really necessary.

So I prefer to start, as usual, with a duplicate of the background/layer. This I make monochrome with the Channel Mixer, after which I copy it to the clipboard (select all, copy to clipboard). I throw this layer away, create a new duplicate add a layer mask, make this visible with Alt-clicking on its icon and then past the grey image unto it. From now on, there are many options. The best one runs as follows (play with different settings of each filter):

Find Edges. This seems to be a logical step. But the mask will be inversed. So we need to inverse it.
Then comes the Median Filter. Great to soften edges on masks etc (try it on an angular selection!), it will now soften the shape of the created edges.
As seen in the very beginning, we need edges that are a bit thicker than the edge they will be applied to. In fact: our goal is to create soft white regions that will limit sharpening without being too sharp. So we will make the lines on the mask thicker with the Maximum filter (Other>Maximum) . This filter makes the whites thicker but it also pixelates them. To hide this, and to make shure the outlines of the lines/edges are blurred, we apply a bit of Gaussian Blur.

All we now have to do is apply an exaggerated Unsharp Mask to the copy of the image. The mask will take care that only the edges are sharpened whilst the continuous tones are protected. Another advantage is that you canuse the radius slides whilst looking at the image. No noise is generated, andeven oversharpening doesn't cause artifacts like a simple use of the Unsharp Mask would certainly do.

It is even possible to create an action for this. To summarise the steps (you have to fill in your settings of each filter using trial and error:

-duplicate background
-channel mixer monochrome
-go back in history
-create layer-mask
-find edges filter
-invert filter-median filter
-Maximum filter
-Gaussian blur-Unsharp Mask wit high settings.

That's it for now. I would appreciate it a lot that, if you have a good sharpening method (I omitted some on purpose), you would add it here. Also if you have some good settings of filters to share.

This ends, for now, this chautauqua. A next one will be on how to prepare for drawing and painting in Photoshop and some other tools.

I add a typical edgemask, and the image it is applied to (right-hand side. The left-hand side is not sharpened)
 
Wow! Quite a lot to think about, and a lot of great info. Thanks, Erik!!

I usually start in Lab mode, as Erik mentioned, It seems to work well most of the time, but I've printed out everything here.

So much to learn!
 
I woke up this morning (typical first line for blues lyrics), and I realised that I hadn't explained some of the filters I used. So here is the first update:

As can be seen in the two examples, the first one on a black rectangle on a white background, and the second one on noise (150% Gauusian, monochrome), each of the filters has a very specific effect. Median is not Gaussian Blur.

1/ Gaussian Blur blends pixel values. It uses for this the bell-shaped curve that was invented by the great mathematician Gauss,a curve that is also used to describe probabilities. In other words: in our example is takes a a sample of the pixels within a radius and blends these over a set number of pixels. This results in a blurring effect. Used in interface design, in combination with Levels to round corners, it is also a very practical filter for doing what it says: blurring.

2/ Median does not blend between pixels: it takes mean values. In our example it will, so as to say, look around itself in all directions, see what the mean value is, discarding exceptions and adapt itself to that. This it does for every pixel. A straight line stays straight because half of the pixles is black, and half of it is white. Corners are treated differently as there are more and more white pixels compared to black ones. Hence the rounding of corners. It does, however, produce stair-stepped effects as it does not anti-alias. For interface design, it can be handier that the above-mentioned method to round off corners as the rounding is easier to set. A bit of Gaussian blur afterwards hides the stairsteps.

3/ Highpass is completely different. As you can clearly see, it can be used to create edges at low settings. What it does is separate edges (differences in brightness values) from the rest. None-edges are turned into greys, and edges are mostly left intact.
Yet, it does not work wonders: when the edges are unclear, it isn't really capable of doing its job. Yet, even in that case, we can apply it to a copy of the background andset the blend mode to hard light to get a good enhacing of the edge contrast, resulting in the impression of a sharpened image.

The first image shows the difference between Gaussian Blur and Median applied to noise and a line pattern, and the second one shows the effects described above.
 
In the Smart Blur dialog, there is also a find edges option. It is completely unsuited for jpg as it tends to show the chessboard of pixel groups, and, even when maximised (maximum filter to make the white lines broader) and then blurred, it cannot surpass the FindEdges/Monochrome etc. method described above.

The custom filter can also be used for sharpening. But I don't think it"ll be used often. Just as an encore, you may fill in 5 in the central box, and -1 in the first boxes on the left and the right, above and below it. Set scale to 1.
 
Ditto Julie!.... [saywhat] so much to learn!

:righton: Great stuff Erik! I'm just hoping that it'll all sink in after a few more good "read-throughs" and some experimentation on my part.

[doh] Arggggggggh... time is the enemy, but I've saved everything (up until now) for off-line viewing. :)

Thanks for taking the time to detail to this extent! :}
 

Back
Top