multiblend - like Enblend, but 172x* faster

Discussion forum for Tawbaware's PTAssembler software, Helmut Dersch's Panorama Tools software and any other photography related software

Moderator: spamkiller

Post Reply
monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

multiblend - like Enblend, but 172x* faster

Post by monkey » Wed Dec 28, 2011 6:00 pm

*depending on image size

Hi all,

A while ago I cobbled together a GUI-based image blender called multiblend, but there wasn't much interest so I never took it any further. It was about twice as fast as Enblend though, so I thought it had some promise.

I've now completely rewritten it, and taken it back to basics as a command line program, so it can be dropped in to replace enblend.exe for use with PTA. I'm not going to claim it's a better blender than Enblend (though it doesn't suffer from at least form of banding that Enblend exhibits), but it is much, much faster. On my Core i7, blending a 7x7 276mp mosaic (8mp source images) is 172x faster than Enblend (at least; Enblend ran out of memory about 80% of the way through). On smaller mosaics you should still get at least a 20x speed improvement.

The other advantage is the 64-bit version, which means it can use the extra available memory on a computer running a 64-bit version of Windows. I've got 8gb of RAM, and it can blend an 8-bit 10x10 mosaic of 8mp images into a 560mp image in about 45 seconds, with a peak memory usage of just over 4gb, so a gigapixel blend might currently be just out of its reach, unless you've got 16gb. I've not done very much memory optimisation though, so I hope to improve its limits with future versions.

An SSE-capable processor is required (does anyone not have one of those these days?)
  • Homepage (with a bit about how it works) and downloads for the latest version: http://horman.net/multiblend/ (I hope this doesn't across as being needlessly critical of Enblend; I think Enblend is great, but I'm just too impatient to use it!)
