Open-source Photography: Image Blending
by Peter Gawthrop, LRPS
Image Sunset_01 Image Sunset_02
Image Sunset_03 Image Sunset_04
Image Sunset_05 Image Sunset_06
Figure 1. Bracketed images

Image Sunset_enfused
Figure 2. Fused image

Cameras are not perfect: two defects are:

As discussed in earlier DIG articles, one approach to the first problem is to take a sequence of bracketed exposures and use HDR (High Dynamic Range) methods and tone-mapping to give a single well exposed image from the bracketed images. An alternative approach when only three images are used is exposure blending using grey-scale masks.

A recent paper by Tom Mertens, Jan Kautz and Frank Van Reeth ``Exposure Fusion'' (see the link under enfuse below) describes a new method which solves both problems. In brief, the method selects ``good'' pixels from each image according to three factors:

The images are then blended to produce a composite image containing the best pixels. The theory has been turned into the enfuse software.

The 6 bracketed images of Figure 1 where taken with a Canon EOS 5D with 15mm Fisheye lens at f16 and shutter speeds of 1/4000, 1/1000, 1/250, 1/60, 1/15, and 1/4 using a tripod. None of the images is any good by itself. Putting them though enfuse gives Figure 2; this result is as good as any I have obtained using HDR methods and is much faster- just a few seconds of processing.

Image Woodstock_01
Image Woodstock_02
Image Woodstock_03
Figure 3. Bracketed images
Image Woodstock_enfused
Figure 4. Fused image

As discussed in my previous article (Digit 36), the creation of spherical panoramas requires exposure blending; for this reason the panoramic software hugin now incorporates enfuse. Because hugin can also align images, it can be used to fuse hand-held bracketed shots. Figure 3 shows three bracketed exposures taken with a hand-held Canon 5D with a EF24-105mm f/4L IS USM lens used at 105mm. The first (average) exposure lacks detail in the white cloud and in the dark shadow; the second (2 stops under) exposure has a nice cloud and the third (2 stops over) has detail in the shadow. They can be aligned and fused within hugin by using the following steps:

  1. Start hugin and click on the ``Images'' tab and then click on the ``Add individual images'' button and select the three images. Click on the disk icon and save your work so far.
  2. In this case, a standard lens was used so go straight to to the ``Control points'' tab.
  3. In the ``Control points window'' there are two windows which will both initially show the first image. Use the pull down menu on the second window to select the second (darker) image. Click onto a well-defined point (for example a house window) in the left-hand image and then onto the corresponding point in the right-hand window; use the right-hand mouse button to save the point. Repeat for a further two or three well-spaced points.
  4. Repeat step 3 with the dark and light and then with the light and normal images.
  5. Click on the ``Optimizer'' tab and click ``Optimize now!'' This aligns the three images ready for fusing.
  6. Click on the ``Stitcher'' tab. As a normal lens was used, select ``Rectilinear'' as the projection. Click ``Calculate optimal size'' to get the full resolution result. Under output select ``Blended panorama (enfuse)'' and deselect everything else.
  7. Click on ``Save project and stitch''; choose an appropriate name for the result - hugin then used enfuse to create the final result from the aligned images. This is shown in Figure 4.
The image has ragged edges where the three images do not line up use your favourite image editor to crop.

Image Tulip_01
Image Tulip_02
Image Tulip_03
Figure 5. Bracketed images

Image Tulip_enfused
Figure 6. Fused image

But enfuse can do more than exposure blending; the fact that it uses contrast as a fusion criterion means that images can be blended to achieve enhanced depth of field. Figure 5 shows two of three images taken in natural lighting with a Canon EOS 5D with a 100mm macro lens at f20 and a shutter speed of 0.3. The first image was manually focused on the petal tip and the second on the inside. Thus the first image is sharp at the tip but the stamen is blurred whereas the second image is blurred at the tip but the stamen is sharp.

These images can be fused using hugin in the same way as for Figure 4; but with two difference arising from the differing fields of view:

  1. Before optimisation, choose the ``Camera and lens'' tab. Click on the second image, select new lens and click on ``Load EXIF''; repeat for the third image.
  2. In the optimisation stage, select ``Positions and view'' on the pull-down ``Optimize'' menu. Clicking ``Optimize now!'' now works out the field of view of each image.

The result of applying this method to aligned images is given in Figure 6; the image appears to have a larger depth of field in that all parts of the petal and stamen are now in focus.

Further information is available on the web:

About this document ...

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -no_navigation -local_icons -split 0 -address paper

The translation was initiated by user on 2008-04-05