I keep seeing these commercials for Windows Vista and their new panoramic photo maker. Knowing how the Linux hacker scene is, anything that someone makes there is almost guaranteed to be a Linux project to make something close. Well guess what, there is a really easy way to make panoramic photos from multiple still shots in Ubuntu! Further, not only am I going to tell you how to do this, I will show you with some shots of my own.
Ubuntu 8.10 – Earlier versions might work but you might have to find updated packages
A digital camera – Almost any will do, I use a 7 MP Kodak pocket camera and it is awesome.
GIMP – For cropping and converting the final TIFF result
How many and how close together?
From a few experiments I have, three wide overlapping shots or four close overlapping shots make good pans. When you get to more than three wide shots the panorama becomes rather wide and when you view the whole image the details are lost until you zoom in. However don’t let me stop you if you are going for a pan of a long street or city.
Taking the photos
Since lighting changes over time I find that the best pans come from photos taken quickly. Stand in one spot, start from one side and take a few photos with some overlap in the setting. Try not to get anything moving in the photo or you might end up with a dog with no hind legs, or only half a person
These instructions are for Ubuntu 8.10 Ibex.
Setting up the software
The programs I use to make panoramas are Autopano and Hugin. Open Synaptic and search for autopano, install the autopano-sift package. Next search for and install Hugin. Now there is one little bug in Ubuntu, a dependency for Hugin is the package Enblend which contains the program Enfuse which is used to stitch together the photos. The problem is, as of Dec, 14th 2008, Enfuse is not in the Enblend package! To get Enfuse you must install the Ubuntu Juanty Enblend 3.2 experimental package.
I haven’t seen any ill-effects from installing this package but your mileage may vary, just be careful if you use any other programs that require Enblend.
Making a panorama
I have some shots of a house I took today that I will use to show you how to make a panorama, here are thumbnails of them.
The first step in making the panorama is to map overlapping points in the pictures, to do this we use Autopano. Copy your source pictures to a new directory so the originals are safe. Open a terminal window and navigate to this directory. For the example, I made a folder ‘home_winter’ on my desktop and entered ‘cd ~/Desktop/home_winter’ on the command line to get to that folder.
Now type in ‘autopanog’ in the terminal and hit enter. The Autopano GUI should load. I am not too versed in the options of Autopano but the defaults seem to work well. Click the ‘Add Images’ button and select the images in your directory. Now all that’s left is to click ‘Compute’ and let Autopano map common points between the photos. This should only take a minute or so, it might be longer for larger photos or more than a set of three or four.
The software that really stitches the photos together is Hugin. If you installed from Synaptic, you should have ‘Hugin panorama creator’ under your Applications>Graphics menu. To make the panorama we are going to open the project Autopano created and render the final image.
In Hugin, click File>Open and navigate to the folder with the image files, in this directory you should see a few new files and a .pto file (mine is named output.pto). Open the pto file. If all is successful you should be able to click ‘Align’ and after a few seconds see a quick layout of your images in panoramic form. Using this preview window you can play with the layout and enable/disable some of the images.
To make the final panorama, close the preview window and click ‘Create Panorama’ in Hugin, enter a file name such as ‘home_panorama’ (no extension like .jpg or .png) and click save. A whole mess of commands will run and in the end your panoramic shot will be in the directory you chose, named what you selected with _fused.tif added to the end!
If you get an Error: 127 message when clicking ‘Create Panorama’, most likely Hugin can’t find Enfuse. Try re-installing the experimental package listed above.
That’s it, here is my final panoramic shot.
[I would put the raw output image up but it's TIFF format and 37 Megs! Clicked the cropped one below to see the results]
As you can see Hugin translates your photos via some cool algorithms to make things line up, which results in curved edges and a transparent background. To make a clean rectangular image, open the TIFF in GIMP and select a region inside all the edges. Click Image>Crop To Selection. Next click File>Save a Copy and save to a format of your taste. Here is a cropped JPG of my panorama.
That’s it! Simple really, now go out and make some cool panoramas!
There are a TON of options in both Autopano and Hugin that allow you to match lighting exposures, sync more points between photos, etc. I’m not too sure what they all do, if you have some suggestions for this tutorial, leave a comment below.