Aligning Images with Hugin

![](upload://iPtQqMbkD48hpakeb3DZMxYJyZA.jpg)

Aligning Images with Hugin

Easily process your bracketed exposures

Hugin is an excellent tool for for aligning and stitching images. In this article, we’ll focus on aligning a stack of images. Aligning a stack of images can be useful for achieving several results, such as:

  • bracketed exposures to make an HDR or fused exposure (using enfuse/enblend), or manually blending the images together in an image editor
  • photographs taken at different focal distances to extend the depth of field, which can be very useful when taking macros
  • photographs taken over a period of time to make a time-lapse movie

For the example images included with this tutorial, the focal length is 12mm and the focal length multiplier is 1. A big thank you to @isaac for providing these images.

You can download a zip file of all of the sample Beach Umbrellas images here:

Download Outdoor_Beach_Umbrella.zip (62MB)

Other sample images to try with this tutorial can be found at the end of the post.

These instructions were adapted from the original forum post by @Carmelo_DrRaw; many thanks to him as well.

We’re going to align these bracked exposures so we can blend them:

![Blend Examples|907x230](upload://dd2gV98t97RdJMlnbKQeJtp4NuU.jpeg)
  1. Select InterfaceExpert to set the interface to Expert mode. This will expose all of the options offered by Hugin.

  2. Select the Add images… button to load your bracketed images. Select your images from the file chooser dialog and click Open.

  3. Set the optimal setting for aligning images:

    • Feature Matching Settings: Align image stack
    • Optimize Geometric: Custom parameters
    • Optimize Photometric: Low dynamic range
  4. Select the Optimizer tab.

  5. In the Image Orientation section, select the following variables for each image:

    • Roll
    • X (TrX) [horizontal translation]
    • Y (TrY) [vertical translation]

    You can Ctrl + left mouse click to enable or disable the variables.

    ![roll x y Hugin|878x714](upload://1iGLfXksZTC2zbhNh9XiNABX5wO.png)

    Note that you do not need to select the parameters for the anchor image:

    ![Hugin anchor image|882x742](upload://umwky4AzGoobo7o7pdDau2a8GwU.png)
  6. Select Optimize now! and wait for the software to finish the calculations. Select Yes to apply the changes.

  7. Select the Stitcher tab.

  8. Select the Calculate Field of View button.

  9. Select the Calculate Optimal Size button.

  10. Select the Fit Crop to Images button.

  11. To have the maximum number of post-processing options, select the following image outputs:

  12. Select the Stitch! button and choose a place to save the files. Since Hugin generates quite a few temporary images, save the PTO file in it’s own folder.

Hugin will output the following images:

  • a tif file blended by enfuse/enblend
  • an HDR image in the EXR format
  • the individual images after remapping and without any exposure correction that you can import into the GIMP as layers and blend manually.

You can see the result of the image blended with enblend/enfuse:

![Beach Umbrella Fused|960x718](upload://jBOyKd5OaxJZPFw0V2RS0xzphRA.jpeg)

With the output images, you can:

  • edit the enfuse/enblend tif file further in the GIMP or RawTherapee
  • tone map the EXR file in LuminanceHDR
  • manually blend the remapped tif files in the GIMP or PhotoFlow

Image files

  • Camera: Olympus E-M10 mark ii
  • Lens: Samyang 12mm F2.0

Indoor_Guitars

Download Indoor_Guitars.zip (75MB)

  • 5 brackets
  • ±0.3 EV increments
  • f5.6
  • focus at about 1m
  • center priority metering
  • exposed for guitars, bracketed for the sky, outdoor area, and indoor area
  • manual mode (shutter speed recorded in EXIF)
  • shot in burst mode, handheld

Outdoor_Beach_Umbrella

Download Outdoor_Beach_Umbrella.zip (62MB)

  • 3 brackets
  • ±1 EV increments
  • f11
  • focus at infinity
  • center priority metering
  • exposed for the water, bracketed for umbrella and sky
  • manual mode (shutter speed recorded in EXIF)
  • shot in burst mode, handheld

Outdoor_Sunset_Over_Ocean

Download Outdoor_Sunset_Over_Ocean.zip (60MB)

  • 3 brackets
  • ±1 EV increments
  • f11
  • focus at infinity
  • center priority metering
  • exposed for the darker clouds, bracketed for darker water and lighter sky areas and sun
  • manual mode (shutter speed recorded in EXIF)
  • shot in burst mode, handheld

Licencing Information


This is a companion discussion topic for the original entry at https://pixls.us/articles/aligning-images-with-hugin/
15 Likes

Thank you for the great walk-through @paperdigits!

Hopefully you all find this helpful! Thanks @Isaac for the example images and @Carmelo_DrRaw for the original walk thru. :slight_smile:

2 Likes

Thank you. This is extremely useful. Is there a way to download articles from the forum? I will definitely love to have them all on my desktop.

Download links to images.zip are not working? I wonder if problem is me or links?

@shreedhar you can certainly use wget to grab the article or clone the repo on github and you’ll have the original markdown.

@yteaot can you try from the site’s version of the post? PIXLS.US - Aligning Images with Hugin

Its not working for me from the forum version of the post for whatever reason, but I’m also trying from my phone.

There is one more thing to keep in mind by default (at least in the past) darktable would save tiffs with attached crop information which didn’t with a lot of software. So now in the remapper options for nona (Hit the button Processing: Remapper: [Nona] [[ OPTIONS ]] ) I always disable save cropped images. This solves that problem. :slight_smile:

I just checked and the problem is me. I’ll get it fixed right up in a little while. Sorry! :frowning:

[edit] - I corrected the links - sorry about that!

Print to PDF.

@patdavid is there a way to print a Discourse post so that all the irrelevant info is hidden?

I would recommend printing the articles from the main site, and not the forum. (I might have even created a print-specific stylesheet for the site).

@Morgan_Hardwood - not sure what the print styles look like for the forum, but I can have a look later.

[edit] - I do have a print stylesheet for the main site, but haven’t committed it yet. I’ll look again at it and see.

Hi!

Can you explane steps 5 and 6 more closly. I dont understand the meaning of them.

For handheld images it’s better to optimize yaw/pitch/roll than X/Y/Z which are meant for flat surfaces.

Step 5 is optimizing roll, X and Y? Should create control points do before optimize?

Yes, you need control points to optimize.

Awesome! Been away all weekend (in Yosemite), but will have a look through in more detail tomorrow. Looks great! Thanks @paperdigits!

2 Likes

Oh thank you! Let me know if you spot any errors :slight_smile:

5 posts were split to a new topic: FF 45.4.0 render issue for ‘big-vid’ figure images

I’ve split these out to not got off-topic here.

Just checking back in to say that I had a chance to look through the tutorial in detail, and it looks great! Thanks for getting this together: it’s going to help a lot of people!

1 Like

Probably a minor point but checking ‘Exposure fused from any arrangement’ on the Stitcher page causes the run to fail with error message about excessive overlap. Checking ‘Exposure fused from stacks’ instead fixes the problem.

Are there any recommendation on how to sharpen the image after this type of merge? I imagine it would be best to apply USM as the last step, but I haven’t investigated in much detail. Merging already sharpened images does not look too bad to me.