# Enblend reference manual

This manual is for Enblend (version 3.2-cvs, Thu Sep 25 07:35:10 UTC 2008). It was written by Dr. Christoph L. Spiel, converted partly from the HTML version and corrected using the PDF version both found on http://panorama.dyndns.org/EandE-documentation/[*]

## Overview

Enblend overlays multiple TIFF images using the Burt-Adelson multiresolution spline algorithm. (1) This technique tries to make the seams between the input images invisible. The basic idea is that image features should be blended across a transition zone proportional in size to the spatial frequency of the features. For example, objects like trees and windowpanes have rapid changes in color. By blending these features in a narrow zone, you will not be able to see the seam because the eye already expects to see color changes at the edge of these features. Clouds and sky are the opposite. These features have to be blended across a wide transition zone because any sudden change in color will be immediately noticeable.

Enblend expects each input file to have an alpha channel. The alpha channel should indicate the region of the file that has valid image data. Enblend compares the alpha regions in the input files to find the areas where images overlap. Alpha channels can be used to indicate to Enblend that certain portions of an input image should not contribute to the final image.

Enblend does not align images. Use a tool as `hugin` or PanoTools to do this. The TIFF files produced by these programs are exactly what Enblend is designed to work with. Sometimes these GUIs allow you to select feathering for the edges of your images. This treatment is detrimental to Enblend. Turn off feathering by deselecting it or setting the feather width to zero.

Enblend blends the images in the order they are specified on the command line. You should order your images according to the way that they overlap, for example from left-to-right across the panorama. If you are making a multi-row panorama, we recommend blending each horizontal row individually, and then running Enblend a last time to blend all of the rows together vertically.

Find out more about Enblend on its webpage[*].

## Invocation

`enblend` [OPTIONS] `-o` OUTPUT-FILE INPUT-FILES....

Assemble the sequence of images INPUT-FILES.... into OUTPUT-FILE.

### Common Options

Common options control some overall features of Enblend.

`-a`
  Pre-assemble non-overlapping images before each blending iteration.This overrides the default behavior which is to blend the images sequentially in the order given on the command line. Enblend will use fewer blending iterations, but it will do more work in each iteration.
`--compression=COMPRESSION`
  Write a compressed output file.Depending on the output file format Enblend accepts different values for COMPRESSION.
  JPEG
    COMPRESSION is a JPEG quality level ranging from 0–100.
  TIFF
    COMPRESSION is one of the keywords:
    ‘NONE’
      Do not compress. This is the default.
    ‘DEFLATE’
      Use the Deflate compression scheme also called ZIP-in-TIFF. Deflate is a lossless data compression algorithm that uses a combination of the LZ77 algorithm and Huffman coding.
    ‘LZW’
      Use Lempel-Ziv-Welch (LZW) adaptive compression scheme. LZW compression is lossless.
    ‘PACKBITS’
      Use PackBits compression scheme. PackBits is particular variant of run-length compression. It is lossless.
  Any other format
    Other formats like the PNG do not accept a COMPRESSION setting.

`-h`
`--help`
  Print information on the available options and exit.
`-l LEVELS`
  Use exactly this many LEVELS for pyramid blending.This trades off quality of results for shorter execution time and lower memory usage. The default is to use as many levels as is possible given the size of the overlap regions. Enblend may still use a smaller number of levels if the geometry of the images demands.
`-o OUTPUT-FILE`
  Required option that specifies the name of the OUTPUT-FILE.
`-v`
`--verbose`
  Increase the verbosity of progress reporting. Giving one or more ‘-v’ options will make Enblend more verbose.
`-V`
`--version`
  Output information on the Enblend version and some configuration details like extra features that have been compiled in.
`-w`
  Blend around the ± 180° boundary. Useful for full 360° panoramas. Version 3.2-cvs of Enblend, the one described here, does not blend neither zenith nor or nadir, so you may still see some seams in these areas.
`-x`
  Checkpoint partial results to the output file after each blending step.
`-z`
  This option has been deprecated. It is kept for backward compatability with older scripts. Use ‘--compression=LZW’ instead.

### Extended Options

Extended options control the image cache, the color model, and the cropping of the output image.

`-b BLOCKSIZE`
  Set the BLOCKSIZE in kilobytes (KB) of Enblend's image cache.This is the amount of data that Enblend 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.The input files should have embedded ICC profiles if this option is specified. If no ICC profile is present, Enblend will assume that the image uses the sRGB color space. The difference between this option and Enblend's default color blending algorithm is very slight and will be only noticeable when areas of different primary colors are blended together.
`-d`
`--depth=DEPTH`
  Force the number of bits per channel and the numeric format of the output image. All DEPTH specifications are valid in lowercase as well as uppercase letters. This option is only available in specific builds of Enblend. For integer format use
  `8`, `uint8`
    Unsigned 8 bit; range: 0..255
  `int16`
    Signed 16 bit; range: -32768..32767
  `16`, `uint16`
    Unsigned 16 bit; range: 0..65536
  `int32`
    Signed 32 bit; range: -2147483648..2147483647
  `32`, `uint32`
    Unsigned 32 bit; range: 0..4294967295 For floating-point format use
  `r32`, `real32`, `float`
    IEEE754 single precision floating-point, 32 bits wide, 24 bit significant
    - - Minimal normalized value: 1.2 × 10-38
    - - Epsilon: 1.2 × 10-7
    - - Maximal finite value: 3.4 × 1038
  `r64`, `real64`, `double`
    IEEE754 double precision floating-point, 64 bits wide, 53 bit significant
    - - Minimal normalized value: 2.2 × 10-308
    - - Epsilon: 2.2 × 10-16
    - - Maximal finite value: 1.8 × 10308 If the requested DEPTH is not supported by the output file format, Enblend warns and chooses the DEPTH that matches best.

`-g`
  Gimp (before version 2.0) and Cinepaint (see section Helpful Additional Programs) exhibit unusual behavior when loading images with unassociated alpha channels. Use option ‘-g’ to work around this problem. With this flag Enblend creates the output image with the associated alpha tag set, even though the image is really unassociated alpha.
`--gpu`
  Use the graphics card to accelerate some computations.This is an experimental feature that may not work on all systems. In this version of Enblend, 3.2-cvs, only mask optimization strategy 1 benefits from this option.
`-f WIDTHxHEIGHT`
`-f WIDTHxHEIGHT+xXOFFSET+yYOFFSET`
  Set the size of the output image manually to WIDTH× HEIGHT. Optionally specify the X-OFFSET and Y-OFFSET, too. This option is useful when the input images are cropped TIFF files, such as those produced by `nona`. The stitcher `nona` is part of Hugin. See section Helpful Additional Programs.
`-m CACHESIZE`
  Set the CACHESIZE in megabytes (MB) 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 1024MB which is good for systems with 3–4gigabytes (GB) of RAM.
`--visualize=IMAGE-FILE`
  Create an IMAGE-FILE that visualizes the mask optimization process.This shows Enblend's view of the overlap region and how it decided to route the seam line. If you are experiencing artifacts or unexpected output, it may be useful to include this visualization image in your bug report.

### Mask Generation Options

These options control the generation and the usage of masks.

`--coarse-mask`
  Use a scaled-down version of the input images to create the seam line. This is the default.
`--fine-mask`
  Use the full-size images to create the seam line. This can be slow. Use ‘--fine-mask’ if you have very narrow overlap regions.
`--load-mask=IMAGE-FILE`
  Instead of generating a mask, use the one in IMAGE-FILE.
`--no-optimize`
  Turn off seam line optimization. Combined with ‘--fine-mask’ this will produce the same type of mask as Enblend version 2.5.
`--optimize`
  Use a two-strategy approach to route the seam line around mismatches in the overlap region. This is the default.
`--save-mask=IMAGE-FILE`
  Save the generated mask to IMAGE-FILE.Use this option if you wish to edit the location of the seam line by hand. This will give you a template of the right size that you can edit to make your changes. Later, use ‘--load-mask’ to blend the project with your custom seam line.

## Understanding Masks

A binary mask indicates for every pixel of an image if this pixel must be considered in further processing or ignored. For a weight mask, the value of the mask determines how much the pixel contributes, zero again meaning “no contribution”.

Masks arise in two places: as part of the input files and as separate files, showing the actual pixel weights prior to image blendung or fusion. We shall explore both occurrences in the next sections.

