This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature

Hugin paints a panoramic picture

By Luigi Paiella on August 24, 2005 (8:00:00 AM)

Share    Print    Comments   

I like to spend my vacations in places with wide-open vistas, and I love taking pictures of those views. I'm not a professional photographer, and I like the convenience of digital cameras, but sometimes the photo I get is not what I imagined: the area taken by the camera is just too small. Modern digital cameras offer specific functions that in conjunction with their own software can give us a panoramic view, but often that still doesn't give me what I want. When that happens, I can get the effect I want from Hugin, an open source interface to other open source tools that helps easily transform your pictures into panoramas.

Hugin is available in several different languages and is cross-platform; it can run on Linux, FreeBSD, Mac OS X, and Windows. I installed Hugin under Kanotix, a Debian-based distribution, following the instructions available at the download page. In order to use it, I installed wxwindows with xrc extension, panotools (libpano12), enblend (optional, but I recommend installing it), and, of course, hugin itself (version 0.5beta20050404).

To create a panorama, you join two or more consecutive, partially overlapping images in JPG, TIFF, or PNG format, telling the software which are the corresponding reference points from one picture to the other. With Hugin you don't need the pictures to have the same exposure, to be created with the same camera, or in a special camera mode. In fact, Hugin lets you use every kind of image, including scanned ones. However, in order to get good results, you should take your pictures without a dramatically different exposure, with a certain level of overlapping (a minimum of 20%-30% of the same portion of view have to be contained in both the consecutive pictures), and with recognizable spots in the overlapping area. Ideally the spots should be available around the whole overlapping area and not just in a limited small region of the pictures. If you choose moving points (waves, leaves in the wind, fast clouds) the images will not match and the results will be unpredictable.

To practice, and to save time, you can try Hugin with reduced-size pictures. Define all the parameters and, after having made the tests, use the discovered best parameters with the full-quality images.

Figure 1
Figure 1 - Part 1 of the Panorama
Figure 2 - Part 2 of the Panorama

Below you can see two pictures (see Figures 1 and 2) meant to be parts of a panorama: they represent the left and right sides of the Apella beach in Karpathos island, Greece, one of the most beautiful beaches in the Mediterranean Sea. Each is a JPG image, 1984x1488 pixels, that takes up about 640KB of disk space. We'll work with them to illustrate how to use Hugin.

You can start Hugin through the shell with the command hugin. The clean interface contains a menu, a few buttons, and five tabs. You can make a panorama by going through the five tabs in order.

In the Images tab you upload the pictures to be joined, leaving the "crop factor" as set by default. You don't have to upload the pictures in precise order, but I recommend following a left to right sequence to avoid confusion, especially if you have more then two pictures.

Next, the Camera and Lens tab provides adjustments for several technical aspects, but the only one strictly necessary is the field "degrees of view (v)." Select the first picture and change this field value to 40, which is the standard value for normal cameras.

The third tab, Control Points, lets you define the references points the software uses to understand how and where the pictures are overlapping. Here we find two views in which we select the image 0 on the left panel and the image 1 on the right one (all the pictures we upload are identified with a sequence number starting from zero). Be sure you've selected the options "auto fine-tune" and "auto estimate" on the lower part of the panel. Start identifying the control points, choosing points that are highly recognizable (such as edges and contrasted areas) and available in both pictures. Even if the selection in the second photo is not so accurate, Hugin can adjust it automatically. If the second point is unrecognizable, Hugin will issue a warning message and let you retry. You can confirm the pair by right-clicking.

Hugin requires typically seven to 10 control points. Adding more usually does not increase the panorama's quality. You can see the control points I chose, some rocks edges and some trees details (see Figure 3). Note that I tried to spread the points as much as possible in the vertical and horizontal directions: the broader scope helps the software align the pictures in the best way.

If you install the Autopano-sift application you can create your control points automatically by pressing a button in the first tab (Images). I usually avoid using this because I prefer to decide the control points by myself; Autopano-sift works well in recognizing the pairs, but I feel it takes points too close to each other, leading to a possible final distortion of the panorama. In addition, I like seeing how Hugin is able to automatically center the points on the second picture even if the clicks are not so precise.

Figure 3
Figure 3 - Selecting Control Points

On the fourth tab, Optimize, just click on the Optimize button to adjust image orientation and lens settings.

In the fifth and final tab, Stitcher, choose the option "Stitch the images into a high-quality TIFF file". That tells Hugin to use the nona stitching engine and Enblend (soft blending option). Enblend smoothes the transition between two pictures, especially if the exposures are not the same. In addition to the open source stitching engine nona, which is part of Hugin, Hugin can use PTStitcher, but it seems to be available just in binary format. Note that nona supports the Enblend option only when the output is in TIFF format. PTSticher can use Enblend with any output file format.

On the Stitcher tab, make sure you select the option "as a rectilinear panorama." As a rule of thumb, use the rectilinear option for a two-picture panorama, equirectangular for more than two pictures, and cylindrical for 360-degree panoramas.

Click on "Calculate Field of View" to let Hugin recalculate the panorama's dimensions. Finally, click "Stitch now!" and choose the name of the output TIFF file. After few seconds or many minutes (depending on your hardware and the quality level of the starting images) Hugin creates the panorama (see Figure 4).

Figure 4
Figure 4 - A Hugin Panorama
Thebe in Celestia
Figure 5, the final product - click to enlarge

You can still make some adjustments to finalize the image. The simplest way is to open the image with the GIMP and crop a rectangular selection of your panorama to eliminate the areas you don't care for. Figure 5 shows the final result I made.

After you've had some practice creating panoramas you will be able to improve your images using the many options and fine adjustments that Hugin provides. Complete documentation and useful tutorials are available at the Hugin Web site. I recommend in particular the tutorial explaining how to use Hugin to join portions of a scanned document when the original is too big to fit on your scanner.

Share    Print    Comments   

Comments

on Hugin paints a panoramic picture

Note: Comments are owned by the poster. We are not responsible for their content.

please specify the license

Posted by: Anonymous Coward on August 25, 2005 06:26 AM
good article, but you forgot to say what license this application is released under. Is it GPLed?

naming the license should be part of any and each application review

#

GPLed

Posted by: Anonymous Coward on August 25, 2005 08:43 AM
or so says <a href="http://sourceforge.net/projects/hugin" title="sourceforge.net">the SourceForge page</a sourceforge.net>. panotools (libpano12) and enblend are also under that license

#

Awesomes!

Posted by: Joseph Cooper on August 25, 2005 10:57 AM
I could actually use this program, I've needed a way to "zoom out" recently what with taking closeup pictures of things and having no way to widen the field of view with that camera.

#

Nevermind.

Posted by: Joseph Cooper on August 26, 2005 12:22 AM
I can't get this thing to install. I downloaded the half dozen dependencies, but those dependencies have their own dependencies, and... So on.

I really don't have time to set this up at work. (I'd be using it for work.)

Code reuse is great and all but some things, it's just plain obnoxious.

#

Re: Nevermind.

Posted by: Anonymous [ip: 128.187.34.1] on November 07, 2007 04:33 PM
Use a real OS - one with a package manager.

#

Panotools needs an update

Posted by: Anonymous Coward on August 25, 2005 03:18 PM
I take many panorama photos and I am very frustrated by the state of image stitching applications. It seems that those which effectively stitch have egregiously poor user interfaces and or incredibly stupid arbitrary limitations (Arcsoft I am talking about you!) the ones that have a passable UI have lousy stitching algorithms (like the tool that came with my canon). The default standard panotools requires multiple installations, separate font-ends, and practically a Ph.D. to get working correctly. So now I use Autostitch first and if it doesn’t work then I move on to Panotools/Hugin.

I know Autostitch is Windows only and I know it is not GPL (but it is free as in Beer). I also know it is far from perfect. However whatever these boys are doing under the hood leaves every other image stitching application I’ve tried far, far, far behind. Someone much smarter than me needs to revamp Helmut Dersch's algorithms and or a build a Hugin like UI for Autostitch.

As a side note the O'Reilly book "Assembling Panoramas" is pretty good.

#

Review is missing outlining capability

Posted by: Piobaire on August 25, 2005 04:25 PM
One feature is glaringly missing from all Linux word processors: useful outlining capability.

I have discussed this on some of the email lists for OOo and Abi and it seems unimportant to the developers, although many people have responded in agreement.

An outliner like Word has is crucial to the way many people think when they write. This is especially true of people with ADD or ADHD, where they can use that functionality to organize their thoughts. Hence, this could easily be considered a necessary function for disabled users.

OOo believes that their navigator menu provides that functionality, but it doesn't come close to what Windows word processors have given us for many years. This is a BASIC feature.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya