Rescuing Difficult Panoramas on Linux, Hugin part 2
Control Points, Upgrading Hugin
Hugin, as discussed in part I, is an amazingly powerful program for stitching together big panoramas.
But sometimes it mysteriously gets confused, and no one seems to know why. Sometimes scaling the input photos to smaller size will help, but not always. Here are some ways to rescue those confused panoramas.
Adding control points manually
If it looks like Hugin hasn't matched your images properly, you can adjust the points Hugin uses to match the two photos. Use the Control points tab. Initially it will show the same image in both windows, so change the right image manually using the dropdown menu.
If Hugin is already showing a list of control points it added automatically, you may want to remove those: select all the points in the list at the bottom, then click Delete.
Now add some new control points. Click on an identifiable feature in the left image: a magnified square will pop up (Figure 1) to help you place it precisely. Then click on the same feature in the right image. The Add button adds the pair of control points.
For all but the first point, once you choose a location on the left, Hugin will probably find the matching point on the right. Try to use at least six pairs of points, and space them out as much as you can.
Occasionally Hugin will complain that it can't find anything that matches. In that case, go ahead and add the point, but you might want to add an extra point nearby.
Fixing harder problems: Upgrading Hugin
Unfortunately, there are a few problems that are impossible to fix in the version of Hugin you'll find on most Linux distros.
Hugin seems to be especially confused by vertical panoramas. For instance, you might shoot a normal horizontal photo of the bottom of a building, then tilt the camera upward a little and take another shot, and another. If you try to stitch this sort of panorama, you may get a preview like Figure 2.
Believe it or not, Hugin has aligned those images correctly -- but the result is all scrunched at the top of the view.
Fixing that, unfortunately, has only become possible in very recent versions of Hugin. So you'll need to go beyond your distro's version.
Compiling Hugin from source is fairly difficult: see the instructions for various distros on the Hugin downloads page. But Ubuntu users can find fairly up-to-date packages at Tattered Moons, and Fedora users can try the panotools wiki.
In these newer versions, the fast preview window adds a series of tabs: most usefully, a Move/Drag tab. Not only can you move the panorama away from the corners of the viewport (an irritating problem with the older version), but moving it changes the projection. (You might think you'd use the Projection tab for that, but you'd be wrong.)
In the Move/Drag tab, carefully drag center of the squashed image down into the center of the window. Note how the shape changes (Figure 3). Make sure your mouse is on the center line for both your start and end points -- if you get off center, the end result will be tilted, and there's no "Undo" in the Move/Drag tab -- you have to quit Hugin and start over.