Pushing align_image_stack to the limit

864 views
Skip to first unread message

Andrew Kreps

unread,
Dec 31, 2008, 2:54:35 PM12/31/08
to hugi...@googlegroups.com
Hey, I wanted to ask a few questions on what I believe to be a fairly
extreme use of align_image_stack. Ultimately, I'm looking to do an
alignment on over 24,000 images. The frames I'm working with are
633x950 pixel JPEGs, and I'm running hugin 0.7.0 compiled on Gentoo
Linux.

When I loaded my first 1200 frames into align_image_stack, it spun for
3 hours, ultimately terminating in a segmentation fault. I pared the
list down to the first 300 images, and it seems to be a bit better
off. Can anyone speculate as to why it failed? Did it simply run out
of memory, or could I have exceeded an internal limit of a variable?
I've noticed that the 300 image process is using about 36% of my
available RAM, which would have put the 1200 image process well over
my physical limit.

Since it looks like I'll be creating subsets of images to align, would
it be best for me to start each subset with the exact same base image
(frame 0)? Alternatively, would it be better if I started the next
subset with the final aligned image from the previous set? When I do
this, am I better off working with small sets, or should I keep the
sets as large as I can manage?

I imagine that I'll answer some of my own questions as I work my way
through this, but I appreciate any advice you can muster. Plus, this
gives me something to do while align_image_stack is in its 10th hour
of operation. :)

Bruno Postle

unread,
Dec 31, 2008, 5:41:45 PM12/31/08
to Hugin ptx
On Wed 31-Dec-2008 at 11:54 -0800, Andrew Kreps wrote:
>
>Hey, I wanted to ask a few questions on what I believe to be a fairly
>extreme use of align_image_stack. Ultimately, I'm looking to do an
>alignment on over 24,000 images. The frames I'm working with are
>633x950 pixel JPEGs, and I'm running hugin 0.7.0 compiled on Gentoo
>Linux.
>
>When I loaded my first 1200 frames into align_image_stack, it spun for
>3 hours, ultimately terminating in a segmentation fault. I pared the
>list down to the first 300 images, and it seems to be a bit better
>off.

There may be a bug here, but I think that your problem is that
align_image_stack aligns every image with every other image. This
is a lot of work with 300 images and doesn't scale linearly.

I suggest much smaller groups and using the -p option to output .pto
projects instead of aligned images. You can use ptomerge from
Panotools::Script to join them all together afterwards, and
autooptimiser to align the resulting .pto project(s).

Then use hugin/nona to render the adjusted images once you know the
alignment is ok.

>Since it looks like I'll be creating subsets of images to align, would
>it be best for me to start each subset with the exact same base image
>(frame 0)? Alternatively, would it be better if I started the next
>subset with the final aligned image from the previous set?

Depends on your data and if you have one 'keyframe' that everything can
be aligned against.

--
Bruno

Daniel M German

unread,
Dec 31, 2008, 5:45:23 PM12/31/08
to hugi...@googlegroups.com
Andrew Kreps twisted the bytes to say:


Andrew> Hey, I wanted to ask a few questions on what I believe to be a fairly
Andrew> extreme use of align_image_stack. Ultimately, I'm looking to do an
Andrew> alignment on over 24,000 images. The frames I'm working with are
Andrew> 633x950 pixel JPEGs, and I'm running hugin 0.7.0 compiled on Gentoo
Andrew> Linux.

Are they frames of a movie? If so, feed two at a time. I suspect that
matching N images is essentially an O(n^2) process assuming that
matching 2 images is constant.

---dmg


Andrew Kreps

unread,
Dec 31, 2008, 7:32:42 PM12/31/08
to hugi...@googlegroups.com
On Wed, Dec 31, 2008 at 2:45 PM, Daniel M German <d...@uvic.ca> wrote:
>
> Are they frames of a movie? If so, feed two at a time. I suspect that
> matching N images is essentially an O(n^2) process assuming that
> matching 2 images is constant.
>

They are in fact frames of a movie. I've written a perl wrapper
script to send an arbitrary number of files including the one it just
finished processing to align_image_stack. I then ran a sample batch
of 5 at a time, and it made it halfway through the list in a couple of
hours. Much faster. I've taken your advice and I'm now sending them
in two at a time, but I have something that might be an issue -- I
don't want to modify the first image as I continue to walk the list of
images, so I'm throwing it away at the end of the iteration. I've
specified -m based on the somewhat cryptic documentation on that
feature, but will that keep all of the modifications in the second
image? I've taken a look at the first 4 images (through remote
desktop), and everything looks OK so far. I'll let it churn for a
while and see what the results look like.

The 300 stack is still running. I'm kind of curious what will happen
when it finally completes. It's still working on the statistics, and
the memory usage has dropped by about 15%. Thankfully I'm running
this on a dual-core box.

Andrew Kreps

unread,
Jan 2, 2009, 2:28:04 PM1/2/09
to hugi...@googlegroups.com
Thank you all for your help. I've managed to align a stack of 1200+
images by processing two at a time. I'm going to create a Wiki page
on this project of mine because I haven't been able to find
documentation for using hugin to create a time lapse of this
magnitude. Until I write it up, here's how I accomplished this phase:

I created a script that sends two image filenames at a time to
align_image_stack. The first filename is the image that was
previously aligned, and the second is my next unprocessed movie frame.

I used the following align_image_stack parameters: -v -e -c 32 -g 20
-a prefix. I found the default grid and control point settings left
me with some unacceptable aberrations after several hundred frames.
Once it spits out the two aligned images, I delete the first one, and
rename the second one to add it to my aligned stack.

Once the run completes, I light up mencoder and its magic mf://*.jpg
syntax, and shazam! I have an aligned movie. With the generous
control point and grid parameters I used, it took align_image_stack 8
hours to align 1212 images. Only 24,000 frames, and a few questions
to go.... :)

derin....@gmail.com

unread,
Feb 21, 2024, 5:00:47 PM2/21/24
to hugin and other free panoramic software
Hello Andrew, I'm resurrecting a very dead thread here, but any chance of sharing that script of yours?
Reply all
Reply to author
Forward
0 new messages