Create panoramic images from single shots with Hugin

Setting Control Points

The control points play a key role in stitching. These points, which you or the software set in two adjacent images, help the algorithm to determine the parameters for defuzzing and fuzzing.

Hugin uses the method selected in Preferences to determine the points. This has a considerable influence on the quality of the panorama. A status field of the main window displays the results of the alignment (marked with an X in Figure 3). If the error values are high, test whether another method provides better results or select other images if necessary.

Which images Hugin is currently previewing and using for combination is managed by the settings in Displayed Images. The software only includes images marked as active in this folder. You can see their positions in the panoramic image by mousing over the preview while holding down Ctrl (Figure 6). The software automatically highlights the thumbnails so that you can immediately see which images are incorrectly positioned.

Figure 6: Which part of the panorama is from which image? If you hold down Ctrl while mousing over the preview, Hugin will display the source.

Hugin shows you the control points in the Panorama Editor preview. If this is not the case, you can enable this view by pressing Shift+F3 or selecting View | Control Points | Show Control Points (Figure 7).

Figure 7: Hugin marks the determined control points in the preview with a colored X.

Control points located in clouds or other moving structures (such as waves or vehicles) are a bad choice for stitching. You will want to remove them. The Control Points dialog in the Panorama Editor is used for manual fine adjustment and for creating or removing control points. Figure 8 shows the window, and the "Alternative Algorithms" box explains the details.

Figure 8: For perfect results, Hugin lets you define control points manually.

Alternative Algorithms

Hugin comes with its own control point generator (CPFind). In many cases, this delivers good results, but it quickly reaches its limits with more complex images, such as those of the Nord/LB. Then it is worth taking a look at the alternatives: Autopano-SIFT is one of the best-known algorithms, but until recently it was protected by a patent. With the patent expired, it is now possible to use the algorithm freely. The original implementation requires Mono, which makes it a less than attractive option. A variant implemented in C (Autopano-sift-C) is now available for many systems. In the Nord/LB example, Autopano-sift-C finds about twice as many control points as CPFind.

You can enable the alternative control point generator either by default in Hugin's configuration or directly for the current project in the Panorama Editor (Figure 9). This very simple dialog is interesting for advanced users. It offers a good way of quickly trying out different parameters for a panorama, whereas the Assistant guides you through the options at a fairly leisurely pace. In the settings for Feature Matching, you can select alternative generators, while Optimize takes you to the additional parameters. You can also adjust the lens type here if necessary.

Figure 9: The most important options for panoramic images can be quickly adjusted in the Panorama Editor to try out alternatives.

In Figure 8, two adjacent images have been selected and are shown in the preview windows. If you click on one of the preview windows, the program displays a crosshair in both of them. You can now move the control point with the mouse pointer to achieve identical positioning in the two images. To move control points in both previews at the same time, hold down Shift while dragging the mouse. Holding down Ctrl moves the image in the preview.

This new item is now available in the list below the preview and activated there, assuming that the auto add button to the right of the list is activated. You can delete faulty control points in this list using Del.

The Zoom field to the right of this list lets you define how Hugin displays the images in the preview. The 0 key fits the preview images into the window, while 1 displays the preview at the original size.

The default is fit to window, which makes it difficult to place the control points in large images. It is therefore better to switch to a fixed zoom level. With auto fine-tune, you set the general location of new points manually and then determine their exact positions automatically. This procedure usually gives you good results.

From the Panorama Editor, after changing some settings, you can return to the Assistant by selecting OpenGL Preview. After determining the control points, this shows you a rough preview of the results. If things look crooked, the Move/Drag menu item lets you move and bend parts of the image to minimize distortion (Figure 10).

Figure 10: Moving parts of the image helps you compensate for collapsing lines or curved ridges.

Use the mouse to grab the panorama approximately in the middle and drag it down until horizontal lines (say on the ridge of the roof) actually look straight. However, this correction is often not necessary, as the software has probably incorrectly identified the control points in these cases. Sometimes it helps to select a projection other than the default (in Lens type in the Assistant) and use Crop to correct the area for the finished panoramic image.

