Stitching Panoramas With Hugin and Some GIMP Post-Processing

Here’s how I created the panoramas that I posted to my GUADEC 2010 photo album (on Flickr and on Picasa).

I used the Hugin panorama photo stitcher and did some post-processing using GIMP. Hugin should be available in the repositories of your GNU/Linux distro, and it’s dead simple to use.

These are four pictures I took at the intersection of Grote Halstraat, Hoogstraat, and Gravenstraat in The Hague with a camera phone. I made sure that the pictures have enough overlap. (The Hugin tutorial recommends 20% to 30% overlap.)

Advertisement

The first step with Hugin is to load the images. At this point, Hugin loads some camera and lens data from the meta data that is embdedded in the image files. The Motorola Milestone that I used didn’t store this data, so I am presented with a dialog where I have to enter the “horizontal field of view (HFOV)” of the camera. I couldn’t find this data for the Milestone (or the Droid) on the web, but someone suggested an HFOV of 53 degrees for the iPhone, so I simply use that. “Focal length” and “Focal length multiplier” are automatically filled in by Hugin.

Hugin Assistant Hugin camera and lens data

Next, click “Align” and let Hugin do its work. After about a minute, a panorama preview comes up.

Hugin panorama preview

I am satisfied with the preview, so I close it. (Later I’ll briefly talk about problems you might encounter.) Click the “Create panorama…” button. After another minute or two, Hugin produces a high-quality panorama.

Initial panorama produced by Hugin

There are of course some problems with it:

  • The image is not rectangular.
  • What Hugin did with the person in the foreground looks a bit creepy.

I will use the GIMP to solve these problems.

First, to remove the person, I would normally use the Clone tool to paint over it. (Everyone loves the clone tool.) However, you can save yourself some work and have the Resynthesizer plug-in do it. Here are some examples of what the Resynthesizer plug-in is capable of.

Use the Free Select tool to select the person. Then click “Filters” → “Map” → “Resynthesize…”. You can accept the defaults. After some processing, the person is gone. While the manipulation is very noticeable when you zoom in, it will be good enough when the image is finally scaled down.

Finally, I use “Image” → “Crop to Selection” to cut out a rectangular area. This has the beneficial side effect of getting rid of most of the Resynthesizer artifacts at the bottom near the tramway tracks.

Here’s the final result (click to view in full size).

Final panorama

Problems you might encounter:

  • Sometimes the panorama comes out heavily distorted or cropped. I am usually able to fix these problems right inside the preview window. You can try several things there: Change the projection, use “Drag” mode to straighten the panorama and to move it to the center, and use the field of view sliders to fit the panorama into the view. What you want to achieve is a nearly rectangular image close to the center. If you change anything in the preview, you need to click “Align” again in the Assistant view.

    Heavily distorted panorama

    Panorama using Fisheye projection dragged to the center
  • Sometimes when the image quality is very bad, when there is not enough overlap between the images, or when there is too little detail in the images, Hugin will ask you to set control points manually. I didn’t have to do this for any of the GUADEC panoramas, so I assume this isn’t the common case. When this happens, see the Hugin tutorials for more information.

Advertisement

One thought on “Stitching Panoramas With Hugin and Some GIMP Post-Processing”

  1. Thanks for mentioning the HFOV you tested; I had no idea where to start. 53 is working fine for my droid & I.

Leave a Reply

Your email address will not be published. Required fields are marked *