Creating Beautiful Panoramas Easily in Linux

Recently, I’ve gotten pretty into photography.  I bought a digital SLR, a Nikon D40X, which I love.  I also went to Germany recently, which gave me many opportunities to take some really pretty pictures.  Many times, I couldn’t capture the scene in just one picture, so I had to take some panoramas.  I generally do my panoramas vertically so I can capture a larger amount of vertical area.  This requires more shots, but memory it cheap, and I don’t have to end up cropping parts I want to keep.  I’m going to guide you through making a seamless panorama using only free and open-source software in Linux, specifically Ubuntu 9.04 Jaunty Jackalope. 

First, we need tools. GIMP should already be installed, but we need Autopano and Hugin.

sudo apt-get install hugin autopano-sift

Now, open up Hugin from the Applications -> Graphics menu.  The first step is to import your images.  I’m going to stitch together four images for this demo, though I have tried the exact same procedure with 20 and it came out beautifully.  Here are the three images in gThumb:

img1Simply drag-and-drop these into the Images tab of Hugin:

img2Now, we need to generate the control points.  These are the places each image has in common with its neighbor.  We can make these manually in the control points tab, but that’s tedious and crappy, and the computer can do it just fine on its own.  In the same Images tab, there will be a part at the bottom that says Feature Matching (Autopano). Set the Points per Overlap to 7, since that should be sufficient for most stitching, then click Create control points.  After it does its thing, you’ll see something like this:

img3Click OK, and move on to the Optimizer tab.  Here, we can automatically tweak the parameters of each photo.  First, let’s just do positions starting from the anchor image (which is the first one by default).  Make sure to uncheck the first checkbox, as shown here:


Once that’s finished, you’ll see something like this:


If these numbers are small (like less than 30 or so), go ahead and hit Yes.  Otherwise, you need to go take a look at your control points manually, and possibly shift your anchor image for position, both of which are beyond the scope of this tutorial.  These numbers look perfect, and are what we expect from autopano magic.  Now, let’s fix lens issues with another pass in a different mode.

img6Hit Optimize Now! again, and click Yes when it finishes.  We’re done positioning.  Now, let’s fix the exposure.  Click the Exposure tab, and you’ll see something like this:


Set it up as shown, making sure to uncheck that box.  Then click Optimize Now! and Yes like before.  You’ve now balanced the exposure levels of the images.  Let’s take a look by hitting the Preview button, which looks like this:

img10You’ll see an image in crosshairs, and some buttons at the top:

img11Click Straighten, and then Center.  You should now have your image all set to go.  Don’t drag it around, you’ll just ruin it.


Now, go back to the main window, and click the Stitcher tab.


Click Calculate Optimal Size to get the correct numbers in the boxes.  Then, click Stitch Now!.  After lots of thinking, you’ll end up back at the same screen.  That means it finished.  Now, check out the result!


It obviously needs some cropping, but I have to say it’s not bad!  Let’s open it in GIMP and finish it up.  I simply cropped it into a nice rectangle, tweaked the colors, and saved it as a 95% quality JPEG.  You can delete the TIFF file if you want – it’s probably huge.  Here’s the result:


So, now you too can make beautiful panoramas.  Here’s now I did recently from the top of Die Wank in Garmisch, Germany: