Stitching HDR and LDR Panoramas in Hugin

High-dynamic-range imaging (HDRI) is the compositing and tone-mapping of images to extend the dynamic range beyond the native capability of the capturing device Wikipedia.

Consequently, LDR refers to images with dynamic range within the native capability of the capturing device, or that of the display device – My definition.

It follows that to capture a high dynamic range it is necessary to take a number of shots of the same subject at different exposures, a technique known as bracketing. Modern digital SLR cameras usually provide auto-bracketing meaning that a bracket of three or more shots can be made as a rapid sequence, with a single press of the shutter button.

In Practice

On a recent visit to Media City at Salford, I shot a set of bracketed exposures which I have just stitched using Hugin. Although I have been using Hugin for several years (and Panorama Tools before Hugin) I am not a frequent user and do not consider myself an expert, rather an enthusiastic amateur. What follows is therefore based on personal experience.

I am using the latest version of Hugin, 2017.0.0. released July 2017.

The first thing to realise is that the user interface offers 3 options: simple, advanced and expert. The simple interface is all that is needed for a normal low dynamic range (LDR) panorama. For the high dynamic range (HDR) process it was necessary to use the advanced interface.

I always shoot raw. If you are using a digital SLR with a good lens and lots of mega-pixels why compromise? It might be necessary to accept jpeg images if you are shooting a sequence and require a high frame rate, but wherever possible I shoot raw so that I can get the best out of the saved images in post processing.

Shooting images for panoramas is a topic I have described previously. For the project described here a tripod was necessary as it was late evening and the light was fading rapidly. A panoramic head was not used as the subject matter was at a distance of a few hundred metres and parallax would not be a problem. A ball and socket head with a separate clamp screw for the panning motion was used. The nine images are shown below:


I almost always shoot from left to right. Each row shows three shots at 0EV, -2EV, +2EV using the camera’s auto-bracketing facility. On this occasion I allowed the camera metering to set the 0EV exposure. The rows from top to bottom are the left, centre and right frames of the panorama.

Hugin does not accept raw files so it is necessary to process these to tiff files, and my raw processor of choice is RawTherapee. My article “Which raw processor” may be of interest.

A Simple LDR Panorama

For the benefit of anyone not yet familiar with Hugin I will first describe the “Simple” interface which produces a very good result automatically using just the 3 “correctly” exposed shots – i.e. those in the first column.

Select: Interface>Simple to open the Assistant tab.

Click 1. Load images and select the 3 images.

Hugin usually detects the Lens type, Focal length, and Focal length multiplier (aka “crop factor”)

Click 2. Align This refers to the positioning of the images relative to each other prior to stitching. The process will take a few seconds depending on the size and number of image files and the speed of your processor.

A message in the top right of the window will show the number of control points and the mean error in the alignment. In the early days of panorama stitching it was necessary to insert control points manually. This involved identifying matching features in the overlapping areas of adjacent images. Hugin now does this automatically but the manual function is retained. This means that extra control points can be added or unwanted control points, e.g. on clouds or in water (which might move between shots), can be deleted.

Click 3. Create panorama. This opens a window as below:


The width and height of the panorama is shown as a number of pixels. The file format and compression may be selected, and in this case we are only offered a (normal) low dynamic range output (as we are stitching only three images). Click OK and you are prompted to save the project. This creates a .pto file which allows you to come back to the project if you wish to run the process again. The stitching process could take a few minutes depending on the number and size of files and, of course, the speed of your processor.

The final result showed quite a difference in brightness of the sky from left to right as the sun had just set near the left hand edge of the panorama. I reduced this difference by applying a graduated filter horizontally in RawTherapee. The final result is shown below and is currently used as one of the header images on this site:


An HDR Panorama using the Advanced Interface

Returning to my full set of nine images, we start a new project in Hugin and select: Interface>Advanced this time. You can drag and drop the images into the “Photos” window and you will probably have 9 images in 9 stacks. I believe that Hugin tries to sort out the stacks but sometimes, as in this case, fails. It was necessary to drag and drop each individual file into the appropriate stack as shown below.


(Note that I have reduced the image sizes for this demonstration to speed up the processing – I would not normally do this).

Accepting the default values for Settings, Geometric and Photometric, click “Create control points” – I got the message “Added 40 control points” and clicked “OK”.

This enables the Geometric alignment optimisation so click “Calculate”. A set of values are presented with the option to “Apply the changes?” Click “Yes”.

Finally click “Calculate” for the Photometric optimisation and again click “Yes” to apply the results.

Ignore the next tab “Masks”.

The next tab “Control Points” allows you to inspect the control points that have been automatically created. It is possible, and sometimes necessary, to add extra control points manually. You will see a few in the sky, which I should have deleted – clouds often move between shots – in the event I skipped this tab and the panorama stitched ok.


When we are happy with the control points we move to the “Stitcher” tab.

The first choice to make is the projection (or perspective). As this panorama is 148 degrees wide, Rectilinear perspective (as in each component image) is out of the question and the default of “Cylindrical” is a good choice. (Note that in Advanced mode Hugin shows the field of view in degrees). A whole article could be written on projections, and very probably has been, so we won’t go any further here.

If you accept the default settings Hugin will crop the final image to a rectangle. I usually make final adjustments to the panorama and crop and re-sample for projection in RawTherapee or Gimp.


Lower down the “Stitcher” tab the output formats can be selected. Because we provided stacks of images, Hugin recognised that an HDR panorama was possible and by default selects the EXR format. This is ideal for later tone-mapping in, for example, Luminance HDR (formerly QTPFSGUI), but that’s another story.

If we select “Exposure fused from stacks” a normal LDR output as a TIFF file can be produced.


If you are using Hugin maximised on a large screen you might easily miss the “Stitch” button in the bottom right hand corner – but the process does not start until you hit it.

The default LDR “Exposure fused from stacks” is shown below. Hugin appears to have equalised the exposures across the width of the panorama, resulting in a consistent tone in the sky but an unreal difference of tone in the buildings at right and left – a rather disappointing result. I much prefer the image shown earlier in which the sky is more as I remember it.

P1548 - P1559-9imagesLDR_fused

A Tone-mapped Panorama

The HDR file in EXR format produced by Hugin was processed in Luminance HDR. I am not very familiar with this program but the process of tone-mapping proved to be straightforward and the final image is shown below:

P1548 - P1559_hdr_pregamma_1_mantiuk08_auto_luminancecolorsaturation_1.4_contrastenhancement_1.71

This looks very much like the simple LDR panorama first produced, before cropping and applying the graduated filter. The result of tone-mapping depends on the operator used and the associated parameter settings – the above used Mantiuk ’08.

Hugin has done an excellent job of stitching, as always, and in many situations its automatic blending of stacked exposures will produce a satisfactory LDR image. In this particular example the variation in brightness of the sky from left to right is a feature which we want to retain in the final image and Hugin has “smoothed this out”. It may be possible to make manual adjustment to Hugin to reduce the effect of this photometric equalisation but I am not aware of this. It appears that to have maximum control of the end product it is best to save the HDR file from Hugin in EXR format and process this in Luminance HDR or some other application.


%d bloggers like this: