Vignetting Correction

Recently I took a very nice panorama photo of the bavarian Ammersee lake. I was lucky to be at the right place, at the right moment.
I shot a series of several hundred images with my new Sigma 100-400 mm telephoto lens at f=400 mm, with an aperture of f/8.

A few hours later I realized a problem: Stitching the panorama I found vignetting artifacts all over the clear blue sky (see below). And no matter what I tried, I couldn't get rid of it. Even though vignetting correction usually works great in PTGUI, it doesn't with my new lens at f/8. I will certainly remember to close down the aperture to f/11 next time...

A small section of my Ammersee panorama. A rather untypical type of vignetting, with a brighter ring around the center of the image, is noticeable in the sky regions only.

Since the vignetting effect should be the same in each image, it should be possible to remove the artifacts from the images. So I tried to do vignetting correction in Capture One 20. However, no matter how I set the vignetting correction parameter - the artifacts remained visible, very similar like with PTGUI.

At that point I started writing a vignetting correction software (actually its just a little script) on my own.
Experienced in microscopy-related image processing I knew that Python has great image processing libraries. For example, it can easily handle 16-Bit TIFF images.

The workflow is simple:

  • First I run image processing in Capture One (without vignetting correction) and save the processed 16-bit TIFF images.

  • The python script calculates a vignetting correction mask (see below), by averaging over a set of selected calibration images showing only clear blue sky (spoiled by vignetting artifacts).

  • Since the calibration images certainly will have a gradient, I turned the averaged image by 180° and calculated the average with the non-rotated average image. Here I make the assumption that the vignetting is symmetric around the center of the image.

  • Then I normalize the mask by the maximum intensity (for each RGB channel). Assuming that vignetting correction generally reduces the intensity of an image, the correction mask should have values greater than 1.

Averaging over the calibration images shows the vignetting in detail. Vignetting reduces the intensity by up to 4% with respect to the corner regions.

Now, having a correction mask, we can correct each image by multiplying pixelwise with the correction mask.

Make sure not to exceed the 16-bit range. This can either be done by clipping at the value of 65535, or by scaling the intensity of the whole image set. I chose the first option.


The processed images are saved as TIFF files and can be loaded in PTGUI.

Hold on, there is one step missing. In our workflow (image processing in python) the images would normally loose their exif data. This EXIF information contains the camera settings, which is good to have in PTGUI. Fortunately there is a nice tool name ExifTool which helps us to copy the exif data from the original image to our processed image.

Now we can replace the vignetted images by the corrected ones, and reload the PTGUI project.


Vignetting has been perfectly corrected

The python script for vignetting correction can be download from my github repository:

https://github.com/TomNaiser/Gigapixel-Tools/blob/main/VignettingCorrection.py