Workflow for High-Dynamic Range Panoramas

HDR alignment

HDR panoramas can be aligned and stitched with all individual frames like normal panoramas, but this creates a lot of extra work due to the huge number of control points needed to align all the images. A more efficient approach is to first align each stack of images to each other and treat these as a single image for the rest of the stitching process.

Hugin's "stack" feature can be used for this. Each set of images taken in the same direction at different exposures are assigned to a stack, which keeps their geometric settings locked together. Control points are added to only the first (middle exposure) image of each stack, and the other exposures are automatically kept at the same position. Since there are fewer images used for control points, they can be autogenerated, adjusted, and optimized much more quickly. However, this requires that the images are already in exactly the same orientation. Hugin includes a program called align_image_stack to do this automatically.

Optional: RAW conversion

If the images were shot in RAW format, they need to be converted to a standard format before further processing. This can allow you to squeeze even a little more dynamic range out of the camera than AEB gives you, since a 12- or 14-bit RAW image can usually be corrected up or down at least a stop without any major artifacts. The script below uses UFraw in batch mode to convert each image to TIFF format using a .ufraw ID file from the corresponding exposure in the first stack.

Alignment Script

First argument is the number of images per stack, all others are image files. This will process all Canon RAW files through UFraw first and send other files to align_image_stack directly. Users of other cameras should change CR2 to the correct extension for your RAW files.

#!/usr/bin/perl

use strict;

my $stack = shift;
my @first = @ARGV[0..$stack];
s/CR2/ufraw/ for @first;

die unless $stack > 0;

while (@ARGV)
{
    my @frames;
    push @frames, shift @ARGV for (1..$stack);

    for my $i(0..$#frames)
    {
        if($frames[$i] =~ /.CR2$/i)
        {
            my $raw = $frames[$i];
            $frames[$i] =~ s/CR2/tif/;
            print "$raw + $first[$i] -> $frames[$i]\n";
            system 'ufraw-batch', "--conf=$first[$i]", '--out-typ=tiff',
                '--zip', $raw;
        }
    }

    my ($num) = $frames[0] =~ /(\d{4})/;
    my $base = "ALIGN_$num";
    print "@frames -> $base\n";

    system 'align_image_stack', '-a', $base, '-v', @frames;
}

Standard panorama processing

Stitching and tone-mapping/exposure fusion

-- StephenCavilia - 25 Jun 2011
Topic revision: r3 - 14 Jul 2011, StephenCavilia
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CodenamePending? Send feedback