### Masks in Input Files

Each of the input files for Enfuse and Enblend can contain its own mask. Both applications interpret them as binary masks no matter how many bits per image pixel they contain.

Use ImageMagick's `identify` or, for TIFF files, `tiffinfo` to inquire quickly whether a file contains a mask. Helpful Additional Programs shows where to find these programs on the web.

    $ identify -format "%f %m %wx%h %r %q-bit" remapped-0000.tif
    remapped-0000.tif TIFF 800x533 DirectClassRGBMatte 8-bit
                                                 ^^^^^ mask

    $ tiffinfo remapped-0000.tif
    TIFF Directory at offset 0x1a398a (1718666)
      Subfile Type: (0 = 0x0)
      Image Width: 800 Image Length: 533
      Resolution: 150, 150 pixels/inch
      Position: 0, 0
      Bits/Sample: 8
      Sample Format: unsigned integer
      Compression Scheme: PackBits
      Photometric Interpretation: RGB color
      Extra Samples: 1<unassoc-alpha>            <<<<< mask
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 4                           <<<<< R, G, B, and mask
      Rows/Strip: 327
      Planar Configuration: single image plane

The “Matte” part of the image class and the “Extra Samples” line tell us that the file features a mask. Also, many interactive image manipulation programs show the mask as a separate channel, sometimes called “Alpha”. There, the white (high mask value) parts of the mask enable pixels and black (low mask value) parts suppress them.

The multitude of terms all describing the concept of a mask is confusing.

Mask
  A mask defines a selection of pixels. A value of zero represents an unselected pixel. The maximum value (“white”) represents a selected pixel and the values between zero and the maximum are partially selected pixels. See Gimp-Savy[*].
Alpha Channel
  The alpha channel stores the transpacency value for each pixel, typically in the range from zero to one. A value of zero means the pixel is completely transparent, thus does not contribute to the image. A value of one on the other hand means the pixel is completely opaque.
Matte
  The notion “matte” as used by ImageMagick refers to an inverted alpha channel, more precisely: 1 - alpha. See ImageMagick[*] for further explanations.

Enblend and Enfuse only consider pixels that have an associated mask value different from zero. If an input image does not have an alpha channel, Enblend warns and assumes a mask of all non-zero values, this is, it will use every pixel of the input image for fusion.

Stitchers like `nona` add a mask to their output images.

Sometimes it is helpful to manually modify a mask before fusion. For example to suppress unwanted objects (insects and cars come into mind) that moved across the scene during the exposures. If the masks of all input images are black at a certain position, the output image will have a hole there.

### Weight Mask Files

...

## Tuning Memory Usage

The default configuration of Enfuse assumes a system with 3–4GB of RAM.

If Enfuse has been compiled with the C++-preprocessor symbol `ENBLEND_CACHE_IMAGES` it uses its own image cache, whose size is user configurable with the option ‘-m CACHE-SIZE’ (see section Extended Options). Furthermore, option ‘-b BUFFER-SIZE’ (see section Extended Options) allows for fine-tuning the size of a single buffer inside the image cache. Note that CACHE-SIZE is given in megabytes, whereas BUFFER-SIZE is given in kilobytes.

Usually the user lets the operating system take care of the memory management of all processes. However, a user of Enfuse might want to control the balance between the operating systems' Virtual Memory System and Enfuse's image cache for several reasons.

- Paging in or out parts of a process' image runs at kernel level and thus can make user processes appear unresponsive or “jumpy”. The caching mechanism of Enfuse of course runs as a user process, which is why it has less detrimental effects on the system's overall responsiveness.
- Enfuse's image cache has been optimized for accesses to image data. And all algorithms in Enfuse have been carefully arranged to play nice with the image cache. An operating system's cache has no knowledge of these particular memory access patterns.
- The disk access of the operating system to the swap device has been highly optimized. Enfuse on the other hand uses the standard IO-layer which is a slower interface.
- Limiting the amount of image cache prevents Enfuse from eating up most or all RAM, thereby forcing all user applications into the swap device.

The CACHE-SIZE should be set in a way as to reconcile all of the above aspects even for the biggest data sets (this is many images and large images).

