Enblend reference manual

This manual is for Enblend (version 3.2-cvs, Thu Sep 25 07:35:10 UTC 2008), a tool for compositing images in such a way that the seam between the images is invisible, or at least very difficult to see.

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.

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.

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. For integer format use

- Maximal finite value: 1.8 × 10 308 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.

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.

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.