Using Hugin part 1: easy!

I’ve previously described how I use the panorama stitching program hugin – in my opinion the best program out there. It is free, it can be extremely easy to use, and it gives you the opportunity to do every step manually, with full control, while still do other steps automatically.

However, if you are a first time user, you will quickly either be overwhelmed, or you will get suboptimal results, simply because the full-auto mode is not for difficult picture sets.

So today, I will tell you how I use hugin for easy cases; next time will address more difficult issues. Here’s a simple example:

OK; two photos (yes, yes, overexposed, that was intentional as *I* felt overexposed coming to Wyoming’s summer from Germany). They show the camp site at the SMA dig at Dana Quarry this summer, and were taken with the intent to make them into a panorama.

This is the easiest setup you can have: few photos with very similar (in fact identical) camera settings, EXIF information present, a lot of overlap, and a lot of unique features. Let’s see how this can be done in hugin with minimal effort (NOTE: the pics in the gallery are reduced to 33%x33% size. If you use these to duplicate the below result you will find differences):

1. Start hugin
2. click ’1. Load images’ in the ‘Assistant’ tab
3. click ’2. Align’
4. wait
……………….. the Panorama preview window pops open
5. on the bottom left, choose the projection option (NOTE: the pulldown menu sometimes disappears, but you can still click into it and it comes back). For the beginning, use equirectangular, rectilinear, or cylindrical.
6. Adjust the panorama to your liking: left-click to make a point the center of the view, right-click to bring a point to the horizontal midline. I’ll have more to say about this later.
7. Alt-Tab to the main window and go to the ‘Stitcher’ tab.
8. if you made any alterations at step 6., click, in this order, ‘Calculate field of view’, ‘Calculate optimal size’, and ‘Fit crop to images’
9. select your export settings: for now, use

Exposure corrected, low dynamic range
Format: PNG or TIFF
if you prefer to use JPEG; set quality to 100

10. click’ Stitch!’ in the bottom right corner.

Easy, hu?
here’s what I got:

OK, that’s aiming low, and that’s not a really good panorama, but to show you the easy hands-off use it’s good enough. Now, for a bigger panorama with more photos. You can download a set of (resized) photos here (zip file renamed to *.pdf so wordpress will take it, DL, save and rename, 9.36 MB).

OK, throw all this into hugin and see what you get.

OOOPS!

This is in fact not uncommon: hugin is, for some reason, unable to find points that can be identified in two photos, and used to line them up. In this case, photos in the first group cannot be matched to those in the second – within each group all is well. (Read up, while we are at it, on SIFT, the algorithm that’s used to find such points.) Reasons can be that you moved the camera between shots – you’re supposed to rotate it around the point where the light enters the lens, not in any other way – or that there is too little overlap. Or that the vignetting and edge distortion are so bad that hugin is simply baffled. Another option is a very drab, uniform photo…. oh, wait, that’s exactly what we got! Add to that the much reduced size of the photos and it is no surprise that hugin can’t do this.

OK, let’s see if we can do better. Go to the ‘Images’ tab, select the last three images of the first group [imges #14, 15, 16] and the first three images of the second group [i.e., all three] , then click the ‘Create control points’ button.
Voilà!

NOTE: Sometimes, hugin horribly fails at finding point even thought the photos provide tons of them. I guess it is a simple matter of exceeding some buffer or limit of memory size. My laptop is too fast for me to read the report window, and I am  (tbh) too lazy to check, but if I use more than 8 full-size images from my camera or a similar amount of data in smaller photos hugin for some reason is unable to complete the auto-alignment. Manually, by selecting smaller numbers of photos and having control points calculated for them. The trick is to make sure hugin has enough points to make a proper panorama. In this case, the photos were taken ‘in order’, from one side to the other. Thus, two images directly following each other in naming sequence are most likely to have the highest amount of overlap, while two images far apart in the naming sequence likely to not overlap at all. Thus, all you have to do is select overlapping groups of images and ask hugin to create control points for them. Take at least two images overlap between groups, not one, to make sure that large overlaps are correctly aligned.

By now, there should be ample numbers of control points between images. But we hit a glitch: there aren’t! Images 16 and 17 apparently overtax hugin. If you select the two in the ‘images’ tab, and attempt to create control points automatically, nothing works.

OK, let’s force this: select images 15 and 17 in the ‘Images’ tab, and have hugin find control points for them. Then, choose 16 and 18, and create control points for them. Interestingly, if you NOW select 16 and 17 again, hugin will find control points between them. DOH!

You can check out the control points between two images by going to the ‘Control points’ tab. Simple select the two photos in the two pull-down menus, and both images and the control points between them are displayed. Note that the pull-down menu shows you the number of control points between the image active in the other window and the listed images – an easy way to check if there are any control points between two images. I’ll get back tot his later, when we discuss manual control point editing.

You can now simply go back to the ‘Assistant’ tab, click ’2. Align’ again, and everything is as it should be. Or, you do things manually: go to the ‘Optimizer’ tab, select ‘Position, View and Barrel (y,p,r,v,b)’ from the pull-down menu, and click ‘Optimize now!’ here’s what you get:

Hm, Okay……. this looks a bit – suboptimal? As you can see, the panorama wanders up on the left, the crop suggestion covers only 2/3 of the width. Not good. Let’s change this by moving the slider on the right down (to show you more of the photo stack), switching to equirectangular projection, left-clicking down below the panorama (on the vertical mid-line; don’t click far left or right as that would move the center left or right) to alter the center point (the further down you set it the more the panorama gets bent down – in this case, as it is bent up, going down with the center will straighten it), and bring up the right end a bit by right-clicking under the horizontal mid-line near the right end to rotate the image slightly. Oh, and re-calc the size and crop by going to the ‘Stitcher’ tab and clicking ‘Calculate field of view’, ‘Calculate optimal size’, and ‘Fit crop to images’.

Much better! Now we can simply stitch this and check the result. That means opening it and zooming way in, the scrolling all around it to see if there are stitching artefacts.

So, now you know how to toss photos into hugin and stitch a panorama with a bit of side-stepping problems. Enough for today.

About these ads

About Heinrich Mallison

I'm a dinosaur biomech guy working at the Museum für Naturkunde Berlin.
This entry was posted in How to, landscapes, non-palaeo. Bookmark the permalink.

4 Responses to Using Hugin part 1: easy!

  1. well done! very informative.

  2. steve cohen says:

    “but if I use more than 8 full-size images from my camera or a similar amount of data in smaller photos hugin for some reason is unable to complete the auto-alignment.”

    I’ve been using hugin extensively since you made me aware of it last year and I haven’t run into this problem — I regularly stitch together images from 15-30 photos and the auto-alignment works fine.

    I try to have 30%-50% overlap between images (to maximize the number of control points) plus I’m careful not to tilt the camera between shots to avoid parallax issues that can confound hugin.

    And if there is a glitch using the auto-align function I use the “control point” tab to manually add control points between abutting images; I’ve found that it takes at least 20 control points to get a good alignment.

    While I agree that hugin is fabulous it does suffer from the lack of an instruction manual (although there are some useful tutorials on their web-site) and it takes some playing with it to recognize how powerful it really is.

    But your blog-post went a long way in resolving that, congratulations.

    And thanks again for introducing me to hugin.

  3. Pingback: Using Hugin part 2: medium | dinosaurpalaeo

  4. Pingback: Using Hugin part 4: mosaic images | dinosaurpalaeo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s