Example of CA correction for a nikon fc-e9 fisheye converter

Some lenses are affected with chromatic aberration. For an explanation see: http://www.free-definition.com/Chromatic-aberration.html or: http://www.canon.com/bctv/faq/chrab.html and there are many more.

The prismatic behaviour of a lens increases towards the edges, that can be seen in a fisheye lens or converter. A large amount can be corrected by software and Erik Krause and Jim Watters described this already i.e. Determination of chromatic aberration correction parameters   and: Correcting Chromatic Aberration with PanoTools Radial Shift

 Here an example is described for lowering the CA (lateral) of a Nikon fc-e9 converter lens, corrected with ptools.

Test image

image 1 detail CA of image 1

(left) This image was shot at morning, sun behind; the floors of the building are relative light and have the proper dimensions to observe chromatic aberration.
(right 200%) Here is a detail where you can see the chromatic aberration as colored fringes below and above the floors.

The image was captured with a Pentax ist Ds camera with SMC A 2.8/28mm lens and Nikon fc-e9, and stored as RAW file .Prepared with Raw shooter to the right WB and converted as a tiff file, dimensions 3038x2019 pixels.
For bandwidth saving the original tiff is showed here smaller and as a jpg file.

For simpicity and a minimum of calculation later on I had the building and the floors placed in the image area in such a way that a vertical line crosses all the floors.
Only the upper part is of interest for the calculation of the correction, but the lower part is of interest pure for insight.

The vertical line is part of a meridian plane (any plane that contains the optical axis), To get this in sight, imagine a plane that crosses the vertical line and symmetrical thrue the feet, . In this plane are no skew rays, that are difficult to compensate.

BTW it is a plane in which all optical aberrations are usually described.

Preparation and Calculations

vertical shift
It is advisible to check if the image area of the fish-eye (circle or part of circle) is in the center of the total image. I had to move it 18 px up by panotools: correction/vertical shift/optons Red 18, green 18 and blue 18.

The calculation process consists of 5 steps:

  1. determine the (vertical) shift in pixels to eliminate the coloured fringes and measure the distance (radius) from floor to center
  2. make a list of shift vs radius. In this example this means that for the first 4 floors the distance to the center is measured and to find the shift in pixels for R,G, and B to eliminate the fringes
  3. calculate the relative radius = r / r_unity for the place and the relative radius for the correction= (r+delta_r)/r_unity. All r's in pixel values (an example follows)
  4. computation of the constants a,b,c and d for the chromatic correction by means of a trendline of 4th order in an excel sheet (an example follows)
  5. chromatic correction with correction/radial shift of panotools

1. Determine the (vertical) shift

places for measurement detail of floor 1 Here are 4 horizontal lines that cross the vertical one. These 4 points will be used for calculating.
I start at the first floor with a pixel hight (radius) of 576 pixels. The detail at right shows that this floor suffers from a red fringe above and a blue fringe below.
My first rough guess is to shift the red channel 2 pixels . therefore I use the commands: Panorama tools/crrect/vertical shift/ option/red -2. After some trials I decide that -1.2 pixels is the best result.
I go on the same way for blue and end with +1. The green channel doesn't need to be changed.

vertical shift of red vertical shift of blue result after correction floor 1 <------- These windows show the vertical correction with panotools. The result is at right.

Up direction has a + sign and down direction has a - sign

2. List of (vertical) shift vs radius

My list:

Radius [px]Shift for red [px]Shift for blue [px]

3. calculate the relative radius r / r_unity

scheme of image area ptools radial correction window At left is a scheme of the image. Inside the large circle and the border of the image is the area that contains usable image. Outside is the rest of the image that is close to black due to the fact that a fisheye lens is used. Of course you can use all here for a non fisheye lens, but then r_max=r_unity.

In order to let ptools calculate a corrected radius, a radius measured in pixels has to be converted in a relative one (denoted by r_dest). A relative radius is nothing else then a dimension-less value between a minimum and a maximum value. Here we choose:( for accuray reasons) r_dest =r / r_unity (see figure left).

It is easy to see that when r is in the center of the image rdest=0 /r_unity = 0 and at the the large circle rdest= r_src = runity / r_unity = 1.

For highest accuracy we like to use a polynome of 4th order to calculate a shifted radius for CA correction , so we have to fill in all constants a,b,c and d. As explained before in case of r_dest = r_unity = r_src the value of r_dest and r_src=1 .
Fill in these values and it says: 1= a*1^4 + b*1^3 + c*1^2 + d*1. That is the case when a + b + c + d = 1.

4. computation of the constants a,b,c and d

graph display of radius Computation is done by displaying a graph of corrected radius (r_src) vs. r_dest in an excel sheet and after that insert a trendline.
At left is the first part of creating a graph. (BTW this is only an example. How the two columns are obtained can be seen in this CA sheet.)

In the r_dest list are 7 extra points added that don't need any correction. These are the first 6 points and the last. This is done to prevent the trendline to become unsteady in the more center part of the image.

Because the r_unity is is smaller than the r_max the list goes till 1.49. If you are not familiar with excel to get a graph look at this excel help

inserting a trendline Here the trendline is added. I choose a 4th order polynome and formatted the trendline so, that the numbers are displayed as accurate as needed and that the R2 is displayed. If this value is close to 1 you have a very good ”fit” of the polynome.

Some important remarks

look at Column I,J,H and the text box above the values The heart of this computation is very simple:
For each r_dest a slightly altered r_scr is calculated for some colour. The formula for the altered r_src is:

r_scr= (r - shift_) / r_dest

The minus sign is important. Only with a minus sign you get a polynome that corrects in the right direction. To demonstrate this, look at the next two before-after fotos,

detail of the image before CA correction detail of the image after CA correction options of trendline A white pixel is added in the upper corner in the ”before” foto (detail) that is split in the three colours in the ”after” foto. There you can see that ”red” is corrected in the down direction and ”blue” in the up direction, just as wanted.

At right the options that are needed for the (excel) insert trendline are switched on.


a b c d
red -0.0110768 0.019954 -0.0052353 1.0002685
blue 0.0087274 -0.0157182 0.0041374 0.9997604

5. chromatic correction with correction/radial shift of panotools

radial shift crrection
The following two images demonstrate the correction,
first foto is before,
second foto is after correction

the original fotos ( not the tifs but compressed and in jpg format for bandwidth purposes) are here



result before CA correction result after correction

(left) Because in this example I choosed to correct a point on the outer circle (r_unity), the sum of a+b+c+d is slightly unequal of 1. If you observe carefully you will see a very small coloured line at each side of the flattened fisheye area after correction. In this case this are 3 pixels each. this can easily be cropped, but take care that each image is cropped in the same manner, to avoid stitching problems. If not corrected it can appear as a coloured haze after an enblend action.

e-mail: Wil Brugman

© www.abolais.nl Last updated:  January-6-2008