Create panoramic images from single shots with Hugin
Expert Stitching
Hugin is a tool for creating panoramic images, with many additional functions that make it a powerful supplement to your image editing toolbox.
Hugin is a free and open source program that has been around for years. Up to now, it has mainly been used to create large panoramic images from a few – or even many – single images. If you use Hugin correctly, you can create good panoramic images very quickly.
However, Hugin also supports other uses that include generating HDR images and computing super resolution images – large, extremely high-resolution images created by interpolation. Hugin also includes many advanced tools, for example, letting users determine the correction data for lenses (calibrate_lens_gui
). The align_image_stack
command, which is used by many other programs to align images, is also part of the Hugin package.
Hugin [1] was originally developed as a user interface for Panorama Tools, also known as PanoTools [2]. Later, support was added for the combination programs Enblend and Enfuse [3]. Hugin, PanoTools, Enblend, and Enfuse are all mature tools – Hugin was already producing panoramic images worth viewing 10 years ago, the developers have been working on Enblend and Enfuse since 2004, and Panotools was originally released in 1998 and has been continuously improved. The longevity of these tools shows that they continue to be useful even though many cameras now have built-in tools for creating panoramas that generate more or less capable results.
Keeping It Simple
With images shot in the right way (more on this later), creating a panorama with Hugin is simple. The main focus of Hugin's development work in recent years has been to improve the Assistant for combining panoramic images, also known as stitching. You just need to load the raw material and run the Assistant to complete the next steps. If you accept the presets and the images meet the requirements, the software computes the results in less than five minutes (Figure 1). It's especially easy if the images you're merging into a panorama are a landscape with the main features at some distance from the camera (Figure 2).
In the current version (2019.2.X at the time of writing), the Assistant comprises three steps (see Figure 3). Step one is loading the images. This is where you determine which image is used as the reference point for the white balance.
Step two is alignment, where you define the control points that allow the alignment of the images. Various algorithms are available for this purpose; if necessary, you can add or move control points manually.
Creating the panorama is the third step. To do this, the software distorts the images using the control points and then stitches them together by blending to conceal the transitions. This distortion is similar to a cage transformation in Gimp, where the control points serve as anchors.
Shooting Images the Right Way
The better the images fit together and the more they overlap, the more accurate the results will be and the less distorted they will appear. Many of these issues will need to be considered as you are taking the photos.
Parallax errors are one potential problem. These occur when you have captured the images to be combined from angles that are too different, and the relative position of elements within the photos appears to shift [4]. You can avoid or reduce parallax errors by rotating around the parallax-free fulcrum (NPP: "No-parallax point") [5], often incorrectly referred to as the nodal point. You can achieve this with a special adapter for the tripod. For landscape panoramas, however, this is often not necessary if you rotate the camera only by small angles and use large overlaps in the images.
Composite images created indoors or generally in confined spaces are far more difficult. Sometimes it is virtually impossible to take all the required images with low parallax from a single vantage point, although this would be preferable for automatic stitching. Sometimes only manual postprocessing of the single images or many attempts will achieve good results. The example in the "A Challenging Subject" box shows the overhead that can be required.
A Challenging Subject
The Norddeutsche Landesbank building in Hanover [6], Germany, (also called the Nord/LB) is considered an architectural highlight of the city. However, because it is nestled in the relatively narrow streets of the city center, it can be very difficult to find suitable locations to photograph the building well.
For nearly all sides of the building, you need to capture partial images and stitch them together. From any location on the ground, many parts of the building are difficult to see. In addition, there are problems with the lenses. It makes sense to use fixed focal lengths with short focal lengths and with the camera mounted on a tripod.
Stitching with Hugin quickly reaches its limits, and visible distortions begin to appear: the edges of the buildings, the skywalks and other structures then appear curved. While this is far from ideal, Gimp can help clean up the most serious errors (Figure 4).
With 360-degree panoramas, an additional problem arises from the exposure. This often differs so greatly when you combine shots taken against the light and those with the sun at your back that there may not be a consistent exposure setting for all the images. Exposure bracketing and several exposure cycles help in these cases. You then have a good chance of finding suitable images to create a harmonious panorama by manually selecting which single images to use.
Hugin's Assistant
The Hugin interface takes some getting used to, as it connects several elements and you sometimes need to switch between different dialogs on different levels while working.
By default, the program starts with a wizard called the Assistant, which has already been mentioned and that will be described in more detail. In the menu under User Interface, you will also find the options to activate an Advanced and an Expert mode. However, you may want to avoid these settings as you are getting used to the program.
Below the menu, in a kind of toolbar, you can access the various dialogs you might need from Assistant to Crop. Again, less is more at first: If the Assistant produces good results with the default setting, leave things be.
These three steps are all you need to create 360-degree panoramas, although you may want to adjust the exposure of the individual images to avoid distinct transitions. Then crop the result so that no empty areas are visible. Also, if you use RAW images, you first need to develop them digitally. Hugin can do this automatically, but it's usually better to do it manually (see the "Using RAW Files" box).
Using RAW Files
The current program version lets you use RAW files directly for processing. The required conversion into bitmap images is handled in a semi-automated way. For example, if you drag a group of RAW files from the file manager directly into the editing window, a dialog box appears (Figure 5).
Hugin tells the RAW converters to produce bitmap images in TIFF format with 16-bit color depth. This offers you pretty good possibilities for blending.
If there are already sidecar files for the imported RAW files from other programs, the software uses them to adopt the parameters for developing. However, it often makes sense to convert the images manually for the best quality. The results are usually better, especially if the light conditions were difficult when taking the pictures.
The Assistant will guide you through the steps automatically, and the result is a PTO file (a Hugin project file), which the program parses again later on, if needed, to load the settings. During a rerun, you can test additional settings, for example, by choosing alternative options or generating a HDR image as the output. You can add more images to the project at any time via drag and drop.
Hugin's Assistant will default to cropping the generated image so that no empty spaces remain at the edges. This sometimes reduces the size of the image unnecessarily. Missing information in the corners can be filled in with software such as Gimp by cloning or using the resynthesizer plugin. If you take this approach, you are free to manually resize the panorama image by setting up another frame under Crop or by using the handles to enlarge the area for the output.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.