Correcting for Lens
Distortion and
Chromatic Aberration using Software.

Geometry before |

Geometry after |

Corner detail before |

Corner detail after |
To this author, the commercial demise of the Nikonos system was
seen to be a retrograde step; the reason for the dismay being
the disappearance of fully underwater corrected lenses from the
marketplace. In particular, the loss of the UW-Nikkor 20mm and
15mm lenses meant that the only remaining option for high-quality
wide-angle photography was to use an air-corrected lens with
a dome port. A dome port does much to correct for the effects
of the air-water boundary, but it also introduces chromatic aberration
(colour-fringing in off-centre detail), and so cannot hope to
rival the performance of a UW-Nikkor unless the lens behind it
is specially corrected (and no such lenses exist). Such was the
status quo for optical purists, and this disappointing state
of affairs was set to persist or get worse as the impetus to
change to digital photography became more and more difficult
to resist.
The de-facto replacement for the Nikonos is now the digital compact
camera. Such cameras typically have zoom lenses, and lenses cannot
be made interchangeable because the image sensor is so small
that specks of user-introduced dust cannot be tolerated. Thus
the user is stuck with the lens provided by the manufacturer;
and while such lenses proudly bear the names of many great optical
companies, the actual performance is apt to induce nausea in
former SLR owners. The point is not that compact camera zooms
are particularly bad, but that zoom lenses of all types introduce
barrel or pincushion distortion which varies according to the
zoom setting. This is irritating in general, but completely ruinous
to any kind of technical or architectural photography; and it
was in seeking a solution to this problem that the author happened
upon a wonderful suite of free (GPL) software utilities by Helmut
Dersch called Panorama Tools (or PanoTools for
short). PanoTools solved the original problem completely, but
also suggested the extraordinary possibility that high-quality
underwater wide-angle pictures might be obtained using lens-port
combinations so dire that no manufacturers would dare to market
them (or would they?)
PanoTools, as is suggested by the name, is a set of tools designed
to aid in the construction of panoramas from multiple photographs.
The functionality of profound relevance to underwater photographers
however, lies in a little utility called correct. Correct
has a radial-shift function which can be used to remove barrel
and pincushion distortion. It also works on red, green, and blue
channels independently, and so can remove chromatic aberration.
The thoroughly remarkable consequence is that even a far-from-ideal
optical arrangement such as a 97° lens (35mm equivalent of
19mm) placed behind a flat port can turn in a performance comparable
to that of a fully water-corrected lens. The correction determined
for a particular lens+port combination and zoom setting moreover
can be applied to all photographs so produced: there is no need
to find corrections for individual pictures; and so after an
initial experimentation phase the correction process is reasonably
quick and easy. This is revolutionary, because it means that
rectilinear* lens correction is no-longer strictly necessary;
and although dome-ports have other advantages, they are no-longer
strictly necessary either. Farewell Nikonos, and welcome to the
world of virtual lens correction.
* a 'rectilinear' lens is one which preserves
right-angles and straight-lines in the image.
Getting started:
You can obtain PanoTools by visiting Helmut Dersch's website
at:
www.path.unimelb.edu.au/~dersch/
PanoTools is packaged as a zip file. If you want a harassment-free
zip utility to unpack the file try Ken Ward's Zipper, obtainable
from:
http://www.trans4mind.com/personal_development/zipper/
.
If you are a Mackintosh user, you can obtain PanoTools packaged
with a lens correction utility 'LensFix' from Kekus Digital:
http://www.kekus.com/plugin/index.html
The Kekus plugins are not free, but not expensive.
PanoTools comes with installation instructions, but note that
the correct utility is a
Photoshop plugin. This means that you will require an existing
Adobe Photoshop installation, or a Photoshop compatible plugin
host such as Jasc
Paint Shop Pro. The Win32 PanoTools also comes with support
for the Win32 version of GIMP (Gnu Image Manipulation Program),
which is a free open-source image editor. You can find out more
about GIMP by visiting: http://www.gimp.org/
. You can obtain GIMP for Win32 by visiting: http://gimp-win.sourceforge.net/ . Note however,
that this article refers to the use of PanoTools with Photoshop,
on PCs running Win98 and 2000; and this author has not so-far
tried it with any other image editing programs or operating systems.
This paragraph describes how to add the PanoTools plugins to
Photoshop 6. Other versions of Photoshop vary slightly, and there
is additional PanoTools functionality not described here. These
instructions are, of course, subordinate to the documentation
supplied with PanoTools, and serve merely to illustrate the procedure.
Once you have unzipped PanoTools you will find a file called
pano12.dll, and in a subfolder called
photoshop plugin you will find the
files correct.8bf, adjust.8bf,
perspect.8bf, and remap.8bf.
All you have to do to install the plugins is to drop pano12.dll
into the folder where Photoshop.exe
resides (usually C:\Program Files\Adobe\Photoshop
6.0), and drop the four *.8bf
files into the appropriate filter plugins folder (usually C:\Program Files\Adobe\Photoshop 6.0\Plug-Ins\Adobe
Photoshop Only\Filters). You may need administrator privileges
to add files to the C:\Program Files
folder tree. When you launch Photoshop, a Panorama Tools entry
will appear on the filter menu, and you're ready to go. |
Image File Formats:
We hope that you have adopted the practice of taking photographs
with 48bpp (bits-per-pixel) colour depth (i.e., RAW files or
48bpp TIFFs). The Panorama Tools entry on the filter menu will
only become available when you have a 24bpp file open in Photoshop
(6), and so you should perform your contrast and colour-balance
adjustments, etc., first and then change mode to 24bpp (Image / Mode menu in Photoshop). Don't
save your adjusted versions over the original file, always use
Save As... and change the filename.
You can get Olympus raw (*.orf)
files into Photoshop by dropping the plugin file ORFImport.8ba
into the C:\Program Files\Adobe\Photoshop
6.0\Plug-Ins\Adobe Photoshop Only\File Formats folder
and then re-launching Photoshop (other versions of Photoshop
may vary slightly, the point is that it goes in the \File
Formats folder). This plugin file may be on one of the
disks supplied with the camera, or you can get it as a self-extracting
(*.exe) zip file from: http://www.olympus.co.jp/en/support/imsg/digicamera/download/software/
and various other locations. When you install this plugin, the
Olympus RAW utility appears on the File
/ Import menu.
Note that the Olympus Camedia Master software supplied with the
camera has very limited file-management functionality, but it
can be used to extract the camera settings from *.orf
files; and as we shall see, each zoom setting is associated with
a particular set of radial shift correction parameters.
Canon cameras come with a Twain import module for Canon
RAW (*.crw) files on the supplied
software disk, and this will be installed when you install the
USB driver software. Make sure you use the options dialogue to
set the utility to import files at 48bpp the first time you use
it; the version supplied to the author defaults to 24bpp otherwise,
and thereby defeats the point of its own existence.
Some cameras, of course, will only output JPEG files; in which
case you should normally work with the highest output resolution
or quality that the camera will allow. You must also take care
to achieve the best possible exposure (use of the camera histogram
display, if available, will help), because the JPEG format only
allows 24bpp, and noticeable quality loss will occur if you need
to apply a large contrast adjustment later. The JPEG format has
one small advantage however, which is that the images produced
will usually contain EXIF data (camera parameters), and
this will include the focal length (zoom setting), and other
useful information. Some means for extracting EXIF data will
usually be included in the bundled software (the CD ROM that
comes with the camera), but if you deal with files from a variety
of cameras, there are various utilities available which will
extract information from any JPEG file. The freeware utility
EXIFRead
by Max Lyons will display the information in raw form, but this
can be difficult to interpret. The shareware utility Thumber, also by Max Lyons, displays
the information in a more comprehensible form, but you should
ensure that the software knows about your camera before believing
the output. Thumber, in its default mode, displays the 35mm
equivalent focal length, but in order to do so it reads a
conversion factor from a file cameras.txt,
which resides in Thumber's installation directory (usually C:\program files\Thumber). If a conversion
factor for your camera is not there, Thumber will use a default
value, which may well be incorrect. You can easily add the information
for your camera however (obtained from the manufacturers spec.
sheet); either by editing the camera description file in a text
editor such as Notepad, or by using the file
/ update camera database option. For example, to tell
Thumber about the Canon PowerShot A75, you can edit the cameras.txt
file to include the statement:
[Canon PowerShot A75]
Actual Focal Length=5.4
Equivalent Focal Length=35
Read the instructions in the file for more information. Note
also that Thumber can be set to display actual focal length instead
of the 35mm equivalent by using the options
/ more options / image data dialogue. Thumber will also
display the raw EXIF data in full if you right-click on the thumbnail
image it displays. |
You will not be
able to evaluate your corrections properly if your video monitor
suffers from geometric distortion or poor colour convergence
(i.e., inaccurate superimposition of the red, green, and blue
pictures). LCD monitors do not suffer from such defects, and
so are ideal for performing radial shift corrections; but they
are usually not so good for adjusting contrast (gamma varies
with viewing direction). |
|
To test your monitor convergence, click this link to launch a
convergence
test picture. Ensure that the window in which the picture
appears is resizable (see right), and resize the window so that
it is only slightly larger than the picture. Now move the little
window around the screen and note any colour fringes which appear
at the boundaries between black and white. If the monitor is
set up correctly, best convergence (least colour fringing) should
occur in the centre of the screen. |
 |
|
When correcting for chromatic aberration, you should open the
picture you are working on in a resizable window, and move the
feature you are examining to a region of the screen which showed
no, or at least minimal, colour fringing in the convergence test
carried out above. If you cannot find a region of the screen
which has good colour convergence, you might try degaussing the
monitor if it has been moved recently (see monitor setup menu,
or switch it off and on a few times), and you might try removing
magnetic objects (power supplies, loudspeakers, anything with
a high iron content) from its vicinity. If these simple measures
fail, a service technician may be able to carry out adjustments
which will improve convergence; but if the monitor is very old,
or very cheap, you may need to obtain a better one. |
You should only
apply radial shift correction to uncropped images. The point
is that the correction causes the image to expand or contract
about its centre point, and if you crop the image, the centre
will no longer correspond exactly to the lens axis. Therefore
apply radial correction first, crop the image later. |
Assuming that you have loaded an image which requires correction,
when you select the Filter / Panorama Tools
/ Correct menu item you will see an applet box like this:

Select Radial Shift (tick the box
as per the illustration), and click the Options
button. The applet box shown below will then appear. |
|

This dialogue box invites you to enter polynomial coefficients
for the correction, and the initial values presented when you
first use the tool are those which do nothing at all to the image.
You don't need to understand the maths to use the tool, but a
knowledge of what each of the coefficients does will ensure that
you adjust them in a sensible way.
The coefficients, from left to right are known as a,
b, c,
and d. d
is the first-order correction coefficient, c
is the second-order coefficient, b
is the third-order coefficient, and a
is the fourth-order coefficient (the 'order' is the power to
which the quantity rdest is raised).
The first-order coefficient d changes
only the size of the image without affecting the geometry. By
expanding or contracting the red, green, and blue images independently
about the lens axis you can perform a first-order correction
for chromatic aberration. This is usually all you need.
By changing the values of the higher-order coefficients, you
can cause the image to expand or contract about its centre by
an amount which depends on the distance from the centre to the
pixel in question. Changing second and higher order coefficients
therefore allows you to correct for barrel or pincushion distortion.
Making the sum of the coefficients a+b+c+d=1 conserves the original
image height at the centre. Making the sum greater than 1 reduces
the height of the image, and making the sum less than 1 increases
the height of the image.
To correct for pincushion distortion, insert positive values
for the second and higher-order coefficients. To correct for
barrel distortion, use negative values. |
Interpolation Quality:
If you click the Prefs button of
the Correct Options applet, and
then click More, you will be given
the various interpolator options shown right. Use polynomial
interpolation for speed when determining correction coefficients,
and use sinc interpolation for maximum quality when applying
the correction finally. |
 |
Adjustment Strategy:
Ideally, you should take a photograph of a rectangular test-card
with white-on-black detail in at least one of the corners.
Start by correcting only the image geometry, i.e., use the same
coefficient values for the red, green, and blue channels. Simple
barrel or pincushion distortion is an aberration that depends
on the cube of the distance from the image centre, and so it
is best to start by adjusting the 'b' (third order) coefficient.
If the image has barrel distortion, try b= -0.1 and adjust 'd'
so that the sum of coefficients is 1, i.e., d=1.1. If the image
has pincushion distortion, try b=0.1 (and hence d=0.9). Look
at the result and see if more or less correction is needed and
adjust 'b' and 'd' accordingly. Hold down the [control] key and
hit the Z key to revert to the original image before applying
a new correction. To retain maximum image quality, the correction
should always be carried out in a single operation, not incrementally.
You can assess the straightness of straight lines by laying a
plastic ruler against the monitor screen (assuming that your
monitor is properly corrected. Don't use a steel ruler against
a CRT monitor, magnetism may affect the geometry). Photoshop
guides are only useful if the lines in the picture are exactly
horizontal or vertical, which is unlikely. You can place a diagonal
line on the picture with the Marquee tool, but a ruler is quicker.
Note that it is important to use some instrumental means for
determining straightness because an optical illusion occurs on
comparing a distorted and an undistorted image, such that the
corrected image may sometimes appear to be distorted in the opposite
manner to the original. Adjust the coefficients until straight
lines are on average straight. If a line appears to undulate
after a third-order correction, then some second or fourth-order
correction may be needed. Hence increase the magnitude of 'a'
or 'c' while decreasing the magnitude of 'b' by a similar amount,
and so-on until you have geometry as near perfect as you can
be bothered to obtain. In general, even the most appalling lens-port
combinations will succumb to a correction involving both 'b'
and 'a' or 'c', and it is rarely necessary to use non-zero
values for all three.
With your geometrical correction parameters now determined, you
can apply a first-order correction for chromatic aberration.
For this, the green channel, being the middle colour in terms
of wavelength, should be treated as the reference channel (i.e,
the green channel is assumed to be correct and the others are
brought into convergence with it). Hence adjust only the 'd'
coefficients of the red and blue channels, leave green alone.
Having reverted to the uncorrected image ([control]-Z), look
for a white-on-black detail near one of the corners of the picture
and note any lack of convergence of the red, green, and blue
images. Magnify this detail and get it into the centre of the
monitor (or wherever the monitor convergence is best). If you
are just correcting for the effect of an air-water boundary (i.e.,
assuming that the camera lens does not make a major contribution
to the aberration) you will find that the blue image is slightly
too large, and the red image is slightly too small. If this is
the case, then increase the 'd' coefficient for blue slightly,
and reduce the 'd' coefficient for red. Note also that, for water,
the difference in refractive index for green and blue light is
about twice the difference for green and red, and the deviation
observed is roughly proportional to this difference. Hence, presuming
that you are correcting mainly for the underwater port, you will
probably need to apply about twice as much correction to the
blue channel as to the red channel. Start by increasing the blue
'd' coefficient by 0.003 and reducing the red 'd' coefficient
by 0.0015. Fiddle with the parameters until you have exact convergence
in your chosen corner feature. Toggle between the corrected and
uncorrected versions of the image by hitting [control]-Z repeatedly.
Notice that when convergence is obtained, there may be a slight
blue haze around the feature: this is because lenses in general
focus short-wavelength (blue-violet) light slightly less sharply
than they focus red or green light (but the effect also depends
on the filtration system used to separate red, green, and blue
light in the camera). Once you have a first-order correction,
inspect the image all over to see if chromatic aberration has
reappeared in some regions. If it has you will need to make a
second or higher-order correction, i.e., you will need to make
tiny adjustments to the blue and red 'c' coefficients and so
on; but the author has so far not found such corrections to be
worthwhile.
Always apply any correction you make to the completely uncorrected
image, i.e., hit [control]-Z after every trial. PanoTools stores
your last attempt in a preferences file, and gives it to you
as a starting point for the next go. Hence you will quickly home
in on a set of coefficients which performs both geometric and
chromatic corrections in a single operation; and this formula
will work for all subsequent photographs taken using the same
lens, port, and zoom-setting combination. Use the Save
and Load buttons at the bottom of
the Correct Options dialogue box
to store and retrieve previously determined coefficients.
Tip (Windows OS): If you hold down the [Alt] key and hit
the [PrtSc] key when the correction coefficients dialogue box
is on the screen, it will be saved to the clipboard. You can
then create a new file (File / New) and paste the clipboard into
it (Edit / Paste), then save this file with the images concerned.
This is useful if you want to create documents explaining what
you have done (and is the method used to show dialogue boxes
here). |
Examples:
Olympus PT-020/C-5060, Standard Port, Max Zoom:
Olympus PT-020 housing with PPO-01 standard flat port. C-5060
camera zoom setting = maximum wide. Coverage: 77° in air
(35mm equiv: 27mm), 56° underwater.. |

Pincushion distortion before |

Geometry after |

Chromatic aberration before |

Residual aberration after |
|
Radial correction coefficients: |
 |
|
Software correction is indicated for the C-5060 camera with a
flat port because it has a wider maximum angle of coverage compared
to previous compact cameras. The geometric correction shown could
be improved slightly with more experimentation, but the residual
distortion obtained here will not be noticeable in a normal photograph.
After correction, the optical performance is comparable to that
of an underwater corrected lens. Note that these corrections
will probably be suitable for the C-5060 in any underwater housing
with a flat port (slight changes in optical path-length, associated
with port thickness, port refractive index, and air-gap between
port and lens, do not change the coefficients significantly). |
|
To show the extent to which the optical effects demonstrated
above are due to the air-water boundary, a photograph was taken
of the test-card in air, using the bare C-5060 camera (no port)
and the same zoom setting (max wide). |

Geometry before correction. |

Geometry after correction. |

Chromatic aberration before correction. |

Chromatic aberration after correction. |
|
Radial correction coefficients: |
 |
|
In this case, note that the lens on its own produces some
barrel (fisheye) distortion at the widest setting, and so actually
compensates for the distortion introduced by the air-water
boundary when the camera is used underwater. The chromatic aberration
is also minor, and quite different from that caused by an underwater
port (note that you may not be able to see the effect properly
in the pictures above if your monitor convergence is poor. Try
moving the pictures to the middle of your screen if what you
read next does not agree with what you see). Here we find that
a white object has a magenta fringe on the outside, and a green
fringe on the inside. The outer magenta fringe means that both
the red and the blue images are too large. The inner green fringe
means that the green image is too small, which is the same as
saying that the red and blue images are too large, i.e., the
inner green fringe is simply the colour complement of the outer
magenta fringe. This anomalous dispersion behaviour is indicative
of an existing (and evidently effective) compensation scheme
built into the lens. The upshot is that a small additional chromatic
compensation can be achieved, in this case, by slightly reducing
the sizes of both the blue and the red images.
You may, of course, see different colour fringes with other
lenses, and the fringe colours will change while you are working
towards an optimum correction. Consequently, to work out the
required direction of adjustment, you may find it helpful to
memorise the complementary colours. These are as follows: |
|
Secondary Colour |
Complementary Colour |
|
Cyan
= Green
+ Blue |
Red |
|
Magenta
= Red
+ Blue |
Green |
|
Yellow
= Red
+ Green |
Blue |
|
The wedge-shape of the test-card in the final image above, incidentally,
is simply due to the fact that the camera was not pointing directly
at the card, i.e., it is an effect of perspective not lens distortion
(you can pull-out this effect using the Photoshop Free-Transform
tool). A slightly oblique camera angle does not affect the usefulness
of a test shot because determining a geometric correction is
merely a matter of making straight lines come out straight. |
Olympus PT-020/C-5060, Standard Port, Max Zoom, Epoque DCL-20
Wide Lens:
Olympus PT-020 housing with standard flat port (PPO-01) and Epoque
0.56x wide-angle converter DCL-20. C-5060 camera zoom setting
= maximum wide. |

Barrel distortion before |

Geometry after |

Chromatic aberration before |

Residual aberration after |
|
Radial correction coefficients: |
 |
|
Note that the unprocessed image has a circular vignette, and
that the correction process reduces its effect so that only a
small amount of final cropping will be required. The vignette
is due to the fact that the maximum angle of coverage of the
camera lens exceeds that for which the DCL-20 conversion lens
was designed. Once again, optical performance after correction
is comparable to that of an underwater corrected lens. |
Olympus PT-020/C-5060, WCON-07C Wide Lens, Wide Port, Max
Zoom:
Olympus PT-020 housing with PPO-02 flat wide-port and Olympus
WCON-07C 0.7x wide-angle conversion lens, C-5060 camera zoom
setting = maximum wide, Coverage: 97° in air (35mm equiv:
19mm), 68° underwater.. |

Pincushion distortion before |

Geometry after |

Chromatic aberration before |

Residual aberration after. |
|
Radial correction coefficients: |
 |
|
The PPO-02 wide port for use with the WCON-07C wide converter
appears, at face value, to be one of the most ill-conceived lens-port
combinations ever brought to the commercial market. At the widest
zoom setting it gives the 35mm equivalent of a 19mm lens behind
a flat port, a setup no serious underwater photographer would
ever bother to consider. The PPO-02 packaging even has warnings
about lens-distortion printed on it, and true to the laws of
optics it gives chromatic aberration so bad that it can even
be seen in the de-magnified image given above (top left picture).
After correction however, the system gives excellent resolution,
as can be seen by the sharpness of the word "BLACK"
in the bottom right-hand detail. This makes the system overall
an excellent optical performer, capable of producing large high-quality
prints, but only if radial correction is used. |
|
Once again, we can separate the effect of the underwater port
from the performance of the optical system overall by photographing
the test card in air using just the C-5060 camera and the WCON-07C
wide-angle converter. |

Geometry before correction. |

Geometry after correction. |

Aberration before correction. |

Aberration after correction. |
|
Radial correction coefficients: |
 |
