Monday, August 4, 2014

Sharpening techniques for digital images

Here are a few digital sharpening techniques I have found/learned over time.  None (so far) are truly original to me, I just wanted to put them all in one place.  Some people have favorite techniques and I am no different, but I enjoy learning new methods.

I shoot raw only, but I generally do not do capture sharpening during raw conversion.  I usually find it better to wait for the very last step, particularly if I re-size an image for web display.  Capture sharpening tends to make re-sized images look "crunchy" to me.

One of the primary motivations for me to search out a variety of sharpening techniques is to make myself independent of any particular tool.  When Adobe changed Photoshop to a subscription model with Photoshop CC, I realized paying a monthly fee to use software makes no sense, for me.  I am not a pro and I don't make any money from photography.  It's a hobby.  A passion, an obsession, but not a business.  Up to that point, I mostly used "Smart Sharpen" in Photoshop (I started with version CS2).  It works well but it is proprietary to Photoshop.  My goal was to find a method that works just as well that I can use in any image editor, because some day, I will be forced to upgrade my hardware or OS and eventually, my version of Photoshop won't work.  There is also a strong possibility that I will move back to Linux in the near future.  Actually, I gave up Linux at home when I bought my first digital camera, because GIMP didn't (and still does not as of my writing) support 16-bits per color channel.  Photoshop seemed to be the best option at the time, and I got used to it. 

Motivation aside, I'll get to the list and details:

I prefer to perform all sharpening on a duplicate layer so that I can undo it at any time.


Basic sharpen
A number of tools have an option called "sharpen".  Sometimes, it has no parameters whatsoever.  You get what you get.  This is basic and rarely very good.


Unsharp Mask (USM)
This is the most common "advanced" sharpening technique, available in most image editors.  You can do two things with it... detail sharpening and local contrast enhancement.  If you overdo the settings, you can create unnatural halos around your subject.  It can also increase noise.  I haven't learned it well yet myself, because Photoshop's smart sharpen was so much easier to use.

The strength setting refers to the amount of contrast used at the areas being sharpened.

Radius controls how far out the sharpen effect extends.

Threshold refers to how much difference in needed between pixels before the effect is applied.  Using Threshold 0 means every part of the image gets the treatment.

For detail enhancement, many seem to use a starting point of 300% with 0.3 radius.  

For local contrast, try a low amount with a large radius.



Edge mask sharpening
This uses USM, with a mask, so that only the edges of the image get sharpened.  It requires the channels feature. I'm still looking for a way to do it without the channels, because not all image editors I've tried have channels built in.  I've seen this described in a couple of places, and while it is a bit complex and time-consuming, I think it has the potential to work better than Adobe's smart sharpen.


  1. Duplicate the layer you want to sharpen
  2. Switch from viewing Layers to viewing Channels
  3. Create a new channel and call it "edge sharpen"
  4. Select the entire image, and copy it (Ctrl-A, Ctrl-C)
  5. Select the "edge sharpen" channel and paste the image in.  It becomes B&W.
  6. Run edge detection on the edge sharpen channel
  7. Use Gaussian blur (small radius) on the channel
  8. Use levels to increase the contrast (adjust black and white point as needed to help redefine the edges).
  9. The next bit is where I'd like to have an easier way to convert this alpha channel to a layer mask.
  10. Use Load Selection, and invert the selection.
  11. Switch back to the layers view.  You'll see the areas with edges selected.
  12. Sharpen with USM.  Use a high amount (the selection hides the halos, which is key to this method), radius 0.5 to 1, threshold 0.



Highpass sharpen
This is one of my favorites, and once you get a feel for it, is very quick to do.  It can create halos if used with too-aggressive settings, so I keep it subtle.  Some image editors have this method built-in, so you don't need these steps, though the settings should be roughly the same.  


  1. Duplicate the layer you want to sharpen, and name it 'highpass'.
  2. Run the highpass filter on the duplicate layer.  Adjust the radius so the halos are not too strong. I usually use between 2 and 5 pixels.  For a full-size image, I start around 5 pixels, while for a reduced (web-size) image, I start closer to 2 pixels.
  3. Desaturate the high-pass layer (to avoid odd color shifts).
  4. Change the blending method of the highpass layer to 'overlay' and adjust the opacity.  I usually end up around 40%.  You can also use 'soft light' for a weaker effect, or 'hard light' for a stronger effect, depending on your taste.  Most image editors that offer layers and/or masks have those blending options.   As long as you save the image with your layers, the blending method and opacity are adjustable.



Bilateral sharpen
This method sharpens textures more than the edges, because the bilateral blur (surface blur in photoshop) leaves edges mostly intact.  The technique is similar to the highpass sharpen.  Not every editor has the surface blur feature.  The blur step is noticeably slower than other blurring methods.  Depending on your computer speed, you might want to go get coffee while it works.


  1. Duplicate the layer you want to sharpen, and name it "blur".
  2. Run the surface blur filter on the blur layer.  Start with radius around 6 pixels and threshold 15.
  3. Subtract the result from the original layer
  4. Copy the difference into a new layer (Ctrl + Shift + Alt + E)
  5. Blend the difference layer into the original using "linear dodge (add)" and adjust the opacity as desired.


Selective Sharpening
With any sharpening, and given an editor that can handle masks, you can create a mask to block out additional parts of the image you don't want sharpened.  


Other options

There are some good free raw converters, and some of them have sharpening options I've not seen anywhere else.  As I don't do capture sharpening, these are of limited use to me, but might be useful in someone's workflow.

RawTherapee has Unsharp Mask and Richardson-Lucy deconvolution methods.  R-L deconvolution is interesting and sharpens well, but adds quite of bit of noise if you use too much strength.  

Photivo uses Wiener sharpening by default, but also has Unsharp Mask and Highpass methods, as well as a couple others.  I have not learned how the Wiener filter works yet.



Links

Notes on sharpening
Thom Hogan's Sharpening 101