Image Blending with Multiresolution Splines


Introduction

Enblend is a tool for compositing images. Given a set of images that overlap in some irregular way, Enblend overlays them in such a way that the seam between the images is invisible, or at least very difficult to see. Enblend does not line up the images for you. Use a tool like Hugin to do that.

Here are three images from a panorama I made with Hugin:

If you simply stack these images in the Gimp, you will get a poor result.

Photometric differences, such as vignetting in the corners, make the boundaries between the images obvious even though the stitching program did a good job aligning the features in the images. Enblend is designed to blend away these seams.

Wow! There are no more ugly lines in the sky or in the foreground. And best of all, no manual effort was required at all.

News

27 January 2007: Version 3.0 of Enblend is now available.
  • New, faster image processing algorithms for computing Gaussian and Laplacian pyramids.
  • Optional optimization of seam line placement to try to avoid mismatches and parallax errors in the image overlap region.
  • Masks can now be saved and loaded from files. This makes it possible to manually edit the location of the seam before multiresolution spline blending is applied.
  • Checkpointing of partial results is now optional. This improves speed.
  • Optional blending using the CIECAM02 color appearance model. Your TIFF files should have embedded ICC profiles in order to use this option. This replaces the CIE L*a*b* color blending in Enblend 2.X that never worked properly.
  • Optional use of the graphics processor to speed up certain computations. This feature is experimental and may not work on all systems.
  • Like other X.0 releases, please consider this a beta.
11 December 2005: Version 2.5 of Enblend is now available. This release fixes bugs in version 2.4.
  • Fixed a bug where Enblend would crash when the -w parameter was used.
  • Fixed a bug where Enblend would sometimes say "mask transition line bounding box undefined."
3 December 2005: Version 2.4 of Enblend is now available.
  • Added support for cropped and shifted TIFF files, such as those produced by Nona.
  • Enblend will now create output files with embedded ICC profiles, if a profile is found in one of the input images.
  • Improved the speed of the mask generation algorithm.
  • See the complete release notes at Sourceforge.
17 April 2005: Version 2.3 of Enblend is now available. This release fixes bugs in version 2.2.
  • The maximum number of levels you can specify with the -l parameter has been reduced from 30 to 29. While both of these are impractically large, at least 29 does not lead to arithmetic overflow and a subsequent crash.
  • Fixed a bug in temporary file handling in the Windows version of Enblend. This should solve the "unable to open temporary file" error.
5 February 2005: Version 2.2 of Enblend is now available. This release fixes some issues with the Windows binary. If you are using Enblend on UNIX, you do not need to upgrade.
  • The Windows version should now run on pre-Win2K systems.
  • Support for additional TIFF compression methods such as Deflate and Packbits is compiled into the Windows binary.
15 November 2004: Version 2.1 of Enblend is now available. This release fixes bugs in version 2.0.
  • Compression is no longer the default option in Windows.
  • TIFF library warning messages have been turned off.
  • Fixed a bug that caused primary-color spots to appear in overexposed areas of 16-bpp images.
  • Fixed a problem with Enblend crashing on large panoramas.
  • Ported source to compile natively on Win32 using MSVC.
8 November 2004: Enblend is now hosted on Sourceforge. The new project page features forums, trackers, CVS and more.
17 October 2004: Version 2.0 of Enblend is now available. New features include:
  • Support for signed and unsigned 16-bit, 32-bit, single- and double-precision floating point pixel types.
  • No more banding artifacts in the sky, even with 8-bit images.
  • Sophisticated memory/disk balancing. You can tell Enblend how much memory it is allowed to use, and it will swap to disk after that.
  • Support for large panoramas. I have tested that Enblend can blend a 1.2 gigapixel, 16-bit per channel color image. You should be able to go right up to 4 gigabyte limit of the TIFF format.
  • Optional blending in CIE L*a*b* color space.
23 May 2004: Version 1.3 of Enblend is now available. This update fixes issues on big-endian architectures. If you are using a little-endian machine you do not need to update.

Download

Enblend is available under the terms of the GNU General Public License.

Tip Jar Support This Project

Requirements:

To compile Enblend from source:

Documentation

Forums and Support

Usage

First, use programs like Hugin and PanoTools to stitch your images together. Select "Multiple TIFF" as the output file type. Then run Enblend on those TIFFs.

enblend -o output.tif input1.tif input2.tif ...

Enblend blends the images in the order you specify 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, I recommend blending each horizontal row individually, and then running Enblend a final time to blend all of the rows together vertically.

If you are using the Nona stitcher, you can use the "Multilayer TIFF" output format. Use the tiffsplit program (in the libtiff-progs package) to separate the layers into individual TIFFs and then run Enblend on those TIFFs.

Sometimes, various PanoTools GUIs will 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.

Options

Common Options
-a   Pre-assemble as many non-overlapping images as possible before each blending iteration. This overrides the default behavior which is to blend images one at a time in the order specified on the command line. Enblend will do fewer blending iterations, but it will do more work in each iteration.
-h   Print information on the available options
-l number 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 appropriate given the size of the overlap region. Enblend may still use a smaller number of levels if the geometry of the images demands it.
-o filename Specify the name of the output file.
-v   Verbose output.
-w   Blend around the -180/+180 boundary. Useful for full-360 panoramas. Enblend currently does not blend the zenith or nadir, so you may still see some seams in these areas.
-z   Use lossless compression for the output image, if your libtiff supports it. This option is supported in the pre-built Windows executable.
-x Checkpoint partial results to the output file after each blending step.
Extended Options
-b kilobytes Set the block size for 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 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, Enblend will assume that image uses the sRGB color space. The difference between using this option and Enblend's default color blending algorithm is very slight, and will be most noticeable when you need to blend areas of different primary colors together.
-f WxH Set the size of the output image manually. This is useful when the input images are cropped and shifted TIFF files, such as those produced by Nona's "Multifle TIFF" stitching option. A cropped and shifted TIFF saves space and time because it is just large enough for a single input image, instead of being the size of the entire output panorama with lots of empty space all around. Nona embeds a (x,y) offset coordinate in the file so that Enblend can tell where the image belongs in the final panorama.

By default, if you give Enblend cropped and shifted TIFFs, the output will also be a cropped and shifted TIFF. Sometimes you may want to include the extra blank space anyway, for example if you are creating a 360-degree panorama and the image size must be exactly a 2:1 ratio. In this case, use the -f parameter to manually set the size of the output image.
-g   Gimp (ver. < 2) and Cinepaint exhibit unusual behaviors when loading images with unassociated alpha channels. With this flag Enblend will create 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. Currently, only mask optimization strategy 1 benefits from this option.
-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.
--visualize filename Create an output image 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
--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 this option if you have very narrow overlap regions.
--optimize Use a two-strategy approach to route the seam line around mismatches in the overlap region. This is the default.
--no-optimize Turn off seam line optimization. Combined with --fine-mask, this will produce the same type of mask as Enblend 2.5.
--save-mask filename Save the generated mask to an 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. Then, use the --load-mask option to blend the project with your custom seam line.
--load-mask filename Instead of generating a mask, use the one in the give file.

Author

Andrew Mihal <acmihal@users.sourceforge.net>

Acknowledgments

Thanks to Konstantin Rotkvich for drawing the Enblend logo.


Last update: 27 January 2007 SourceForge.net Logo