Photo #36

I love the purple and yellow colours of this flower. I think that it’s just opened which gives an interesting crinkly texture to the petals.

Posted in Photography | Tagged | 1 Comment

Exposure Compensation for 360 Degree Panoramas

In a recent comment thread on one of Ermine’s posts I remarked:

If you’re shooting in RAW then I wonder if it’s possible to edit the exposures in a way that doesn’t screw up the stitching? For example, if your shots into the sun are overexposed by 2 stops and the ones the other way are underexposed by 2 stops then it should be possible to edit the intervening images to make the exposure change as smooth as possible.

Well I eventually got round to investigating this and, spoiler alert, the answer is “yes, you can”. However it was inevitably a little more complicated than that and I expanded my investigations a bit but I think that it worked out quite well in the end …

I found one blog post that was doing a similar sort of thing and had some useful information.


A couple of things to note before the details of the investigation:


Calculating, editing and exporting the RAW images manually was not an attractive prospect so I wrote a small script to automate the process. This is available from my GitHub page.

One top tip – the script assumes that the start image is either the most overexposed ( directly at the sun ) or most underexposed ( directly away from the sun ). It makes sense therefore to start taking the panorama images in either of these directions otherwise you’ll end up with a manual image renumbering job!

Hugin Error Message

When running the Hugin stitching tool I had an error message:

enblend: warning: failed to detect any seam
enblend: mask is entirely black, but white image was not identified as redundant
enblend: info: remove invalid output image "fn.jpg"

There’s a note about this on the Hugin FAQ and claims that the problem should be fixed in Enblend version 4.0 and above. However I was using enblend 4.2 and still had the problem. I fixed it using the “–fine-mask” enblend parameter as suggested on the FAQ page but I have no real idea of why it happens because the image overlaps should be fine.

Exposure Fusion

Before looking at exposure compensation I decided to investigate whether it would be possible to automatically extract more information from each image using an exposure fusion technique. In theory this isn’t as good as a multi-exposure HDR image but I have had some success with it in the past.

For these investigations I used the first 8 images of the panorama to cut down on the processing time. Creating the images for the fusion process needs a RAW file as its starting point so I did this before stitching. I then just threw all these images at Hugin and it detected that there were stacked exposures in the second and third cases and so did the all the processing necessary. It’s possible to manually stack the images in Hugin but this wasn’t necessary. The results are below:

Base image with no exposure fusion

Image with +/- 1 stop fusion

Base image with +/- 2 stops fusion

There’s not a lot of difference between the three but I think that the +/- 1 version has the best balance between retaining the sky highlights and not making the foreground unnaturally light. Hugin had no problem with the stitching of the images.

Exposure Compensation & Fusion

For the full exposure compensation and fusion process the steps were:

  1. Manually examine the brightest and darkest images of a panorama sequence and decide on the amount of compensation that was needed for each.
  2. Decide on the photo fusion compensation, in this case I used +/- 1 stop
  3. Run the script to create the images. In this case there are 36 images making up the panorama ( one every 10° of rotation ) and three for each image for the fusion so there will be 36 x 3 = 108 images in total.
  4. Run the fusion and stitching process using “Hugin”.

Needless to say it took a while to run the whole process and the results are below:

Panorama with no compensation

Panorama with variable exposure compensation

Panorama with variable exposure compensation & fusion

A few points that I noted:

  1. There is little difference between the no compensation and the variable exposure compensation which is slightly surprising. I think that this is because Hugin does some exposure compensation of its own when stitching the panorama. Considering that it has to work on the JPG image whereas the exposure compensation script uses the RAW image then it’s pretty good I think.
  2. The exposure fusion I think is better – the detail in the sky on the left hand side has been recovered and the foreground is a little lighter and clearer.
  3. The fusion version is a slightly different aspect ratio. I’m not entirely sure why this happens. Maybe it’s to do with the “–fine-mask” enblend parameter which was used in the first two but I’m not 100% sure.


All these combinations of photos took a surprisingly long time to compile but my conclusions are:

  1. It is possible to carry out some processing on the 360 degree panoramas to account for the different light conditions and get a better image at the end of it.
  2. Hugin itself does quite a good job of exposure compensation but adding the exposure fusion as well gives an even better result.
  3. It takes a lot longer to stitch when you’ve got stacked exposures.

The next stage I guess is to go back and reprocess the panoramas that I’ve already done and check the improvements there …


Posted in Photography | Tagged , , | 8 Comments