Unzip it, copy out the executables, then point your Enblend location to either multiblend.exe (or multiblend_x64.exe if you're using a 64-bit version of Windows) in PTAssembler's prefs. It can also be used with EnblendGUI and Hugin (and possibly PTGui).

Code: Select all

multiblend v0.1 (c) 2011 David Horman
-------------------------------------

Usage: multiblend [options] [-o OUTPUT] INPUT...

Options:
   -l X                  X > 0: limit number of blending levels to x
                         X < 0: reduce number of blending levels by -x
   -d DEPTH              output image depth (8 or 16)
  --nocrop               do not crop output
  --wideblend            calculate number of levels based on output image size,
                         rather than input image size
  --compression=X        output file compression. X may be NONE (default),
                         PACKBITS, or LZW (DEFLATE is not currently supported)
  --bigtiff              BigTIFF output (not well tested)


multiblend uses libtiff (http://www.remotesensing.org/libtiff/misc.html)

http://horman.net/multiblend/
-----------------------------
It works with TIFFs only, 8-bit or 16-bit (but not a mix of both). Bug reports and comments will be gratefully received at david.horman@jerseymail.co.uk, or just in the thread here.

David
Last edited by monkey on Sat Jan 07, 2012 7:03 am, edited 1 time in total.

maxlyons
Posts: 3649
Joined: Fri Jun 20, 2003 8:55 pm
Location: USA
Contact:

Re: multiblend - like Enblend, but 172x* faster

Post by maxlyons » Thu Dec 29, 2011 10:42 am

David,

Very impressive! Thanks for posting this.

I just did a quick test with a 16 image project (each input image was 18 megapixels), and it created a final result in about 23 seconds on my i7 machine (Win 7/64 with 16GB RAM). The resulting file was about 210 megapixels, with a file size of 864 MB. This seems incredibly fast to me! I compared it against Smartblend (which I think is very fast), and that took about 90 seconds. The results look very similar, although I can tell that the two programs picked different seams.

As you suggest, one reason for the speed difference might be that Smartblend (and Enblend) attempt to perform "intelligent" seam routing. Would it be possible to adapt your approach to generating seams to incorporate some sort of seam routing "intelligence" to help out on difficult projects where the images aren't well aligned? Having spent some time working on this problem for my own blender (never released), I know this is not a trivial problem. But, the existing blender you have already built seems really excellent.

Thanks,

Max

monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

Re: multiblend - like Enblend, but 172x* faster

Post by monkey » Thu Dec 29, 2011 11:30 am

Hi Max,

Actually, avoiding intelligent seaming was one of my reasons for writing the GUI version of multiblend in the first place - I'd rather draw my own seams as I think getting a computer to pick a desirable seam could be an intractable problem. The general approach seems to be to start with a calculated seam and refine it from there, but if the seam you start from is bad to begin with (for instance if you get a "double seam"), you might have trouble.

I've never really looked at Smartblend, but I'm guessing from the speed that it also takes the more integrated approach that multiblend does.

The "172x" figure I quoted was in a like-for-like test with Enblend, so I had turned off optimisation with --no-optimise, and enabled --fine-mask (as mutliblend's masks are always full-scale). I think it's really down to the all in-one-go approach (Enblend's timings seem to rise exponentially with complexity, multiblend's look more linear), plus a couple of (if I do say so myself) nifty optimisations. For example, Enblend (I believe) treats image masks as just another image channel to be scaled down, whereas multiblend works directly on compressed mask data, so that's nearly 25% saved instantly.

It's nice to know multiblend is scaling okay - I didn't have any 18 megapixel images to test it with! Were they 16-bit or 8-bit?

David

dsp
Posts: 586
Joined: Tue Feb 20, 2007 11:09 am
Location: Hoboken, NJ

Re: multiblend - like Enblend, but 172x* faster

Post by dsp » Thu Dec 29, 2011 1:19 pm

Hi,

On my computer, it ran quickly, but seemed to have some problems. The image was blended nicely, but something funky happened to the colors. The input images were nine 21 Mpix 16-bit images. Here you can see the output, and the same image blended by enblend (a 64-bit version I compiled a while back)...
I tried passing both -d 8 and -d 16 to see if it made a difference, and it didn't.

cheers, Darcy

multiblend

Image

enblend

Image

monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

Re: multiblend - like Enblend, but 172x* faster

Post by monkey » Thu Dec 29, 2011 2:19 pm

Hi Darcy,

Thanks for finding the bug - assuming the difference in brightness is down to some post-processing difference, it looks like a simple swap of the red and blue channels. I'd guess there's a TIFF tag somewhere which specifies which channel is which (which multiblend clearly doesn't honour), but I can't find anything relevant at the moment.

If you download http://horman.net/multiblend/multiblend0.1a.zip you'll find a new version with a new option, --bgr, which should solve your problem in the meantime.

David

dsp
Posts: 586
Joined: Tue Feb 20, 2007 11:09 am
Location: Hoboken, NJ

Re: multiblend - like Enblend, but 172x* faster

Post by dsp » Thu Dec 29, 2011 4:20 pm

That's it exactly. I'm watching our one year old and the dog, so not much time for active debugging, other than running the software :) I'm tied up with the same duties for the rest of the week, but after I'm happy to run some more extensive tests. I have 64-bit versions built of enblend 3.x, and enblend 4 with openmp and with imagecache, so I can give you a timings/memory footprints on all of them.
cheers, dsp

monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

Re: multiblend - like Enblend, but 172x* faster

Post by monkey » Sat Dec 31, 2011 2:36 pm

Oops, got the link wrong first time round!

Source code (such as it is; I make no promises as to readability) is available at http://horman.net/multiblend/multiblend0.1a.tar.gz

As long as you can link it to libtiff, it should compile as is on Linux/OSX, but I'm the wrong person to ask how.

David

monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

Re: multiblend - like Enblend, but 172x* faster

Post by monkey » Sat Jan 07, 2012 7:02 am

There's a new version available at http://horman.net/multiblend/ which adds JPEG output support, solves some compilation issues on Linux/Mac/FreeBSD etc, and adds a work-around for some ambiguous seaming cases.

David

dsp
Posts: 586
Joined: Tue Feb 20, 2007 11:09 am
Location: Hoboken, NJ

Re: multiblend - like Enblend, but 172x* faster

Post by dsp » Sat Jan 07, 2012 1:36 pm

Hi David,
16 image (21 Mpix 16-bit) linear (1x16) pano.

Enblend x64 openmp 4:56
Enblend x64 imagecache 3:22
multiblend x64 0:49

Maybe not 172x, but still about an order of magnitude. I imagine the speed gain will be even more for multirow panos.

Thanks for the effort!!!
Darcy

monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

Re: multiblend - like Enblend, but 172x* faster

Post by monkey » Tue Mar 27, 2012 10:22 am

http://horman.net/multiblend/

The new 0.3beta version, when passed a single uncropped TIFF (i.e. a previously-multiblended mosaic) as input, will now blend around the left/right edges - this is a temporary workaround for 360 degrees panos until I can write a more integrated solution.

David

monkey
Posts: 289
Joined: Thu Dec 04, 2003 12:35 pm

Re: multiblend - like Enblend, but 172x* faster

Post by monkey » Tue Mar 26, 2013 4:17 am

http://horman.net/multiblend/

Now up to v0.6 with a number of bug fixes and some new features, such as rudimentary image caching to save a bit of memory.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest