Monday, 11 November 2019

Chromatic aberration in digital photographs

In my last post I wrote about my attempts to measure vignetting in the lenses I use with my DSLR camera. Another lens problem that the camera can correct (but only for Canon lenses) is lateral chromatic aberration.

To determine the amount of correction my lenses need I printed out a simple test chart and photographed it at a variety of focal lengths. I also tried different apertures, but the correction required does not vary with aperture. Here is one of my photographs.

Chromatic aberration tests

I tried to write some software to measure any disparity between red, green, and blue images, but failed to achieve anything usable. I settled for judging the error by eye using this simple Pyctools network.


The "reader" component has options to scale the red and blue images to minimise chromatic aberration. By adjusting the scale values and then re-running the graph I was able to find good values for each of my lenses, at several focal lengths for the zoom lenses. The "UVgain" stage makes it easier to see the aberration. Multiplying the U signal by zero and the V signal by 8 or 16 makes it much easier to tune the red scaling, and vice versa to tune the blue.

I've now reached the stage where I can process my "raw" camera images and get better looking results than from the camera's internal processing. I've combined all my chromatic aberration and vignetting measurements into an easy to use Python script. I expect to continue to improve it in future.