You're seeing a degraded version of this site because the site's layout requires JavaScript. Please activate JavaScript and reload this page.

Algorithm Details

By Andrew Mihal, 11 February 2008


Enfuse merges overlapping images using the Mertens-Kautz-Van Reeth exposure fusion algorithm (conference paper PDF). This is a quick way to blend differently exposed images into a nice output image, without producing intermediate HDR images that are then tonemapped to a viewable image. This simplified process often works much better than the currently known tonemapping algorithms.

Enfuse can also be used to build extended depth-of-field images, by blending a focus stack.

The basic idea is that pixels in the input images are weighted according to qualities such as proper exposure, good contrast, and high saturation. These weights determine how much a given pixel will contribute to the final image. A Burt & Adelson multiresolution spline blender is used to combine the images according to the weights. The multiresolution blending ensures that transitions between regions where different images contribute more heavily are difficult to see.

Enfuse uses three different criteria to judge the quality of a pixel: Exposure, saturation, and contrast. The exposure criteria favors pixels with luminance close to the middle of the range. These pixels are considered better-exposed than those with high or low luminance levels. The saturation criteria favors highly-saturated pixels. The contrast criteria favors high-contrast pixels. The local gray or color value standard deviation is used as a contrast measure. The Mertens-Kautz-Van Reeth paper suggest using a Laplacian filter, but the standard deviation produces much better results for differently-focused images.

You can adjust how much importance is given to each criteria by setting the weight parameters on the command line. For example, if you set --wExposure=1.0 and --wSaturation=0.5, Enfuse will favor well-exposed pixels over highly-saturated pixels when blending the source images. The impact of these parameters on the final result will not always be clear. The quality of the result is subject to your artistic interpretation. Playing with the weights may or may not give you a more pleasing result. I encourage you to experiment (perhaps using downsized images for speed). Note that it is the ratio between these settings that is important, not the absolute values. If you set 0.5 for all of the weights, it is the same as if you set 1.0 for all the weights. Everything has the same weight in both cases. If you set one weight to a value larger than the others, then that criteria will be favored over the others.

Enfuse expects each input image to have an alpha channel. By setting the alpha values of pixels to zero, users can manually remove those pixels from consideration when blending. If an input image lacks an alpha channel, Enfuse will print a warning and continue assuming all pixels should contribute to the final output. Any alpha value other than zero is interpreted as "this pixel should contribute to the final image".


[1] T. Mertens, J. Kautz and F. Van Reeth. "Exposure Fusion". Proceedings of Pacific Graphics 2007.