Multiblend
Latest changes:
RC5:
- Various fixes for seg faults
RC4:
- Some fixes for very large panoramas
RC3:
- Fixed a couple of buffer overflows
RC2:
- Fix for memalign on MacOS
- Now properly ignores Enblend's -f parameter
v2.0 is an almost complete rewrite.
- Rewritten, better quality blending engine
- No limit to number of images
- Disk caching for large mosaics
- Improved boundary wrapping
- Image position adjustment via command line parameters
About
Multiblend is a multi-level image blender for the seamless blending of image mosaics, such as those created with Hugin, PTAssembler, or PTGui. It is a significantly faster drop-in alternative to Enblend, although it lacks some of Enblend's advanced features.
Usage
Usage: Multiblend [options] [-o OUTPUT] INPUT [X,Y] [INPUT] [X,Y] [INPUT]...
Options:
--levels X / -l X X: set number of blending levels to X
-X: decrease number of blending levels by X
+X: increase number of blending levels by X
--depth D / -d D Override automatic output image depth (8 or 16)
--bgr Swap RGB order
--wideblend Calculate number of levels based on output image size,
rather than input image size
-w, --wrap=[mode] Blend around images boundaries (NONE (default),
HORIZONTAL, VERTICAL). When specified without a mode,
defaults to HORIZONTAL.
--compression=X Output file compression. For TIFF output, X may be:
NONE (default), PACKBITS, or LZW
For JPEG output, X is JPEG quality (0-100, default 75)
For PNG output, X is PNG filter (0-9, default 3)
--cache-threshold= Allocate memory beyond X bytes/[K]ilobytes/
X[K/M/G] [M]egabytes/[G]igabytes to disk
--no-dither Disable dithering
--tempdir <dir> Specify temporary directory (default: system temp)
--save-seams <file> Save seams to PNG file for external editing
--load-seams <file> Load seams from PNG file
--no-output Do not blend (for use with --save-seams)
Must be specified as last option before input images
--bigtiff BigTIFF output
--reverse Reverse image priority (last=highest) for resolving
indeterminate pixels
--quiet Suppress output (except warnings)
--all-threads Use all available CPU threads
[X,Y] Optional position adjustment for previous input image
Features
- Consistent and integrated seaming
Enblend blends input images one at a time, calculating and optimising a new seam line for each new input image against the intermediate output image so far. Not only is this slow (due to the repeated seaming and Enblend's use of an exact but complex algorithm for seam generation), it also makes the routes of Enblend's seams (and the degree to which images are blended) dependent on the order that input files are provided to it. In contrast, Multiblend calculates a unique composite seam for all images simultaneously, using a faster algorithm:
(…and 716 other possibilities) |
|
Enblend | Multiblend
|
---|
Multiblend, however, doesn't optimise seams as Enblend does.
- Speed
Enblend similarly expends a lot of CPU cycles generating a full intermediate image for each new input image, with each intermediate image taking longer to generate than the last as the output image grows. This is where Multiblend really wins out, as all images are (effectively) simultaneously blended:
|
|
Enblend | Multiblend
|
---|
In testing, Multiblend is about 10x faster for small mosaics. Due to Enblend's O(n2) time complexity, compared to Multiblend's O(n) linear time complexity, this speed advantage increases to 300x for a gigapixel mosaic:
Based on this exponential difference, Multiblend would take less than a day to blend a terapixel (1000 gigapixel) mosaic; Enblend would take 360 years.
- Smoother, more consistent blending
The following images show how Multiblend blends images more smoothly than Enblend:
Enblend | |
|
---|
Multiblend (default) | |
|
---|
Multiblend (--wideblend ) | |
|
---|
Other differences in implementation mean that Multiblend is able to blend images which have very little overlap, or even none at all (including images which have gaps between them):
| |
|
Input images (no overlap) | Default settings | --wideblend
|
Enblend blends image sequentially, with the amount of blending seeming to be dependent on both the amount of overlap and the current size of the intermediate mosaic. This means that later images get blended more than ealier images do. Multiblend blends all images by the same amount:
|
|
Enblend | Multibend
|
---|
- Dithering
Although Enblend employs dithering to reduce banding, it appears to be broken as residual banding is still detectable in output images. Additionally, Enblend's dithering is random and non-deterministic which means running Enblend twice on the same inputs will not result in an identical output, which is potentially problematic. Multiblend uses ordered dithering and does not suffer from either of these issues:
|
|
Enblend | Multiblend
|
---|
- Image formats / position adjustment
Multiblend supports TIFF, JPEG, and PNG images for both input and output.
By specifying a coordinate pair after an input image, that image's position in the mosaic can be adjusted. This allows mosaics to be made from JPEGs or cropped PNGs, neither of which can natively (to the best of my knowledge) provide position information.
- Caching
Multiblend will transparently cache data to disk if necessary, making it capable of blending much larger mosaics than Enblend.
Caveats
- Multiblend doesn't optimise seams, as Enblend does by default.
Acknowledgements
Multiblend was inspired by Enblend.
Multiblend uses libtiff:
Copyright © 1988-1997 Sam Leffler
Copyright © 1991-1997 Silicon Graphics, Inc.
Multiblend uses libjpeg-turbo.
Multiblend uses libpng.
Contact
If you find any bugs or have any questions about Multiblend you can email me at david@horman.net