The release notes for Hugin's latest update begin with the words "Hugin is more than just a panorama stitcher." That's been true for years, but only recently has the project made a concerted effort to emphasize the other photo magic that the application is capable of working. Better still, Hugin is making more and more of the process automatic, so aligning your images has never been easier.
In case you are unfamiliar with it, Hugin is a tool useful for bending and correcting photos in interesting ways. The initial use case was sewing side-by-side photographs together into a seamless panorama, but the bag of tricks has expanded considerably over the years. Hugin can instantly take the "warp" out of a wide-angle shot, remove color fringing from the edges of a picture, straighten the converging sides of a tall building when shot from below, and make other corrections that it would be arduous — if not impossible — to do by hand.
But it is not all work; Hugin can still play at the zany tasks, like stitching a series of images into a 360% virtual-reality picture, removing pesky objects (or people) from the foreground of a photo, and blending multiple exposures of a scene into a perfectly-balanced shot.
The new release is tagged 2011.04.0 — Hugin has adopted a time-based released schedule centered around three stable builds per year, but produces very awkward version numbers. You can grab the latest packages from the download page; distro-specific instructions are provided for Ubuntu and Fedora, plus binaries for Windows, Mac OS X, and FreeBSD, and compilation guides for several other Linux distributions. The downloadable packages include the main application, plus a handful of utilities that Hugin uses for specific tasks like blending photographs together without leaving an unsightly seam. Most of these tools were originally written to function as Hugin plug-ins, but they work as standalone apps, too.
There are two entirely new functions in this Hugin series. One is a lens calibrator. You take a picture of some ramrod-straight objects (preferably at varying distances), and the app measures the minro distortions in the picture to create a lens profile. On subsequent runs, Hugin will know with better precision how to adjust your images for perfect horizontal and vertical lines. The second is the ability to "register" (i.e., properly align) stereo images. Like the Viewmaster toys of yesteryear, stereo images can be used for a simple and fun 3D effect — but they are also useful to scientists extracting three-dimensional data of objects just from photographs.
It is not as immediately gratifying, but an arguably bigger improvement is the addition of complete scripting support with Python. This Python support works in both directions: you can write your own plug-ins for Hugin to automate tasks, and you can write Python applications that call library functions from Hugin. The possibilities here are excellent; for example GIMP also supports Python scripting — you could write a GIMP plugin to automatically stitch images together using Hugin without ever leaving the GIMP interface itself.
The project has already taken the first steps towards offering a different UI for its non-panorama tasks, in the form of the aforementioned lens calibrator, which can be launched from a separate Applications menu item that is installed alongside the usual Hugin panorama-creator. The calibrator is a stripped-down interface with no tabs and no extraneous features — just the image loader, preview window, and some options. Although on Linux it is a standard ELF binary, the new Python scripting interface makes crafting other sub-project apps far easier.
There are some incidental improvements too, such as composition guides (lines marking off the golden ratio or rule-of-thirds) to help you create eye-pleasing crops, but most of the other enhancements come in the form of increased automation in Hugin's core tasks. Hugin can now find the horizon automatically, and at long last has an automatic control point finder that is completely free of the software patent threats that have loomed over similar work. To really get a feel for the difference this sort of enhancement makes, you will need to fire up Hugin.
A Panoply of Fun
In older releases, Hugin's interface might have been disparaged as a clutter of buttons and numeric entry boxes with little help offered to guide the intrepid new user towards success. Luckily the recent releases have put an increasing emphasis on exchanging that paradigm for "assistant"-guided operation. Now, whenever you launch Hugin, you see nine tabs across the top of the window: Assistant, Images, Camera and Lens, Crop, Mask, Control Points, Optimizer, Exposure, and Stitcher. That sounds like a lot, but the key is that Assistant tab at the head of the list. Experts can dive right in, of course, but if you're new, the Assistant tab will walk you straight through the options.
To merge a set of side-by-side shots into a panorama (or simply a larger mosaic of photos), then the assistant will walk you through the process: where you need to perform a step (such as choosing the images from your hard drive), it will prompt you for action; where it can automatically proceed it will do so and report its results; where it encounters trouble it will suggest what you need to do next. In the accompanying screenshot, for instance, I ran into a stumbling block when I loaded my images in right-to-left order (when they physically were a left-to-right scan of the scenery). Naturally, Hugin couldn't figure out how the edges matched up.
Normally, however, Hugin can automatically locate the points where the photos overlap, and it tags them as "control points." Those points are how Hugin calculates how to squeeze and rotate the images so that they line up perfectly. It can also automatically crop the resulting panorama, find objects that should be perfectly vertical, correct the horizon line, blend the images to match variations in exposure, and pick out trouble spots like clouds that move between one shot and the next.
The list of automatic adjustments Hugin can make has grown considerably over time, but it is not yet at 100 percent. Sometimes you need to make tweaks. The output of the example I played with for these screenshots is available on Flickr; if you look closely you can see that the curve of the waterline and the fact that the horizon was hidden behind so many buildings left a few spots not-quite-vertical — but I can go back and fix those.
Here's the trick, though: if you want to get the most out of Hugin, you still ought to avail yourself of the project's excellent tutorials. If nothing else, they will teach you about the differences between the various options for output "projection" of panoramas. These projections are like map projections: you have different features important for different situations. Most of the time a big scenic panorama will be a "rectilinear" projection, but sometimes you want something else.
The tutorials are also an invaluable guide for Hugin's other features, such as blending multiple exposures into one shot, removing lens distortions from a single picture, or taking shots around a foreground obstruction and masking it out of the final product.
Under the hood, a lot of the math is the same in these functions, even though it might not be obvious at first. For example, Hugin creates seamless blends where two stitched photos by averaging the overlapping pixels together and making a smooth transition. Essentially the same calculations are involved in merging two exposures — except that the borders of the merged region are where the "bright exposure" and "dark exposure" meet, instead of the adjacent edges of the frame.
There is some fun stuff you can do with this fundamental similarity, such as focus stacking, where you keep the camera still and take pictures focused up close and far away. Hugin can merge them into a picture with everything in focus. This is not any different from the integration performed by the much-hyped "Lytro light field camera" — except that Hugin does it for free.
Off in the Distance
I don't want to mislead anyone into thinking that Hugin is a "hands off" application — yet. The increasing automation of alignment and stitching functions is great, but these days you still need to poke around a little to get a feel for the panorama, exposure stacking, or focus stacking workflow — and how they differ. Hugin is headed in the right direction, but the cost of its flexibility is that it is not as simple to use as one of those camera phone apps that attempts to stitch a panorama without your intervention.
However, that is precisely why I am fired up about the new Python scripting interface. Development of the assistant-mode and stand-alone calibrator features has been slow, but it had to be because there was no clean, consistent interface to Hugin internals. Now there is. I'm hopeful that the development community will work on assistant front-ends for the other, non-panorama features of the app (such as the aforementioned exposure- and focus-stacking). Those are simpler tasks and a lot of users will love to take advantage of them. I think there is also a strong chance that we will see GIMP plugins that use Hugin magic to perform minor miracles like automatically straightening the horizon — the door is wide open.