Difference between revisions of "Enfuse"

From PanoTools.org Wiki
Jump to navigation Jump to search
(Added help page)
Line 5: Line 5:
  
 
enfuse is currently in beta and available with the development version of [[enblend]].
 
enfuse is currently in beta and available with the development version of [[enblend]].
 +
 +
== Description ==
 +
Enfuse merges overlapping images using the Mertens-Kautz-Van Reeth exposure fusion algorithm. This is a quick way to produce 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 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 standart 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 focussed 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).
 +
 +
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".
 +
  
 
== Usage ==
 
== Usage ==
<pre>
+
The usage below refers to the CVS version of the 21 Dec 2007.
Usage: enfuse [options] -o OUTPUT INPUTS
+
 
 +
=== Common options ===
 +
 
 +
-h
 +
    Print information on the available options.
 +
-l num
 +
    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. Specify the name of the output file.
 +
-v
 +
    Verbose output.
 +
-w
 +
    Blend around the -180/+180 boundary. Useful for full-360 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 are LZW and DEFLATE for TIFF files, and numbers from 0-100 for JPEG files.
 +
 
 +
 +
=== Extended options ===
 +
 
 +
-b kilobytes
 +
    Set the block size 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 2 MiB which should be good 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 behaviors 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
 +
    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 megabytes
 +
    Set the size of Enblend's image cache. This is the amount of memory Enblend will use for storing image data before swapping to disk. The default is 1 GiB.
 +
 
 +
 +
=== Fusion options ===
  
Common options:
+
--wExposure
-h                Print this help message
+
    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.
-l number        Number of levels to use (1 to 29)
+
--wSaturation
-o filename      Write output to file
+
    Sets the relative weight of high-saturation pixels. Increasing this weight makes pixels with high saturation contribute more to the final output.  
-v                Verbose
+
--wContrast
-w                Blend across -180/+180 boundary
+
    Sets the relative weight of high-contrast pixels.
--compression=COMP Set compression of the output image.
 
                  Valid values for compression are:
 
                  For TIFF files: LZW, DEFLATE
 
                  For JPEG files: 0-100
 
  
Extended options:
+
-b kilobytes      Image cache block size (default=2MiB)
+
=== Expert options ===
-c                Use CIECAM02 to blend colors
 
-g                Associated alpha hack for Gimp (ver. < 2) and
 
                  Cinepaint
 
-f WIDTHxHEIGHT+x0+y0  Manually set the size and position of the
 
                        output image.
 
                        Useful for cropped and shifted input TIFF
 
                        images, such as those produced by Nona.
 
  
-m megabytes      Use this much memory before going to disk
+
--ContrastWindowSize
                  (default=1GiB)
+
    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.
  
Fusion options:
+
--HardMask
--wExposure      Weight given to well-exposed pixels.
+
    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.
--wContrast      Weight given to high-contrast pixels
 
                  (unimplemented).
 
--wSaturation    Weight given to highly-saturated pixels
 
                  (unimplemented).  
 
</pre>
 
  
 
== See also ==
 
== See also ==
 
* [http://www.nabble.com/A-christmas-present-td14438390.html Announcement on Panotools-NG]
 
* [http://www.nabble.com/A-christmas-present-td14438390.html Announcement on Panotools-NG]

Revision as of 11:53, 21 December 2007

enfuse is a command-line program used to merge different exposures of the same scene to produce an image that looks very much like a tonemapped image (without the halos) but requires no creation of an HDR image. Therefore it is much simpler to use and allows the creation of very large multiple exposure panoramas.

enfuse is based on a paper by Tom Mertens, Jan Kautz and Frank Van Reeth. The implementationwas done by Andrew Mihal (developer of enblend) - http://research.edm.uhasselt.be/~tmertens/exposure_fusion/

enfuse is currently in beta and available with the development version of enblend.

Description

Enfuse merges overlapping images using the Mertens-Kautz-Van Reeth exposure fusion algorithm. This is a quick way to produce 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 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 standart 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 focussed 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).

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".


Usage

The usage below refers to the CVS version of the 21 Dec 2007.

Common options

-h

   Print information on the available options. 

-l num

   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. Specify the name of the output file. 

-v

   Verbose output. 

-w

   Blend around the -180/+180 boundary. Useful for full-360 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 are LZW and DEFLATE for TIFF files, and numbers from 0-100 for JPEG files.


Extended options

-b kilobytes

   Set the block size 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 2 MiB which should be good 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 behaviors 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

   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 megabytes

   Set the size of Enblend's image cache. This is the amount of memory Enblend will use for storing image data before swapping to disk. The default is 1 GiB.


Fusion options

--wExposure

   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. 

--wSaturation

   Sets the relative weight of high-saturation pixels. Increasing this weight makes pixels with high saturation contribute more to the final output. 

--wContrast

   Sets the relative weight of high-contrast pixels.


Expert options

--ContrastWindowSize

   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.

--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.

See also