Ember Razement ________________________________ The Fine Art Photography of Malcolm Smith

 

NOISE CONTROL AND SHARPENING

PART D – EDGE MASKS

LINK TO LINK TO
PART A - Background Theory
PART B - Sharpening Tools Available
PART C - Some Other Useful Sharpening Tools and Pointers
PART E - Real World Sharpening Examples

Edge Masks are a very important part of sharpening and their construction is not well understood so a separate section has been put together to address this topic.

Masks are the rectangles that sometimes appear to the right of the layer thumbnail in the Layers Palette and are actually a form of Channel (like R, G and B but are called alpha channels) you can also see them in the Channels Palette.  Some Masks you have to add and some automatically appear (eg with a Curve Adjustment Layer).  The function of the mask is that where it is white it allows the corresponding portion of the layer image to be seen but where the mask is black the layer image is masked and is not seen (ie you see the underlying layers).  As the mask grays and eventually blacks out progressively less of the masked Layer is seen.

By clicking on the Layer Mask thumbnail making it active (double line around the thumbnail) you can paint on the mask (with the brush over the main screen image) or even apply Photoshop tools (eg Blur) to the mask and see the effect in the main window.  To see the Mask in the Channels Palette select the Channels tab and then by clicking on the mask thumbnail here Photoshop displays the mask itself in the main window (rather than the result of the mask on the layer image).

Masks are an extremely useful feature – for example a layer can be sharpened and then have a black mask added and the sharpened layer won’t be seen (remember a black mask is a “hide all” mask).  But if you paint on the black mask (first make the mask thumbnail active) with a white brush you can allow selected bits to show and fine control this with opacity of the white brush..

Edge Mask

Edge Mask"

Edge masks are mostly hide all black but with white lines where image edges occur and  they can readily be constructed using some of the tools available in Photoshop.  Using an edge mask enables only the sharpened edges of an image to be seen and not, say for example, the broad areas of skin where we don’t want any enhancement of skin texture.  Some blurring and Levels Adjustment can be used to adjust the width of the lines and their strength (whiteness).  In the illustration above the Image Edge Mask has a white line wherever there is an edge in the Original Image – for example around the hole in the wall.  There are also white (or light grey) lines around changes in texture of which there is a lot in this image.