Suggested cache- and buffer-sizes for different amounts of available RAM.

RAM | CACHE-SIZE | BUFFER-SIZE | Comment
--- | --- | --- | ---
MB | MB | KB
4096 | 1024 | 2048 | default
2048 | 512–1024 | 1024
1024 | 256–512 | 256–512

Table 4.1: Suggested cache-size settings

## Helpful Additional Programs

Several libraries and programs have proven helpful when working with Enfuse and Enblend.

Raw Image Conversion

  - DCRaw[*] is a universal raw-converter.
  - UFRaw[*], a raw converter based on DCRaw, adds a GUI (`ufraw`), versatile batch processing (`ufraw-batch`), and some additional features like, for example, cropping, noise reduction with wavelets, and automatic lens error correction.

Image Alignment and Rendering

  - ALE[*], David Hilvert's anti-lamenessing engine for the real die-hard command-line users aligns, filters, and renders images.
  - Hugin[*] is a GUI that aligns and stitches images. It comes with several command line tools, like `nona` to stitch panorama images, `align_image_stack` to align overlapping images for HDR or create focus stacks, and `fulla` to correct lens errors.
  - PanoTools[*] the successor of Helmut Dersch's original PanoTools[*] offers a set of command-line dirven applications to create panoramas. Most notable are `PTOptimizer` and `PTmender`.

Image Manipulation

  - CinePaint[*] is a branch of an early Gimp forked off at version 1.0.4. It sports much less features than the current Gimp, but offers 8bit, 16bit and 32bit color channels, HDR (for example floating-point TIFF, and OpenEXR), and a tightly integrated color management system.
  - The [www.gimp.org/ Gimp] is a general purpose image manipulation program. At the time of this writing it is still limited to images with only 8bits per channel.
  - ImageMagick[*] and its clone GraphicsMagick[*] are general purpose command-line driven image manipulation programs.

High Dynamic Range

  - OpenEXR[*] offers libraries and some programs to work with the EXR HDR format.
  - PFSTools[*] create, modify, and tonemap high-dynamic range images.

Libraries

  - LibJPEG[*] is a library for handling the JPEG (JFIF) image format.
  - LibPNG[*] is a library that handles the Portable Network Graphics (PNG) image format.
  - LibTIFF[*] offers a library and utility programs to manipulate the ubiquitous Tagged Image File Format, TIFF. The nifty `tiffinfo` command quickly inquires the properties of TIFF files.

Meta-Data Handling

  - EXIFTool[*] reads and writes EXIF meta data. In particular it copies meta data from one image to another.
  - LittleCMS[*] is the color management library used by Hugin, DCRaw, UFRaw, Enblend, and Enfuse. It supplies some binaries, too. `tifficc`, an ICC color profile applier, is of particular interest.

## A. Authors

- Andrew Mihal acmihal@users.sourceforge.net.

## Program Index

Jump to: | A C D E F G H I L N O P T U

Index Entry | Section
--- | ---
A
`ALE` | Helpful Additional Programs
`align_image_stack` | Helpful Additional Programs
`Anti-Lamenessing Engine` | Helpful Additional Programs
C
`CinePaint` | Helpful Additional Programs
`cinepaint` | Helpful Additional Programs
D
`dcraw` | Helpful Additional Programs
`DCRaw` | Helpful Additional Programs
E
`exiftool` | Helpful Additional Programs
`EXIFTool` | Helpful Additional Programs
F
`fulla` | Helpful Additional Programs
G
`gimp` | Helpful Additional Programs
`Gimp` | Helpful Additional Programs
`GraphicsMagick` | Helpful Additional Programs
H
`hugin` | Overview
`Hugin` | Extended Options
`hugin` | Helpful Additional Programs
`Hugin` | Helpful Additional Programs
I
`identify` | Masks in Input Files
`ImageMagick` | Helpful Additional Programs
L
`LibJPEG` | Helpful Additional Programs
`LibPNG` | Helpful Additional Programs
`LibTIFF` | Helpful Additional Programs
`LittleCMS, TiffICC` | Helpful Additional Programs
N
`nona` | Extended Options
`nona` | Helpful Additional Programs
O
`OpenEXR` | Helpful Additional Programs
P
`PanoTools` | Overview
`PanoTools` | Helpful Additional Programs
`PFSTools` | Helpful Additional Programs
`PTmender` | Helpful Additional Programs
`PTOptimizer` | Helpful Additional Programs
T
`tifficc` | Helpful Additional Programs
`tiffinfo` | Masks in Input Files
`tiffinfo` | Helpful Additional Programs
U
`UFRaw` | Helpful Additional Programs
`ufraw` | Helpful Additional Programs
`ufraw-batch` | Helpful Additional Programs