Align and Crop

In the Assistant, use Align in the toolbar to launch the algorithm for arranging the images. The order in which they are loaded is irrelevant, since the algorithm follows the control points when positioning the images. This makes it all the more important to make sure the control points are set correctly.

The error message enblend: excessive image overlap detected; too high risk of defective seam line in the log window indicates that you tried to combine too many images with too large an overlap. Positioning errors usually do not cause the process to abort, but will result in faulty images. Figure 11 shows two typical examples.

Figure 11: One possible cause of error when stitching images is trying to combine too few or too many images.

In both cases, it is best to remove virtually identical images from the list until the error message disappears. Figure 12 shows an example: After the number of images was reduced from 26 to 16, Hugin computed an attractive panorama.

Figure 12: To create this panorama, the number of images was reduced in the test from the original 26 to 16.

Create

In the last step, Create, you define how the software combines the individual images (Figure 13). This is specifically about creating High Dynamic Range (HDR) and Low Dynamic Range (LDR) images.

Figure 13: Another dialog lets you define how the program combines the single images.

Hugin offers different variants: Exposure fused from stacks lets you combine LDR images to create an HDR image. Exposure fused from any arrangement lets you combine LDR images to create an HDR panorama.

In the upper field of the Size and File Format dialog, you can define the format for the output, among other things. JPEG means that the software only allows the use of LDR images, while PNG and TIFF support the use of HDR images with up to 16-bit color depth.

Sometimes it makes sense to use the images converted by Hugin for manual post-processing. By default, the program automatically deletes the used copies, but Keep Intermediate Images prevents this from happening.

Next, Hugin automatically enables an additional program, the Batch Processor. This controls the process of editing the PTO files generated by Hugin. In the best case, Hugin will automatically start the current project and finish it without errors. If errors occur, a window opens with related messages. Edit with Hugin lets you reread and edit the PTO files.

Hugin needs a generous helping of disk space to create the panorama. If you work with RAW files, for example, it first converts them into large TIFF files, which it then saves again – keeping the same size – when distorting and blending. Finally, an additional output file of several hundred megabytes ends up on your hard disk. The last step – but only this one – can be avoided by creating JPEG files first. For printing or further processing, however, TIFF files are by far the better choice.

In order to keep tabs on the volume of data, it is therefore recommended to create only LDR variants with JPEG as input and output format at first and use HDR-relevant options (exposure bracketing, 16-bit input images, TIFF as output format) in the second step only, once you have determined the matching images. Large panoramas should ideally be created step by step to find out whether the individual images are correct.

If you save the source images for several panoramas in one directory, another special feature of Hugin simplifies the workflow. The program offers the possibility to quickly group images that belong together – based only on the time of creation in the Exif tags – and convert them into panoramas. The Batch Processor, which was automatically activated in the last step, offers a Browse for images feature in the File menu. This takes you via a small dialog to a list of related images (Figure 14).

Figure 14: The Batch Processor automatically determines related images by reference to the Exif data.

Since the evaluation here is done only on the basis of the Exif tags, the software also classifies exposure series and other continuous shooting as belonging together, which then often leads to unwanted results. Nevertheless, this function proves to be a fast method for assigning images to a panorama.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Panoramas

    You can create a pleasing image by aligning multiple landscapes to form a panorama. But the alignment can be tricky, especially if the individual photos do not match.Tools like Hugin,Enblend,and Autopano-SIFT help you create that perfect seamless panorama.

  • Free Software Projects

    This month we look at photo stitching, photo gallery software, and the Atunes music player.

  • Free Software Projects

    We take a closer look at photo stitching, a photo gallery application, an audio player, and video-recording software. for a more complete summary of the article.

  • Fotoxx v35

    The Fotoxx image manipulation program offers highlights such as HDR and panorama functions, but where there is light, there is also shadow.

  • digiKam 5

    The freshly released digiKam 5 boasts a number of new features, brings many improvements, and ditches some legacy ballast.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News