To create an edge mask:

  • Assume we have an image at the top of the Layers Palette stack (the layer to be sharpened and have the new mask added).
  • Open the Channels Palette and create a new alpha channel with good contrast along the desired edges (either by duplicating the red or green channel (usually not the blue channel as it is often noisier) or by combining channels with Calculations [*] (with Blend Mode set to Pin Light Blending Mode etc.).
  • Blur the new alpha channel a bit.
  • Use Photoshop Find Edges filter to find the edges of this new channel (Filter>Stylize>Find_Edges)
  • Adjust the contrast of the edges with Image>Adjustments>Levels
  • Invert the channel so that the edges are white for a sharpening mask (don’t invert for a noise reduction or smoothing mask) (<CONTROL I>)
  • Spread the lines a bit with Gaussian Blur to adjust the mask edge width.
  • Adjust the contrast again with Levels (or Curves) – The closer the edges are to white the greater the sharpening will be seen and the closer to black the non edges the greater the protection against unwanted sharpening of noise or texture being seen in these areas.
  • At this stage the mask can be fine tuned with a white or dark brush to control sub areas.  For example an edge can be made less sharp by painting over the white line with a low opacity black brush to make it a gray,  Areas where texture shows up as white but which is not to be sharpened can be painted out with black.
  • With the channel selected in the Channels Palette click the Load Selection button at the bottom of the channels palette (the selection will show up as “marching ants”)
  • Return to the Layers Palette and select the Layer the mask is to be applied to and click the Add Layer Mask button.
  • You can delete the alpha channel used to create the mask
  • Sharpen the Layer using one of the sharpening tools (you will see the whole image sharpened in the sharpening dialog preview) but the layer edge mask will only allow the sharpening of the edges to be seen.

[*]   Calculations is a method of Blending channels together to form a new channel.  It is found in Image> Calculations.  The Calculations dialog box enables you to specify two channels (and the Layers they are from) and the Blend Mode to be used for combining them.  Blend modes consist of all the standard Photoshop layer Blend modes plus Add and Subtract.  A new channel is usually created with the result.

Final tuning is to blur and contrast adjust the mask if required.  Now if the layer is sharpened only the bits where the Layer Mask has white lines will be seen.

Remember a protect edges smoothing mask is the inverse of the above edge sharpening mask – ie don’t Invert in the mask creation steps for a smoothing mask.

Let us start off by constructing very quickly two masks with different blur radius from a suitable image to determine some of the finer points in mask construction. See below:

Edge Mask Blurring

Edge Masks with Different Blur"

The masks were very simply constructed by the following process:

  • Copy the Green Channel to use for the Mask construction.
  • Blur the copy of the Green Channel (1 Pixel blur in the top mask)
  • Run Find Edges
  • Levels adjustment (using white pointer only)
  • Invert the mask
  • Run blur again (1 Pixel blur in the top mask)
  • Adjust Levels again (using white pointer only)

First let us compare the masks as above. The two masks are very noticeably different but one may not necessarily be better than the other.  For example on the more heavily blurred mask the wider continuous white left on the hair will most likely allow more of the hair sharpening to be seen than the more defined narrower white mask lines but the wider mask lines over the nose/chin/shoulder may allow undesirable sharpened skin texture to be seen.  Heavier blurring may eliminate low level intensity edges which may be undesirable.  Overall however the 1 pixel blur mask would probably allow more of the hair sharpening to be seen.

Another aspect we should consider is the skin texture on the chin and the noise in the Blue background.  No attempt has been made to address these problems when the masks were constructed which can both be largely corrected by adjusting the grey (Gamma) pointer in the Levels Adjustments and in the amount of blur.  In addition the chin texture on the masks could also be quickly painted out on the mask with a black brush.

I decided to do some tests to look at how a mask could be optimally constructed.  Using the image above I zoomed in to the barely perceived single strands of hair.  Many of these strands are very blurry and faint (as we would expect from the Anti-Alias filter blur as predicted by the Shannon Nyquist Sampling Theorem) but they look like they are about one pixel wide – at large magnification the resulting mask over these lines was very strange looking and I have reproduced the effect below.

Find Edges

Find Edges on Different Width Lines"

  • The unblurred find edges of the 1 pixel wide line are not over the line itself.
  • Except for the 1 pixel wide line the raw found edges are all two pixels wide. (find edges are 1 pixel wide in the case of the 1 pixel wide line)
  • Except for the 1 pixel wide line the found edge is one pixel above and below the edge (a total of two pixels wide).  Ie it straddles the actual edge.
  • Except for the 2 pixel wide line there is white space between the found edges

Find Surface Edges

Find Edges Surface Edges

The example above does the test with areas of continuous tone giving again 2 pixel wide found edges (one pixel above and one below the edge).

Edge Blurring

Found Edges and Subsequent Blurring

The above test considers when and how often the Blur should be applied.  The first column shows the raw found edges, the second the found edges followed by a 1 pixel blur and finally in the last column the original lines are first given a 1 pixel blur then find edges and then a further 1 pixel blur.  Apart from further Levels adjustment the last example with the blur applied twice both before and after the find edges looks to give a better mask.

I did some tests to see if the intensities of the found edges could be correlated with the intensities of the areas on either side (see image below) but was not able to gain any insight.  However the found edges are at different intensities and will usually require strengthening.

Intensity of Found Edges

Intensity of Found Edges

So what do we need to consider in constructing a mask:

  • The see all mask edges should ideally approach white where the sharpening is to be most pronounced.
  • The white see all mask edges need to be wide enough to allow the sharpening halos on the sharpened images edges to be mostly seen.
  • The mask should hide any sharpening of noise or texture that we don’t want emphasized.  That means the mask should approach black (hide all) where there is poor skin texture, noise in flat areas such as skies and texture where the image should ideally be flat.
  • From other experiments (different find edge algorithms and composite masking) I believe that using edge masks to control the sharpen halo widths (choking the halos) is NOT going to be very useful as is suggested in some texts.
  • Sometimes because of large differences across an edge the light and dark sharpening halos are too light or too dark (usually the former).  To tone them down a bit paint over the corresponding edge mask line with a low opacity black brush to gray out the edge mask in that area
Go to TOPTOP

LINK TO LINK TO
PART A - Background Theory
PART B - Sharpening Tools Available
PART C - Some Other Useful Sharpening Tools and Pointers
PART E - Real World Sharpening Examples


>