enfuse(1)

NAME
enfuse - poor man's HDR

SYNOPSIS
enfuse [OPTIONS] -o OUTPUT INPUT...

DESCRIPTION
Enfuse merges overlapping images using the Mertens-Kautz-Van Reeth exposure fusion algorithm. 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 DOF 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 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. Enfuse can use standard deviation or Laplacian magnitude or a blend of both as local contrast measure. 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). 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".

COMMON OPTIONS

-h  Print information on the available options.

-l LEVELS
    Use exactly this many LEVELS for pyramid blending. This trades off quality of results for faster execution time and lower memory usage. The default is to use as many levels as possible given the size of the overlap region. Enfuse may still use a smaller number of levels if the geometry of the images demands it.

-o OUTPUT-FILE
    Required option. Specify the name of the OUTPUT-FILE.

-v  Verbose output.

-w  Blend around the -180/+180 degrees boundary. Useful for full-360 degrees panoramas. Enfuse currently does not blend the zenith or the nadir, so you may still see some seams in these areas.

--compression=COMP
    Write a compressed output file. Valid values for COMP are NONE, PACKBITS, LZW and DEFLATE for TIFF files, and numbers from 0-100 for JPEG files.

-z  Use LZW compression for the output image.

EXTENDED OPTIONS

-b BLOCKSIZE
    Set the BLOCKSIZE in Kilobytes for Enfuse's image cache. This is the amount of data that Enfuse will move to and from the disk in one go. The default is 2048KB, which should be ok for most systems.

-c  Use the CIECAM02 color appearance model for blending colors. Your input TIFF files should have embedded ICC profiles. If no ICC profile is present, Enfuse will assume that image uses the sRGB color space. The difference between using this option and Enfuse's default color blending algorithm is very slight, and will be most noticeable when you need to blend areas of different primary colors together.

-g  Gimp (ver. < 2) and Cinepaint exhibit unusual behavior when loading images with unassociated alpha channels. Use the -g flag to work around this. With this flag Enfuse will create the output image with the associated alpha tag set, even though the image is really unassociated alpha.

-f WIDTHxHEIGHT[+xXOFFSET+yYOFFSET]
    Set the size of the output image manually. This is useful when the input images are cropped TIFF files, such as those produced by Nona.

-m CACHESIZE
    Set the CACHESIZE in megabytes of Enfuse's image cache. This is the amount of memory Enfuse will use for storing image data before swapping to disk. The default is 1024MB.

FUSION OPTIONS

--wExposure=WEIGHT
    Sets the relative WEIGHT of the well-exposedness criteria. Increasing this weight relative to the others will make well-exposed pixels contribute more to the final output. Valid range: 0 <= WEIGHT <= 1.

--wMu=MEAN
    Set the mean (center) of the Gaussian exposure weight curve. Default: 0.5, this gives pixels with value 128 (when using 8 bit images) the highest weight. Valid range: 0 <= MEAN <= 1.

--wSigma=STDDEV
    Standard deviation STDDEV of the Gaussian exposure weight curve. Default: 0.2. Low numbers give less weight to pixels that are far from --wMu. Valid range: 0 <= STDDEV <= 10.

--wSaturation=WEIGHT
    Sets the relative weight of high-saturation pixels. Increasing this weight makes pixels with high saturation contribute more to the final output. Valid range: 0 <= WEIGHT <= 1.

--wContrast=WEIGHT
    Sets the relative weight of high-contrast pixels. Valid range: 0 <= WEIGHT <= 1.

--HardMask
    Force hard blend masks on the finest scale. This avoids averaging of fine details (only), at the expense of increasing the noise. This improves the sharpness of focus stacks considerably.

EXPERT OPTIONS

--ContrastWindowSize=SIZE
    Window SIZE for local contrast analysis. Values larger than 5 might result in a blurry composite and increased computation times. Values in the range of 3 to 5 have given good results on focus stacks. Valid range: SIZE >= 3.

--GrayProjector=PROJ
    Use gray projector PROJ for conversion of RGB-images to grayscale masks. Valid values for PROJ are:
    "average" - Average red, green, and blue channel with equal weights. This is the default and it often is a good projector for gamma=1 data. Y = (R + G + B) / 3
    "l-star" - Use the L*-channel of the L*a*b*-conversion of the image as its grayscale representation. This is a useful projector for gamma=1 data. It reveals minute contrast variations even in the shadows and the highlights. This projector is computationally expensive.
    "lightness" - Compute the lightness of each RGB-pixel as in an HSL-conversion of the image. Y = (max(R, G, B) + min(R, G, B)) / 2
    "value" - Take the Value-channel of the HSV-conversion of the image. Y = max(R, G, B)
    "luminance" - Use the weighted average of the RGB pixel's channels as defined by CIE and the JPEG standard. Y = 0.30 * R + 0.59 * G + 0.11 * B
    "channel-mixer:RED-WEIGHT:GREEN-WEIGHT:BLUE-WEIGHT" - Weight the channels as given. Y = RED-WEIGHT * R + GREEN-WEIGHT * G + BLUE-WEIGHT * B The weights are automatically normalized to one, so
        --GrayProjector=channel-mixer:0.25:0.5:0.25
        --GrayProjector=channel-mixer:1:2:1
        --GrayProjector=channel-mixer:25:50:25
    all define the same mixer configuration. The three weights RED-WEIGHT, GREEN-WEIGHT, and BLUE-WEIGHT define the relative weight of the respective color channel. The sum of all weights is normalized to one. Default: average.

--EdgeScale=EDGESCALE[:LCESCALE[:LCEFACTOR]]
    A non-zero value for EDGESCALE switches on the Laplacian-of-Gaussian (LoG) edge detection algorithm. EDGESCALE is the radius of the Gaussian used in the search for edges. Default: 0 pixels. A positive LCESCALE turns on local contrast enhancement (LCE) prior to the LoG edge detection. LCESCALE is the radius of the Gaussian used in the enhancement step, LCEFACTOR is the weight factor ("strength"). enhanced := (1 + LCEFACTOR) * original - LCEFACTOR * GaussianSmooth(original, LCESCALE) LCESCALE defaults to 0 pixels and LCEFACTOR defaults to 0. Append "%" to LCESCALE to specify the radius as a precentage of EDGESCALE. Append "%" to LCEFACTOR to specify the weight as a percentage.

--MinCurvature
    Define the minimum curvature for the LoG edge detection. Default: 0. Append a "%" to specify the minimum curvature relative to maximum pixel value in the source image (e.g. 255 or 65535). A positive value lets Enfuse use the local contrast data (--ContrastWindowSize) for curvatures less than MC and LoG data for values above it. A negative value truncates all curvatures less than -MC to zero. Values above MC are left unchanged. This effectively suppresses weak edges.

EXAMPLES
To blend an exposure stack given in files exposure_01.tif, exposure_02.tif, ... enfuse -o result.tif exposure_*.tif To blend a focus stack to form an extended depth of field image set the contrast weight to 1 and use very low values for exposure and saturation criteria to get meaningful results in low contrast areas. enfuse -o result.tif --wExposure=0.001 --wSaturation=0.001 --wContrast=1 --HardMask focus_*.tif For additional information on blending focus stacks, including usage of the expert options, refer to the enfuse-focus-stacking texinfo file.

AUTHORS
Andrew Mihal <acmihal@users.sourceforge.net>. Thanks to Simon Andriot and Pablo Joubert for suggesting the Mertens-Kautz-Van Reeth technique and the name "Enfuse". The contrast criteria has been added by Pablo d'Angelo <dangelo@users.sourceforge.net> Dr. Christoph L. Spiel added the gray projectors and the LoG-based edge detection.