Having been to DebConf7, I took advantage to visit a few beautiful places around the venue. Some of them are very hard to photograph with a common camera, specially when you’re trying to capture the full landscape from a hill or the complete sensation from a room in a castle —with all the walls covered with paintings and complicated ornaments—. So you have to resort to taking many pictures, but that’s not like the real thing.
Coincidentally, some time ago I’ve been researching some image processing topics, and found some amazing algorithms for automatic blending of multiple pictures to create mosaics of them. But I’d yet to see some ready to use implementation. Then, somebody from the table at the hacklab in DebConf7 enlightened me: hugin was the solution!
I have to admit it: the first attempts were really frustrating. A good time lost trying to adjust the images and the result was a nonsensical patchwork of images. So, take this in mind, and do what I didn’t: read the fine manual (and the tutorials). The manual is not very useful, but there are plenty of tutorials in the website.
So, the process is more or less like this: load the images, indicate where they overlap (setting control points), optimise, preview, adjust the control points, repeat until done. Setting the control points is what will determine how the images blend; but the most critical task is remember to run the optimiser before previewing or you won’t see your changes correctly! Here you can find a small tutorial that summarises the basic operation.
|File list and basic controls||Setting the control points||Preview of the final image|
There are some optional tools that you’d like to have installed along with hugin:
- A tool that automates the most tedious part of creating a panorama: setting the control points. Note: you will have to change the default executable name in the hugin preferences to “autopanog”, as the default is wrong. Sometimes it works perfectly, sometimes it need to be helped by manually adding control points or horizontal/vertical lines, some other times is of no use at all. Your mileage may vary.
- Since autopano-sift runs in the mono environment, you would need this to execute it as a normal binary.
- Replacement for the tool provided with hugin for blending images, with much better results.
A big problem I had was that hugin asked me some “crop factor” which is proportional to the size of the camera sensor, but nowhere is documented what that means. So, if you bump into this, you need to get the diagonal size of the camera CCD in mm and calculate 43.3 / diagonal. To get information about that, in this page you have a nice explanation about CCD’s sensors sizes. In the same site, you will find information for most digital cameras. If you don’t put correctly this value, most probably you won’t get any good result.
I’ll recommend you to also read this article, which explains how to use autopano-sift and the replacement blending tool, and gives some very good tips. Experiment and you will be amazed of the results!
To put an end to all this chatter, here is an example of a 360° panorama I’ve created from 23 pictures taken from the top of the Arthur’s Seat hill in Edinburgh. The control points were created with autopano-sift, and later added manually some horizontal lines to put the horizon into place, and some vertical lines in the monolith. The final blending was done with enblend, and the finishing touch is to crop it and convert to JPEG with gimp and copy the EXIF headers with jhead.
Hugin is available in Debian since Etch, and in Ubuntu since Edgy