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.
- 1 Overview
- 2 Invocation
- 3 Understanding Masks
- 4 Tuning Memory Usage
- 5 Helpful Additional Programs
- 6 A. Authors
- 7 Program Index
- 8 Option Index
- 9 General Index
- 10 Footnotes
- 11 Table of Contents
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.
-o OUTPUT-FILE INPUT-FILES....
Assemble the sequence of images INPUT-FILES.... into OUTPUT-FILE.
|Memory and GPU control|
|Mask generation control|
Common options control some overall features of Enblend.
- 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.
- Write a compressed output file.Depending on the output file format Enblend accepts different values for COMPRESSION.
- COMPRESSION is a JPEG quality level ranging from 0–100.
- COMPRESSION is one of the keywords:
- Do not compress. This is the default.
- 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 Lempel-Ziv-Welch (LZW) adaptive compression scheme. LZW compression is lossless.
- 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.
- Print information on the available options and exit.
- 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.
- Required option that specifies the name of the OUTPUT-FILE.
- Increase the verbosity of progress reporting. Giving one or more ‘-v’ options will make Enblend more verbose.
- Output information on the Enblend version and some configuration details like extra features that have been compiled in.
- 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.
- Checkpoint partial results to the output file after each blending step.
- This option has been deprecated. It is kept for backward compatability with older scripts. Use ‘--compression=LZW’ instead.
Extended options control the image cache, the color model, and the cropping of the output image.
- 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.
- 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.
- 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
- Unsigned 8 bit; range: 0..255
- Signed 16 bit; range: -32768..32767
- Unsigned 16 bit; range: 0..65536
- Signed 32 bit; range: -2147483648..2147483647
- Unsigned 32 bit; range: 0..4294967295For floating-point format use
- 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 × 10 38
- 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 × 10 308 If the requested DEPTH is not supported by the output file format, Enblend warns and chooses the DEPTH that matches best.
- 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.
- 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.
- 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
nonais part of Hugin. See section Helpful Additional Programs.
- 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.
- 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.
- Use a scaled-down version of the input images to create the seam line. This is the default.
- Use the full-size images to create the seam line. This can be slow. Use ‘--fine-mask’ if you have very narrow overlap regions.
- Instead of generating a mask, use the one in IMAGE-FILE.
- Turn off seam line optimization. Combined with ‘--fine-mask’ this will produce the same type of mask as Enblend version 2.5.
- Use a two-strategy approach to route the seam line around mismatches in the overlap region. This is the default.
- 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.
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.
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.
- 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.
- 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.
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.
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
- 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
nonato stitch panorama images,
align_image_stackto align overlapping images for HDR or create focus stacks, and
fullato 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
- 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
- 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
tiffinfocommand quickly inquires the properties of TIFF files.
- Meta-Data Handling
- Andrew Mihal firstname.lastname@example.org.
(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.