Jump to: | A C D E F G H I L N O P T U

## Option Index

Index Entry | Section
--- | ---
`-a` | Common Options
`-b` | Extended Options
`-b` | Tuning Memory Usage
`-c` | Extended Options
`--coarse-mask` | Mask Generation Options
`--compression` | Common Options
`-d` | Extended Options
`--depth` | Extended Options
`-f` | Extended Options
`--fine-mask` | Mask Generation Options
`-g` | Extended Options
`--gpu` | Extended Options
`-h` | Common Options
`--help` | Common Options
`-l` | Common Options
`--load-mask` | Mask Generation Options
`-m` | Extended Options
`-m` | Tuning Memory Usage
`--no-optimize` | Mask Generation Options
`-o` | Common Options
`--optimize` | Mask Generation Options
`--save-mask` | Mask Generation Options
`-V` | Common Options
`-v` | Common Options
`--verbose` | Common Options
`--version` | Common Options
`--visualize` | Extended Options
`-w` | Common Options
`-x` | Common Options
`-z` | Common Options

## General Index

Jump to: | A B C D E F G H I L M O P S U W

Index Entry | Section
--- | ---
A
alpha channels, unassociated | Extended Options
B
binary mask | Understanding Masks
bits per channel | Extended Options
C
CIECAM02 | Extended Options
Cinepaint | Extended Options
coarse mask | Mask Generation Options
color appearance model | Extended Options
compression, deflate | Common Options
compression, LZW | Common Options
compression, packbits | Common Options
D
deflate compression | Common Options
E
`ENBLEND_CACHE_IMAGES` (preprocessor symbol) | Tuning Memory Usage
F
fine mask | Mask Generation Options
G
general index | General Index
Gimp | Extended Options
H
helpful programs | Helpful Additional Programs
I
image cache, block size | Extended Options
image cache, cache size | Extended Options
index, general | General Index
index, option | Option Index
index, program | Program Index
input masks | Masks in Input Files
invocation | Invocation
L
load mask | Mask Generation Options
LZW compression | Common Options
M
mask, binary | Understanding Masks
mask, coarse | Mask Generation Options
mask, fine | Mask Generation Options
mask, load | Mask Generation Options
mask, save | Mask Generation Options
mask, visualization | Extended Options
mask, weight | Understanding Masks
masks, input files | Masks in Input Files
masks, undestanding | Understanding Masks
masks, weight | Weight Mask Files
memory, tuning usage of | Tuning Memory Usage
O
optimize seam | Mask Generation Options
optimize seam | Mask Generation Options
option index | Option Index
options, common | Common Options
options, extended | Extended Options
options, mask generation | Mask Generation Options
output image, set size of | Extended Options
overview | Overview
P
packbits compression | Common Options
program index | Program Index
programs, helpful additional | Helpful Additional Programs
S
save mask | Mask Generation Options
seam optimization | Mask Generation Options
seam optimization | Mask Generation Options
U
undestanding masks | Understanding Masks
W
weight mask | Understanding Masks
weight masks | Weight Mask Files

Jump to: | A B C D E F G H I L M O P S U W

## Footnotes

(1) Peter J. Burt and Edward H. Adelson, “A Multiresolution Spline With Application to Image Mosaics”, ACM Transactions on Graphics, Vol. 2, No. 4, October 1983, pages 217–236.

## Table of Contents

- Overview
- Invocation
  - Common Options
  - Extended Options
  - Mask Generation Options
- Understanding Masks
  - Masks in Input Files
  - Weight Mask Files
- Tuning Memory Usage
- Helpful Additional Programs
- A. Authors
- Program Index
- Option Index
- General Index

Retrieved from "http://wiki.panotools.org/Enblend_reference_manual"