Archive

Author Archive

Enhancing highlight-areas in digital photos

March 29th, 2009

This is a technique I use to eliminate the colour-banding that often occurs around highlights in digital photos. It requires that you are shooting RAW files, rather than JPEGs. The images below all link to larger versions, so if you’ve no idea what I’m talking about, just open the first and last images in different browser windows/tabs and flip back and forth between them to see the effect of the technique described below.

The Problem

The screenshot below shows a detail from a photo with no adjustments applied:

Base Image

Base image

There is unnatural banding of oranges and yellows around the highlights on the arms and hands, and on the top of the cake and the dessert in the foreground. This banding is caused by channel-clipping, skip to the next heading for the solution or read on for the in-depth explanation of the problem:

  • In the white highlights, the red, green and blue channels are clipped at full intensity. In reality the candle-flames were orange-ish yellow, not white, but since we’re dealing with a much nore limited dynamic range it makes sense to render (comparatively) very bright objects as white.
  • On surfaces a little further out from the candles, the intensity of the blue channel starts to drop away. The red and green are still more intense than we can display within our limited dynamic range, so they’re still clipped to full intensity. With the blue channel dropping away, everything starts to turn yellow.
  • A little further out, the green channel starts to drop away but the red level is still brighter than we can handle. With the blue mostly gone and the green heading downhill we get a big slab of orange.
  • Eventually we reach surfaces so far from the flame that the red channel starts dropping within our displayable range, and at that point the colour is back in balance.

The Solution

It turns out that digital camera sensors capture a much greater dynamic range than we usually see in the final image, the conversion software takes a slice of that range and maps it to the final pixel values. That means that even when the red channel is clipped for a particular pixel, the raw data from the sensor may not be clipped at all. So, how do we get to see all that unclipped data? Simple, just use negative exposure compensation (turn on the overexposure indicator then decrease exposure until there are no areas indicated):

Darkened Image

Darkened image

We can see the missing detail now, but everything else has gone dark. The important thing is that only the very brightest subjects the sensor recorded are now mapped to the maximum channel values in the final image. We can’t push the exposure compensation back up to lighten the image, that only gets us back where we started, so we need to use the base curve:

Fixed, but with low contrast

Fixed, but with low contrast

This curve leaves the white-point alone (it still touches the top-right corner of the grid) so it’s still mapping only the sensor’s brightest values to the maximum channel values in the output (I’ve turned overexposure indication on, so you can see that only the centres of the flames are overexposed), but it lightens everything in-between, bringing it back up to around the level of the original image. Cramming in that extra bit of dynamic-range tends to reduce contrast a small amount in other areas of the image, I find that putting a slight concave in the first segment of the above curve helps to compensate:

Final image, with contrast restored

Final image, with contrast restored

You’ll need to tweak the other control points to maintain the overall brightness and ensure the curve touches at the top-right corner as I have above, then you’re done. The banding is gone, instead there are smooth transitions from highlights to normal exposure. One side effect is an apparent lightening and desaturation of the highlight areas (in particular compare the dessert at the bottom of the frame) – it’s not a bad thing, in fact it usually looks vastly better, but it’s worth being aware of.

I’ve used UFRaw for this demonstration, but the same techniques should work for just about any RAW converter. In-fact I’m sure some converters are already offering built-in functionality similar to this, or will do before long.

Post Processing, Technical , , , , , , ,