18 December 2010

How to make panoramas using Hugin

I've been asked how I make the panoramas that you see on this blog. It's actually rather simple - and free, too! Here's a small guide.

We want to go from this:
Photo 1...

Photo 2...
To this:


You'll need:

  • Some photos
  • Hugin Panorama Creator
  • A bit of time on your hands - it takes a while to create these panoramas.

First step is to take a bunch of pictures of the panorama that you want to create.
Take the first picture in one end of the panorama that you have in mind, move the camera slightly to one side - make sure that there is an overlap between the pictures - and take another picture. Repeat until you have all the pictures you want. Don't worry too much about getting the pictures perfectly level with each other- that'll be taken care of later.
Most cameras have a mode that allows for continous shooting. It's rather helpful in taking the photos that are needed: just hold down the "shoot"-button, and move the camera horizontally.

The next step is to import the pictures to a computer. I use Google's Picasa to manage my photos: it's free (as in gratis - it's not Free Software), and a pretty decent program. It runs under Linux, Windows and OS X.
Once the images has been imported to the computer, you can start Hugin.

Hugin is the program that stitches the images together. Hugin is free as well (free as in both gratis and libre - it's Free and Open Source Software), and runs under Linux, Windows, OS X and FreeBSD. You can get it from this page - or, if you run a Linux-distribution, it may already be available in your package manager. In Ubuntu 10.04, which I use, I can install it from the Ubuntu Software Center, or by typing "sudo apt-get install hugin" in a console.
Installation in Windows should be simple as well: just download the program from the site linked to above, and install it.

When you start Hugin, two windows will open. You'll see the main screen - it'll look something like this.

Main screen of Hugin


Hugin has many options, but fortunately for us, it has a simple guide to help us in making the panorama.
This guide consists of three steps - the first is to import the pictures you want to make a panorama from - do this after clicking the the "1. Load images..."-button.
In this example, I find the pictures that I want to create a panorama from - a total of 23 pictures.

Loading images

I click "Open", and wait, while Hugin loads the images. Depending on how many pictures that you want to create a panorama from, the size of the pictures, speed of the computer and so on, this can take a few minutes to complete.

Once that's done, we click "2. Align..." - and wait.

Aligning images

You'll see a lot of techical details in the status screen. Don't pay attention to it, just let it run. This process will take a while, too. So get yourself a cup of tea, and wait patiently!

Software hard at work

Once it's done, you'll see a preview of the panorama in the "Fast Panorama preview"-window. It may look a little rough around the edges, and the seams between the photos will look obvious now, but that'll be fixed soon enough. The important thing to do at this step, is to remove the black borders around the photos. Click the "Crop"-button, and move the borders in the image, so that the black parts are removed.

Cropping the image

Once this is done, go to the main window of Hugin, and click "Create panorama...". You'll be asked to specify where you want to save the panorama, and what you want to call it.

Create the panorama

After you click "Save", another time-consuming step will begin: the actual stitching of the photos. Go get yourself another cup of tea, this will take a while.

Stitching the photos

Once it's done, you'll have your panorama. The panorama is, by default, saved as a TIFF-image - that is, not your usual image format. There are many ways of converting the TIFF-image to other image formats, such as the more common JPG-format.
I believe that many (most?) major Linux-distributions has the Imagemagick suite of tools installed - if so, conversion between formats is easy: type "convert infile.tif outfile.jpg" in a console.
Picasa can import TIFF-images as well: locate the image in Picasa (if it's not there, use "File->Add File to Picasa..."), and then use "File->Save As..." to save a copy of the image in the JPG file format.

The finished panorama. Full image here.
And that's it! Pat yourself on the back, you have now created a panorama. If you like using Hugin, consider donating to support the project, or donating to a cause that promotes Free Software - such as the Free Software Foundation.

A few word of caution: the photos that you use to create the panorama should contain some level of detail, something that can be compared between the photos. It's difficult to say exactly how much detail the photos should contain. I tried to create a panorama of a mountain-range from a set of pictures taken after nightfall. The photos contained too little distinct features that Hugin could use to find the connections between the photos, and it failed in creating the panorama.
It should be noted, that it is possible to help Hugin in finding connections between pictures, but that's for more advanced users. There are tutorials available, that explains how to do this.

And admittedly, this panorama doesn't show the best possible use of Hugin. The building looks distorted: it does not appear so in real life. But now you know how to make your own panoramas, so you can go and create something better than this!

No comments:

Post a Comment