Contrast Blending

From PanoTools.org Wiki
Jump to navigation Jump to search

A technique to blend several exposure bracketed images in one image in order to achieve a higher Dynamic range.

There are several more or less automatic approaches realized in commercial programs or plugins like Photomatix, FDRTools and Fred Miranda's DRI, the free photoshop actions from Erik Krause, or exposure-blend, a script suite for GIMP.

Currently the best results (even if compared with HDR tone mapping algorithms) are provided by enfuse, an application that combines contrast blending with multi resolution spline blending (as known from enblend).

However, contrast blending can be done completely 'by hand' as described on Michael Reichmann's site - http://www.luminous-landscape.com/tutorials/digital-blending.shtml or like described in A simple approach to HDR-blending

Here is a user comment on Michael's technique:

"I use the second technique, the Layer Mask approach, and have found that it works quickly and easily, while still leaving much room for tweaking as necessary. The only change I've made in my approach is at the end where I work in Levels instead of curves. I find that sliding the mid-tones to the right helps make the resulting image look more realistic. In some cases, you just have to play around with all three sliders until you get a good blend. I also will reduce the opacity of the top layer down to about 85% as well."

Here is a fragment of an ImageMagick script by Peter Gawthrop that can be used to automate contrast blending:

 normal=$1
 under=$2
 over=$3
 
 ### Merge under exposure
 ## Mask for under exposed
 convert -type Grayscale $under _mask.tif
 ## Masked version
 composite  -compose CopyOpacity _mask.tif $under _under_masked.tif
 ## Merge with background
 composite  -compose Darken _under_masked.tif $normal _composite.tif
 
 ### Merge over exposure
 ## Mask for over exposed
 convert -negate -type Grayscale $over _mask.tif
 ## Masked version
 composite -compose CopyOpacity _mask.tif $over _over_masked.tif
 ## Merge with background
 composite -compose Lighten _over_masked.tif _composite.tif merged.tif

Based directly and more simply on the directions at luminous landscape, here's an imagemagick snippet that works from just two images, one underexposed ($DARK) and one overexposed ($LIGHT).

 # first, we need a grayscale, blurred copy of the light image
 LIGHTBLUR=$LIGHT.blurtemp.$$
 convert -type GrayScale -blur 40x20 $LIGHT $LIGHTBLUR
 # then we stack!
 composite $DARK $LIGHT $LIGHTBLUR -compose atop $OUTPUT
 # cleanup
 rm $LIGHTBLUR

The other way to use bracketed exposures is to assemble them into a single HDR image. This can be done with free HDRShop, Photoshop, GIMP (Tutorial: [1]), PFScalibration or the FDRExposer.

The problem here is that the HDR image must be compressed with tone mapping to reveal the complete contrast range on a computer monitor.

This was a major problem for HDRShop since only gamma adjustment or (later) the Reinhard tone mapping plugin existed. It is still a problem for Photoshop CS2, but here the HDR images can be converted to a 16 or 8 bit per channel image with more possibilities. Brian Greenstone wrote a nice tutorial about that: [2]

Meanwhile two Photoshop CS2 plugins are available that deal with that problem: Photomatix and FDRCompressor. See HDR compression for a comparison.

For Linux there are several open source command line tools available as part of pfstmo that implement different tone mapping algorithms.

There are several panoramic tools that can handle HDR images: enblend, hugin and nona can work with HDR images of different flavours. PTViewer 3.1 can display HDR images with adaptive dynamic range directly.

Mark Fink www.northernlight.net