The first step in making any panorama is to take the pictures. You can read Manfrotto’s guide to making panoramas, which goes into a lot of detail about the actual mechanics of taking the photographs. Manfrotto, being a tripod company, will try to sell you a panoramic head for your tripod, to assist in the creation of panoramas. All I will say is that yes, these panoramic heads are useful, but they are not strictly necessary. The tighter of an area you’re trying to photograph, the more important this equipment will become. If you’re standing at the summit of a mountain on a bright, sunny day, you won’t even need a tripod, much less a panoramic head; if you’re trying to make a panorama of your cramped basement crawlspace, you won’t get very far without one of these. I don’t have one of these panoramic tripod heads, so take a look at my panorama gallery and decide for yourself if you need one or not.
For best results, you’ll need 30 to 50 percent overlap between your images. Also, you’ll probably want to set your camera into manual exposure mode, and meter for the average brightness across the entire panorama. This will ensure a consistent exposure between shots. If you don’t do this and you’re trying to make a panorama of an outdoor scene, the shot you take facing the sun will be significantly darker than the other shots, as the bright light from the sun causes your automatic camera to increase the shutter speed, letting less light in overall, and then you’ll end up with this weird panorama where part of it in the middle is all dark.
The tools we’ll be using to stitch the photos together are autopano-sift, hugin, and enblend. If you need help installing them, read my instructions.
This is what autopano-sift looks like. The interface is divided into two parts, the “Basic options” tab and the “Advanced options” tab. Frankly I find that the default options work really well in most cases. It should be fairly straightforward: click on “Add Images” to select which images you want to stitch together.
If your images need to be rotated before stitching, turn on “Automatic pre-aligning of images” on the advanced tab, select the orientation of your images, and turn on “generate horizon lines”. I haven’t had a great experience with the horizon lines generated by autopano-sift, but you can delete them later if you’re not happy with them. It’s better to have the option of deleting them instead of being stuck without them. Press “Compute” when you are ready to begin having autopano-sift generate the control points for this panorama.
Autopano-sift works in three phases: First it examines each image for keypoints, then it checks each image’s keypoints against each other image to look for overlaps, and generates control points based on what it finds. After that, it can optionally refine the keypoints, but this is disabled by default. I don’t find it necessary to enable refinement as it increases processing time and the results are really good without it anyway.
If you’d like a more in-depth walkthrough of every feature in autopano-sift’s GUI, Sebastian Nowozin (the program’s author) has provided a very slick walkthrough demonstrating every button and knob you can click on, which is available in flash or html.
Once autopano-sift is finished, you can load the resulting .pto file into hugin, which looks like this. You may notice that hugin has a button to launch autopano-sift for us… I have never gotten this to work. If it works for you, great! If not, that’s what this tutorial is for.
Right now, the lens settings for your camera are all wrong. If you are using a digital camera, the correct lens information is stored in the EXIF data, so you’ll need to select one of the images and press the “Load EXIF” button to continue. If you are using a film camera (and have scanned your negatives, of course), or your camera doesn’t attach EXIF info (this is rare), then you will need to enter the settings manually.
Now we can check that autopano-sift has chosen good control points for us. I usually skip this because I’ve never found a bad control point yet, as the SIFT algorithm used by autopano-sift is very accurate.
The control points look good, but we need to optimize the panorama before we can stitch it. Optimizing is hugin’s way of looking at the control points and then figuring out how to alter the images so that they overlap better. First, do the “Positions (incremental, starting from anchor)” optimization, and then do the “Positions (y,p,r)” optimization.
Each optimization serves it’s own purpose, you’ll get the hang of which ones to use when as you use hugin more. The “Positions and Barrel Distortion (y,p,r,b)” optimization becomes important if your camera’s lens introduces barrel distortion, which is very common, and “Positions, View, and Barrel (y,p,r,v,b)” is also a useful one.
It might be tempting to optimize for “Everything”, but that is recommended only when there is 50% overlap, and the control points are placed evenly over the whole overlap area. Otherwise the optimizer reduces control point error close to the boundary, but add strange bubbles or other distortions in the middle.
Once you have optimized the panorama, the preview window shows you how the images overlap. You will see very obvious stitch lines in the preview, but that’s fine because it’s not the final result: it’s only meant to show how well the images are lined up. As you can see, the images are lined up fairly well (there are no obvious breaks in the view at the image edges), but it is not quite what we were expecting… the image is a little warped and curving upwards on the left edge.
So, we want to straighten this out. First, I’ll add a vertical guideline onto the building visible in the leftmost image, so that it comes out properly. To add the guideline, make sure you have the same image selected on both the left and right side in the control points tab, then click once in the left pane, and once in the right pane. Each click should be at opposite ends of the guideline you’re trying to make. Once you’ve added the guideline, re-optimize the image and go back to the preview window to see what effect it’s had.
This alone is not enough as it would just make the right edge curve upwards instead of the left, so I’ll also add a horizontal guideline along the pavement in the rightmost image.
Knowing where to add guidelines and whether to use vertical ones or horizontal ones is largely an art… there are no hard rules, whatever works well for you is the way to do it. Generally, you’d want to use vertical guidelines on the edges of buildings, and horizontal guidelines only on the actual horizon (as hugin will adjust wherever your horizontal guideline is to be in the center of the image).
Unfortunately for me, in my rightmost image, there are no buildings to put a vertical line on, and the horizon is obscured by the trees. Luckily though, the paved path along the bottom is fairly straight and makes a good candidate for a horizontal guideline. This leaves us with a large black area below the panorama (as the paved path in the bottom of the photo is now the “horizon” in the vertical middle of the panorama).
Re-run your optimizations (this is necessary to “update” hugin’s understanding of the panorama after you make changes to the control points), and then load up the preview again. It seems to have worked fairly well! What we have now is approaching a passable panorama ;)
What I like to do is set the blend mode to “difference” and then only enable two images at a time to compare their difference. What this means is that hugin subtracts one photo from the other in the areas where they overlap, showing how they differ. Ideally, the overlapping area will appear as a solid black (meaning there is no difference), but in reality there will always be a little bit of difference. If you’re seeing large white splotches in difference view, to the point that you can see an outline of what is actually there in the photo, it’s likely you have bad control points or have done the wrong optimizations. The less parallax error you had in your source images, the better this will work out.
It might seem strange at first that hugin would allow your panorama to have a bend in it, but this is a feature, not a bug: it is because hugin allows you to have multi-row panoramas. As a side effect hugin allows you to take pictures at strange angles and line them all up regardless of orientation/angle. Other less robust programs will force you to only have one row of images, so they will be fairly good at keeping that one row straight.
Once you’re satisfied with what you see in the preview pane, it is time to stitch the image together. You will want to press the “Calculate Field of View” button so that the output won’t have too much of a large, empty margin on it. My experience has been that this works great for small panoramas, but for a panorama larger than 180 degrees, it will always set the “vertical” value to 180, regardless of how much vertical field of view you actually have. Check the preview pane to see how close your manually-guessed number is—if it is too high, you will have large black borders, and if it is too low, the images will be cut off.
Then you want to press the “Calculate Optimal Size” button. This will set a size for the panorama that is as large as possible, without needing to scale up the source images. Usually I just go with whatever value it sets, but I think anything over 20,000 is just too high. It will take forever to stitch such a large image, and it will be really huge when it is finished, also. So if you see it above 20,000, just set it back down to 20,000 and you should be fine.
Make sure your stitching engine is set to “nona”, and your image format is “Multiple TIFF”. The reason we use multiple tiff instead of one of the other formats is that we just want nona to line up the images for us, we don’t want nona to actually stitch them together, because enblend will do a better job of it when given the tiffs. It is possible to run enblend from within hugin by selecting “TIFF” format instead, and checking the “Soft Blending” checkbox, but I don’t like this because enblend is a slow program and it doesn’t show any progress bar for it, so you might think the program has crashed or something.
Once you have the settings as you like them, click on “Stitch now!” and watch as nona outputs all the large tiff files for you.
The next step is to run enblend on the TIFF files that were created by hugin. You’ll want to open up a terminal for this, as it’s a commandline application. Run enblend like this:
$ enblend -m 256 -v -o enblend.tif nona*.tif
There are a few parts to this command. First, the -m switch tells enblend to only use 256 MBs of RAM. This is important because if it tries to use too much, your system will run out of RAM, and it won’t be pretty. Setting this to about half as much physical RAM as you actually have is a good start. Then, the -v switch tells enblend to have more verbose output, so you can see what it’s doing. Otherwise, it’ll just sit there silently and you won’t be able to see what it’s doing. After that, the ‘-o enblend.tif’ tells enblend to save the final result into the file named enblend.tif. Finally, the ‘nona*.tif’ tells enblend to use all the files starting with “nona” and ending with ”.tif” as the input files (eg, nona0000.tif, nona0001.tif, etc).
Enblend is a slow program, especially when working on large input files, and it will require a lot of temporary disk space to do it’s job. But the results are worth it.
Here are the results from enblend, one large TIFF file. As you can see in the status bar of my image viewer, the file is 104.2 MBs and it is zoomed out to 10% here. The grey checkerboard around the edges of the picture are areas where there is no photographic data, so the image is transparent there.
Now it is time to touch up the image in your favorite image manipulation program (it doesn’t really matter what you use, as long as you’re comfortable using it). You will need to crop the transparent image borders off the picture, touch up any minor blemishes you find, and save the picture in a different format, such as JPEG, that will take less disk space. If you’re going to put it on your website, scale it down a bit, too.
This is the final result.
I hope this tutorial has been useful to you! If you need more information, the official hugin website has more tutorials available.