rft's Photography / Tips & Tricks

Correcting Chromatic Aberration of Digital Cameras

The photos taken with a number of compact digital cameras are plagued
by various amounts of chromatic aberration. The following method can
be used to reduce the most visible effects of chromatic aberration.
Originally this has been developed to cope
with the high amounts of
chromatic aberration in cameras such as the Nikon Coolpix 990. Since
then, Photoshop has gained the functionality to perform this correction
on raw images. It seems that Photoshop uses a very similar procedure
as described on the original page, where
Photoshop's color noise reduction acts as a
desaturation step. Sadly, Sigma Photo Pro, the principal raw converter
for Sigma cameras, does not include such a procedure.
Although the lens of the Sigma DP1 is of exceptional quality
a small amount of chromatic aberration is uncorrected. Here
you will find a Photoshop action that can be used to reduce this
remaining chromatic aberration.

Sigma DP1

If you want to skip the explanations and just download
the relevant action sets click on one of the following links:

Actions for the Sigma DP1

Actions for Nikon Coolpix 990 (outdated)

Introduction

There are two different phenomena that commonly run under the name
colour fringing: chromatic aberration and
blooming. Chromatic aberration is
a deficiency of the lens that results in colour fringes that are only
present on the peripheral parts of a photo. Another clear indication
of chromatic aberration is, that the coloured fringes only appear on
non-radial edges and their colour depends on the orientation with
respect to the center. Here is an enlargement of an example of
chromatic aberration that was taken from a part of an image that was
close to the left upper corner (note the reddish and greenish fringes
of the bright regions):

chromatic aberration

Image part enlarged by a factor of two.

The blooming phenomenon is a problem of digital sensors that
is caused by charges spilling over into the neigbouring pixels and
is only visible in photos that contain regions that are clearly
overexposed. These regions may have coloured fringes that can appear
anywhere in the photo, even in the center, and the fringes have the
same colour in every direction. Here is an example for such
blooming fringes around the highlight near the center of
the image:

blooming

Image part enlarged by a factor of two.

Some photos exhibit a combination of these two effects, which makes
it very hard to correct them. On this page we limit our efforts to
develop a method that ameliorates the effects of chromatic
aberration only.

Correction of Chromatic Aberration using
Software Tools

Since chromatic aberration is a deficiency of the lens that is based
on different indices of refraction for different wavelengths, the
effect on the image plane is a differently scaled images for different
colours. The obvious solution for fixing this problem, is to scale the
different colour channels of the image by a different scale factor.
Since in most cases the colour of the resulting fringes is green
and red on non-radial edges near the border of the image, just scaling
the red channel differently than the blue and green channels is a
good initial solution.

The first image part showing a piece of a facade taken from the top
left corner of a Sigma DP1 photo, demonstrates, that scaling the red
channel with respect to the other two channels works fairly well. Most
of the visible chromatic aberration has been significantly reduced:

original vs. scaled red channel

Image part enlarged by a factor of two.

However, the second image part showing the back of a van, taken from
the bottom right corner of the same photo, demonstrates slight
problems with very thin dark lines against a bright background. The
thin line between the van doors, and the thin shadows on the roof of
the van display more colour fringes after the red channel has been
scaled, than before:

original vs. scaled red channel

Image part enlarged by a factor of two.

A careful analysis of other images shows, that just scaling the red
channel works for high-contrast edges of a minimal width, but fails
for thin eges and low-contrast areas. The reason for this seem to
be the algorithms that recover colour data for all pixels. In both
major chip designs, Bayer and Foveon, the resulting colour channels
are not independent from each other, in the Bayer design, due to
interpolation, and in the Foveon design due to the differential colour
computation. As a side effect, these algorithms seem to remove
chromatic aberration in low contrast regions, but they cannot correct
it for high-contrast edges.

Given the presented information, we have to design a filter that
scales the red channel in areas with high contrast edges, but leaves
everything as it is in areas with low contrast edges.
For scaling the red channel we use the Pano Tools > Correct filter. For
finding high contrast-edges we use Photoshop's Find Edges
Filter, but in order to select edges of the desired width we do not
use it on the image itself, but on a desaturated and gaussian filtered
version of the image.

The combined action uses a mask computed from high contrast edges of
two different widths (computed with different gaussian filter kernels)
to selectively scale the red channel of the image. Looking at the
result, we see that even the thin lines now do not exhibit excessive
colour fringes:

original vs. selectively scaled red channel

Image part enlarged by a factor of two.

The above samples were taken from the image below. In Sigma Photo
Pro, sharpening was set to -0.4, to prevent sharpening artefacts.
The image below (in both the original and corrected version) had
sharpening applied in Photoshop.
Here you can have a look at both the original and the
corrected version (master) of the complete image:

1

Downloads

Here is a list of my currently available action sets for correcting
chromatic aberration:

Actions for the Sigma DP1

Actions for Nikon Coolpix 990 (outdated)

Improvements

Just scaling the red channel for high-contrast edges, leaves some
coloured regions in the dark portions of these edges after the
operation. In order to reduce these, it is possible to desaturate
the dark side of high-contrast edges. The supplied action sets contain
actions to do just that, but since this can have a detrimental effect
on other regions of the image, this is optional.

It is also possible to create a more selective mask for scaling, by
searching for the specific colour of the chromatic aberration caused
by a specific lens. I am currently developing such an action for the
Tokina 10-17 fish eye zoom.

Plea to all digital camera vendors

Obviously a correction of chromatic aberration after the colour
interpolation has been performed in the camera can never be as good
as a possible correction before colour interpolation has taken
place. Thus my following Plea to all digital camera
vendors: Please include correction of chromatic aberration
before colour interpolation in a firmware or in the raw converters
of your products!

As of April 2008, Nikon seems to be the only vendor that has done
this for their newest DSLR cameras.

rft's Photography / Tips & Tricks /
Correcting Chromatic Aberration of Digital Cameras

Copyright © 1995-2010 by Robert F. Tobler

Last update on April 20, 2008. Comments to rft#cg.tuwien.ac.at.