Tuesday, 14 April 2009

Advanced Tone-mapping with GIMP

Most compact photo-cameras cannot handle contrast scenes properly. Here a plugin for GIMP (GNU Image Manipulation Program - a popular open-source alternative for PhotoShop, available for Windows, Linux and Mac OS), called Advanced Tone Mapping comes to the rescue. The script processes a single image, unlike High Dynamic Range technique, which requires at least two shots, increasing its local contrast and reducing total one. In a plain language it makes dark parts of the image lighter and bright parts darker. Obviously, the picture should not be overexposed, because nothing can get any information from the white sky, as it is completely lost.

Let start with the example.



I took this photo at South Head, the Kaipara Harbour entrance, not far from Auckland, New Zealand. In order to preserve the sky I set up exposure compensation to -2/3, so the whole picture became too dark. The sand is dark indeed, as it contains black volcanic ash, but pieces of broken sandstone on the foreground should be same colour like the background cliff.

One disadvantage of the script is that it takes a while to process a picture and there is no preview available, so nobody can tell you what values should be set as the parameters (four ones in total). Thus the idea of the explained technique is to over-process the picture, then to reduce the effect to get the desired result. So I opened the picture in GIMP, clicked Filters - Enchance - Advanced Tone Mapping and set the parameters as follows:
  • Gauss. Blur: 10% - the default value
  • Opacity of blurred layer - 100 or near
  • Opacity of merged layer - 100 or near
  • Copies of merged layer - 3
The result is shown below.



I definitely got what I wanted, but the result is far from ideal. The colours are un-real, and halos are strong and clearly visible. This new image appeared as a second layer above the original image, and this is very handy, as what I have to do now is just to change some parameters of this new layer.

So I switched to the Channels, Paths, Undo, Layers - ... dialog and selected Layers tab. The new layer is called tmapd: with some numbers, it should be already selected. I changed the layer mode to Value (the last in the list) and adjusted its opacity until I considered the result as satisfactory; the final opacity value for this image was about 60%. This is the interactive process and the changes are reflected on the image (almost :) immediately.



As you can see the clouds became more impressive, the background is now brighter; there is still some halo above the forest, but it is not so obvious.

This technique increases the noise level, especially in brighter parts of the image. This is because they contain less information, higher local contrast means small variations of brightness becomes more visible; it usually affects the blue sky. One can try to improve this by applying another plugin - GREYCstoration to the resulting and flattened image.

2 comments:

Abhilash Kumar said...

Hi,

Not wanting to spend money on a tone mapping application and also the fact that my primary OS is linux, I tried 3 free ones that I could get my hands on.

My results are here: http://hitchedhiker.com/2009/07/05/tone-mapping-in-gimp/

Unknown said...

Hi Abhilash,
Thank you for your comment. I have also tried Photomatix and gtpfsgui. It is quite hard to set up the tone-mapping parameters to get the desired result, so I usually end up with more advanced technique, when an over-processed tone-mapped image is blended somehow either with the original picture or with another tone-mapped one. This gives the ability to control easily how much tone-mapping affects the resulting image.