As with the camera on its own, the camera with the Olympus wide-converter
also produces fisheye distortion and anomalous magenta-out, green-in,
chromatic aberration. Once again, a small amount of chromatic
compensation is possible, but the initial aberration is by no
means problematic. The WCON-07C is evidently a very good wide
converter. The excellent post-correction underwater performance
of the C-5060 camera and WCON-07C indicates that the conversion
lens is extremely well-matched to the camera and, unlike the
port, is a credit to its designers.
From the above investigation, we may conclude that, when used
in conjunction with a wide-angle lens, a flat port introduces
severe pincushion distortion and pronounced blue-out, red-in,
chromatic aberration, both of which can be corrected in software.
Evidently, when selecting a lens for use with a flat port underwater,
it will be advantageous to choose one which exhibits a certain
amount of barrel distortion when used in air. |
Limitations of the Correction Process:
One issue which must be understood from this discussion is that
the procedure outlined will turn a good air-corrected lens into
a good underwater-corrected lens, but it cannot turn a bad lens
into a good lens. The point here is that if the lens behind the
port can produce sharp pictures when used in air, then the correction
process will restore its ability to produce sharp pictures underwater;
but if it gives fuzzy pictures in air, it will also produce fuzzy
underwater pictures.
At risk of repetition, we should also discuss the fact that the
coefficients required for a particular lens and port vary according
to the zoom setting. This however, will trouble old-school underwater
photographers very little; since for pictures other than macro,
they will all automatically wind the zoom to its widest angle
and leave it there. The simplest operational policy is therefore
to make test-card shots and determine coefficients for a set
of easily repeatable focal-length settings, and stick to these
settings when taking real pictures. Alternatively, make a set
of test-card shots at reasonably closely spaced focal-length
intervals and plot a graph of the way in which the coefficients
vary with focal length. You can then use the zoom at will, and
provided that you have a way to record the zoom setting with
the image data, you can interpolate the graph for corrections
at your randomly chosen focal lengths. If this sounds like hard
work, observe that you should always try out a camera system
in a swimming pool before venturing into the ocean, and that
the initial, once and for all, acquisition of calibration shots
will take about 10 minutes. The rest is messing around in Photoshop,
which most photographers regard as fun.
Unsharp Masking:
Some of the lesss expensive digital cameras apply unsharp masking
to the image by default. You should turn this feature off if
at all possible, since it will interfere with any corrections
you make for chromatic aberration and lead to an unsatisfactory
result. The effect of unsharp masking is to increase the contrast
at brightness transitions in the image (edges); sometimes with
overshoot which creates black or white fringes around objects.
If you apply a correction for chromatic aberration, these fringes
will blur, and white fringes will split into three colours. The
result is a picture which is notionally corrected, but has more
colour fringing and softer edges than before; i.e., correction
becomes pointless and reduces the subjective image quality. If
you must use unsharp masking, use it only on the final image,
use it only after the image has been re-sized to its final resolution,
and never do it over a radius of more than about 0.7 pixels.
The general rules for unsharp masking are very simple and easy
to remember:
Rule #1: Don't do it.
Rule #2: If you must do it; don't do it yet. |
Why Aperture and Focus Settings Don't (usually) Matter:
The correction procedure described above works regardless of
the lens aperture setting because, for a reasonably well designed
lens, the geometry of the image is not affected by the aperture.
Likewise the geometries of the separated R G and B images are
not affected by aperture, which is why you can't improve the
chromatic performance of a lens and port by stopping down. What
the aperture does is change the size of the circle of confusion
(the extent to which a point is reproduced as a fuzzy circle),
and so while the sharpness of a feature in the red green and
blue channels may vary with aperture, its centre-point should
always land on the film or sensor in the same place. Hence, once
you have obtained exact convergence of the red green and blue
images, changing aperture may alter the amount of coloured haze
around a feature, but changing the correction will not result
in better convergence. It is of course, possible to make a lens
in which this convergence will wander, by failing to place the
iris at the nodal point, but in the days of computer-aided design,
such abominations are unlikely to be encountered.
The focus setting, incidentally, does have an effect; but for
a wide-angle lens, the difference between closest-focus and infinity
is likely to be too trivial to warrant any adjustment of the
correction coefficients. For a macro lens; there will, in principle,
be a substantial difference, but good macro equipment should
not require significant correction of the type being discussed
here, and so the point is largely academic.
Why Dome Ports are Still a Good Idea:
Although the techniques outlined here make the expense of a dome-port
system less necessary, a dome port has some very compelling advantages,
which software correction cannot hope to match. The first point
is that a flat-port increases the effective focal length of a
lens, due to refraction at the air-water boundary, and hence
reduces the angle of coverage. Since the idea in underwater photography
is to use a wide-angle lens in order to put the minimum amount
of water between the camera and the subject, a flat-port somewhat
defeats this intention. The second point is that the dome-port
was introduced in the 1960s as a way of avoiding port-vignetting
with very wide-angle lenses (its optical advantages were actually
discovered by accident) and it will obviously still fulfil this
purpose. The third point is that a flat-port introduces pincushion
distortion, and radial correction applies a compensatory barrel
distortion. This means that there is barrel-shaped vignette in
the corrected picture, which will have to be cropped-off before
the picture is ready for presentation. The upshot is that you
will lose up to about 10% of the format area in correcting a
flat port, reducing the effective number of camera pixels and
so causing a small reduction in the maximum available resolution.
Thus the lens-port combination which gives the least distortion
is the best starting point for radial correction, because it
maximises the usable format area. Hence, the recommendation for
optical purists is to start with a well-corrected air-lens behind
a dome port, and then use software to correct it to meet or exceed
the standard of the old benchmark 15mm UW-Nikkor. |
Dome Port Examples:
Olympus C-5060 + WCON-07C wide lens, in Ikelite housing with
3" dome port:
Ikelite
6130.61 housing with DP60 dome port (3" internal radius)
and WCON-07C 0.7x wide lens. Zoom setting = max wide. Angle of
coverage: 97° underwater (nominal). |

Geometry before correction. |

Geometry after correction. |

full-size detail before correction. |

full-size detail after correction. |
|
Radial correction coefficients: |
 |
|
Test pictures for the bare camera lens in air were given earlier,
and show that the dome port introduces no additional geometric
distortion. The barrel distortion in the uncorrected picture
above is due entirely to the zoom lens. The dome port does however
introduce a small amount of chromatic aberration, this being
a consequence of the extremely wide angle of coverage (97°
nominal), but the result after correction is virtually perfect
in this respect. The distance from the front of the dome to the
test card was 256mm (calculated) to record a subject field width
of 610mm after correction. The camera was set in macro focusing
mode to cope with the proximity of the virtual image produced
by the curved air-water boundary. The aperture setting was f/8. |
Olympus C-5060 in Ikelite housing with 3" dome port:
Ikelite 6130.61 housing with DP60 dome port (no wide lens). Camera
zoom setting = max wide. Angle of coverage: 77° in air (nominal),
73° underwater (actual, measured). |

Geometry before correction. |

Geometry after correction. |

full-size detail before correction. |

full-size detail after correction. |
|
Radial correction coefficients: |
 |
|
Although the DP60 dome port was designed for the WCON-07C, it
can still be used with the bare camera lens. In this case however,
the lens entrance pupil ends up slightly behind the centre of
curvature of the dome, and so the in air coverage of the lens
(77°) is not exactly conserved. Actual coverage underwater
(measured using a method described in the angle
of coverage article), turned out to be 73.4±1.1°
at a lens pupil to subject distance of 0.75m (but the fact that
this figure is less then 77° is actually due to expansion
of the diagonal in the correction for barrel distortion, rather
than misconvergence of the entrance pupil and dome centre). Using
a dome port on its own with the camera therefore gives wider
coverage than when the camera is used with the WCON-07 and a
flat port (only 68°); and the amount of chromatic aberration
produced by the dome is effectively negligible at 73° coverage.
A dome port for wide angle photography is evidently a very good
idea. |
Using Radial Correction with Film Cameras:
Although this article has so-far been about radial correction
of digitally produced images, there is no reason why it cannot
be applied to images scanned from film. Operational points to
note are firstly: that the slide or negative must be scanned
full-frame, so that the lens-axis corresponds reasonably accurately
to the centre of the picture; and secondly: any dirt specks on
the film should be removed before correction (using the Photoshop
cloning stamp or its equivalent) because they will acquire colour
fringes after correction. Also note that the correction for chromatic
aberration may not be quite so effective (it depends on the film),
the reason being due to the spectral-bandwidth (wavelength spread)
of the filters used to separate the three colour images. The
filters used in digital cameras are usually fairly sharp, giving
three almost discrete sampling wavelengths, which makes chromatic
correction extremely effective. The dye-filters used in film,
on the other hand, are often rather broad and prone to spurious
responses, and the scanned RGB image must be synthesised from
a CMY image; all of which means that there will be some dispersion
within each colour channel, and hence more coloured haze around
image features after correction. |
Film Examples:
50mm Macro lens with Flat Port:
Sigma 50mm f/2.8 macro lens (~46° coverage in air) with 3/8"
thick acrylic flat port. Kodachrome 200 film. Port to subject
distance (from memory) about 0.5m. |

Raw scanned image, uncropped. |

Corner detail before correction.

Corner detail after correction. |
|
Radial correction coefficients
(first order only): |
 |
|
In this case no geometric correction was applied for the simple
reason that no test-card shots were available (and the camera
system passed out of service long ago). If you can't see distortion
moreover (and you don't need to make measurements from the photograph)
there is arguably no point in correcting for it. Chromatic aberration
in the original is not severe, as should be expected for the
optical system used (the detail images are considerably more
magnified than for the previous examples); but if you want to
blow an image up to poster size, the radial correction is evidently
worthwhile. |
35mm W-Nikkor Lens:
Nikonos camera with W-Nikkor 35mm f/2.5 lens (air corrected underwater
lens with flat glass front element), Coverage: 62° in air,
46.5° underwater. Kodachrome 200 film. |

Uncropped image after correction. |

Edge detail before correction. |

Edge detail after correction. |
|
Radial correction coefficients
(first order only): |
 |
No geometric correction was applied for the same reason as before.
The 35mm W-Nikkor used on its own is difficult to focus and consequently,
for this author at least, produces a fair proportion of pictures
destined for the wastebasket. The picture above is not particularly
sharp (for the purposes of this demonstration, unsharp masking
has not been applied), but it is one of the better examples from
the few occasions on which the author decided to give the lens
a try without its close-up attachment. The point in including
it here, as we shall see shortly, is that it fills in a gap in
our examples of flat-port and lens combinations from 19 to 50mm.
In the off-centre detail of the picture shown above, blue light
is considerably more out-of focus than green, and green is more
out of focus than red. Hence there is a blue haze around details
after correction. The coefficients for radial correction were
determined using the detail shown, but the final coefficients
are a compromise (best average) obtained by looking all over
the picture. The author was intrigued to discover that the picture
'sprang to life' after correction: coloured patterns on the bodies
of the fish suddenly fell into register, indicating that the
general fuzziness of pictures taken with the W-Nikkor 35mm is
as much due to chromatic aberration as it is due to inaccurate
focusing. Evidently it is time to take another look at some of
those old slides deemed not quite good enough to use (unless
you really did throw them away). |
Collected Coefficients for a Flat Port:
Shown in the table below are the shifts in the first order coefficient
(d) which were used in order to correct for chromatic aberration
in the flat port underwater picture examples given above. Where
correction coefficient shifts for the lenses in air were known
(27mm and 19mm) these have been subtracted from the values for
the lens and underwater port combined. Also included is the theoretically
required boundary condition that when the focal length becomes
infinite, the required correction must be zero. |
|
Shift in d coefficient |
Angle of Coverage of Camera Lens (and 35mm
equiv. focal length). |
97°
(19mm) |
77°
(27mm) |
62°
(~35mm) |
46°
(50mm) |
0
(¥) |
|
Red |
-0.003 |
-0.0025 |
-0.0013 |
-0.0015 |
0 |
|
Blue |
+0.0023 |
+0.0019 |
+0.004 |
+0.003 |
0 |
|
Obviously there is considerable scatter in these data, especially
in the shifts for blue light, and this can be accounted for in
two ways: Firstly there will be some deviation away from the
value required for the port alone in the cases where the coefficient
shifts for the lens in air are unavailable. Secondly, the final
choice of coefficients is always something of a compromise, and
the author tried to determine them without forcing them to agree
to some predetermined scheme (and there is considerable latitude
in choosing the blue coefficient when blue is less sharply focused
than red or green). There is a trend nonetheless, and it seems
that in the absence of any other information, and presuming that
the main lens is reasonably well corrected; any wide-angle picture
taken using a flat port can be improved by decreasing the red
coefficient by about 0.0015, and increasing the blue coefficient
by about 0.0025.
To clarify a point made briefly earlier: it is also useful to
note that if the chromatic aberration seen is entirely due to
an air-water boundary, there is every reason to expect that the
coefficient shift for blue will be about twice the shift for
red, and that the shifts will be in opposite directions. This
can be understood by presuming that the manufacturer of the sensor
or film will have tried to choose primary colours at wavelengths
corresponding reasonably closely to the peak spectral responses
of the cone cells in the human eye. These peak response wavelengths
are at 560nm (red), 530nm (green), and 424nm (blue), but most
colour photography systems are based on old research which places
than at about 600 (R), 540 (G) and 450nm (B) . Data from Kaye
and Laby (ISBN 0-582-46354-8) give the refractive index for pure
water at wavelengths close to the traditional primaries as follows: |
|
Wavelength / nanometres |
Refractive index at 20°C |
Difference from green |
|
435.8 |
1.340210 |
+0.005744 |
|
546.1 |
1.334466 |
0 |
|
632.8 |
1.331745 |
-0.002721 |
|
Since the deviation between the red, green, and blue images at
a particular point in the image is very small, the relationship
between deviation and refractive index will be almost linear
(i.e., directly proportional). Hence, since the magnitude of
the refractive index difference between blue and green is about
twice that between red and green, and one is positive while the
other is negative; we expect the radial deviation to follow roughly
the same pattern. |
Some camera systems for which corrections have been determined:
Canon A75
in WP-DC30 housing
Fuji F420
in WP-FX420 housing
Fuji F700
in WP-FX700 housing
Olympus m410 with flat port
Olympus C-5050,
PT-015 housing, M67 supplementary lenses.
Olympus C-8080,
PT-023 housing, Wide port and WCON-08D.
Olympus C-8080
in Ikelite housing.
Further Information:
Correcting Wide Angle Distortion, by Peter Schulz,
article on the Splashdown Divers website: http://www.splashdowndivers.com/photo_gallery/
underwater_photography/image_processing_wide_angle.htm
Correcting Wide angle Distortion with PanoTools,
by Peter Schulz, article on the WetPixel website: www.wetpixel.com
Eliminating color fringing, by Norman Koren (using
Picture Window Pro 3.1): http://www.normankoren.com/Tutorials/Chromatic.html
Acknowledgements:
With grateful acknowledgement of Prof. Helmut Dersch and his
decision to issue Panorama Tools under the Gnu Public License.
Thanks also to Anders Peterson for identifying points in need
of clarification, and to David Kipling for the Mac OS information. |
Dave Knight (Dr David W Knight).
dave
© Cameras Underwater 2004 - 2006 |
|