1
Zernike Polynomials
• Fitting irregular and non-rotationally symmetric surfaces over a circular region.
• Atmospheric Turbulence.• Corneal Topography• Interferometer measurements.• Ocular Aberrometry
Background• The mathematical functions
were originally described by Frits Zernike in 1934.
• They were developed to describe the diffracted wavefront in phase contrast imaging.
• Zernike won the 1953 Nobel Prize in Physics for developing Phase Contrast Microscopy.
2
Phase Contrast Microscopy
Transparent specimens leave the amplitude of the illuminationvirtually unchanged, but introduces a change in phase.
Applications• Typically used to fit a wavefront or
surface sag over a circular aperture.
• Astronomy - fitting the wavefront entering a telescope that has been distorted by atmospheric turbulence.
• Diffraction Theory - fitting the wavefront in the exit pupil of a system and using Fourier transform properties to determine the Point Spread Function.
Source:http://salzgeber.at/astro/moon/seeing.html
3
Applications
• Ophthalmic Optics - fitting corneal topography and ocular wavefront data.
• Optical Testing - fitting reflected and transmitted wavefront data measured interferometically.
Surface Fitting
• Reoccurring Theme: Fitting a complex, non-rotationally symmetric surfaces (phase fronts) over a circular domain.
• Possible goals of fitting a surface:– Exact fit to measured data points?– Minimize “Error” between fit and data points?– Extract Features from the data?
4
1D Curve Fitting
0
5
10
15
20
25
-0.1 0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5
Low-order Polynomial Fity = 9.9146x + 2.3839
R2 = 0.9383
0
5
10
15
20
25
-0.1 0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5
In this case, the error is the vertical distance between the line andthe data point. The sum of the squares of the error is minimized.
5
High-order Polynomial Fit
0
5
10
15
20
25
-0.1 0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5-400
-200
0
200
400
600
800
1000
1200
1400
1600
1800
-0.1 0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5
y = a0 + a1x + a2x2 + … a16x16
Cubic Splines
0
5
10
15
20
25
-0.1 0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5
Piecewise definition of the function.
6
Fitting Issues• Know your data. Too many terms in the fit can be numerically
unstable and/or fit noise in the data. Too few terms may miss real trends in the surface.
• Typically want “nice” properties for the fitting function such as smooth surfaces with continuous derivatives. For example, cubic splines have continuous first and second derivatives.
• Typically want to represent many data points with just a few terms of a fit. This gives compression of the data, but leaves some residual error. For example, the line fit represents 16 data points with two numbers: a slope and an intercept.
Why Zernikes?
• Zernike polynomials have nice mathematical properties.– They are orthogonal over the continuous unit circle.– All their derivatives are continuous.– They efficiently represent common errors (e.g. coma,
spherical aberration) seen in optics.– They form a complete set, meaning that they can
represent arbitrarily complex continuous surfaces given enough terms.
7
Orthogonal Functions
• Orthogonal functions are sets of surfaces which have some nice mathematical properties for surface fitting.
• These functions satisfy the property
∫∫⎩⎨⎧ =
=A
jji Otherwise
ji
0C
dxdy)y,x(V)y,x(V
where Cj is a constant for a given j
Orthogonality and Expansion Coefficients
∑=i
ii )y,x(Va)y,x(W
)y,x(V)y,x(Va)y,x(V)y,x(W ji
iij ∑=
dxdy)y,x(V)y,x(Vadxdy)y,x(V)y,x(Wi
jA
iiA
j ∑ ∫∫∫∫ =
dxdy)y,x(V)y,x(WC1a
Aj
jj ∫∫=
Linear Expansion
8
Orthogonality - 1D Example
( ) ( )∫π2
0
integers are m' and m wheredxx'mcosmxsin
( ) ( )[ ]∫π
−++=2
0
dxx'mmsinx'mmsin21
Consider the integral
( ) ( ) π=
=⎥⎦⎤
⎢⎣⎡
−−
+++
−=2x
0x'mmx'mmcos
'mmx'mmcos
21
0=
Orthogonality - 1D Example
( ) ( )∫π2
0
integers are m' and m wheredxx'msinmxsin
( ) ( )[ ]∫π
−−+−=2
0
dxx'mmcosx'mmcos21
Two sine terms
( ) ( ) π=
=⎥⎦⎤
⎢⎣⎡
−−
−++
−=2x
0x'mmx'mmsin
'mmx'mmsin
21
0= if m ≠ m’ !!!
9
Orthogonality - 1D Example
( ) ( )∫π2
0
integers are m' and m wheredxx'msinmxsin
( )∫π
=2
0
2 dxmxsin
Two sine terms with m = m’
( ) π=
=⎥⎦⎤
⎢⎣⎡ −=
2x
0xm4mx2sin
2x
π= Similar arguments for two cosine terms
Orthogonality - 1D Example
odd jeven j
x
21jsin
x2jcos
Vj
⎪⎪⎩
⎪⎪⎨
⎧
⎟⎠⎞
⎜⎝⎛ +
⎟⎠⎞
⎜⎝⎛
=
From the previous arguments, we can define
( ) ( ) π== ∫∫ππ
2dxdxxVxV2
0
2
000
Note that when j = 0, V0 = 1 and
so the constant Cj = 2π for j = 0, and Cj = π for all other values of j.
10
Orthogonality - 1D ExampleThe functions satisfy the orthogonality condition over [0, 2π]
( ) ( ) ( )Otherwise
ji
01
dxxVxV 0i2
0ji
=
⎩⎨⎧ πδ+
=∫π
where δ is the Kronecker delta function defined as
Otherwiseji
01
ij
=
⎩⎨⎧
=δ
Fit to W(x) = x
010-0.49
08-0.57
06-0.66665
04-1302-21π0
ajj
-1
0
1
2
3
4
5
6
7
0 1 2 3 4 5 6 7
W(x)1 term3 terms11 terms
11
Extension to Two Dimensions
In many cases, wavefronts take on a complex shape defined over a circular region and we wish to fit this surface to a series of simpler components.
Wavefront Fitting
=
-0.003 x
+ 0.002 x
+ 0.001 x
12
Unit Circle
x
y
ρ
θ1
Divide the realradial coordinateby the maximum radiusto get a normalizedcoordinate ρ
Orthogonal Functions on the Unit Circle
• Taylor polynomials (i.e. 1, x, y, x2, xy, y2,….) are not orthogonal on the unit circle.
⎩⎨⎧ =
=θρρθρθρ∫ ∫π
Otherwiseji
0
Cdd),(V),(V j
j
2
0
1
0i
where Cj is a constant for a given j
Many solutions, but let’s try something with the form
( ) ( )θΘρ=θρ iii R),(V
13
Orthogonal Functions on the Unit Circle
• The orthogonality condition separates into the product of two 1D integrals
⎩⎨⎧ =
=⎥⎦
⎤⎢⎣
⎡θθΘθΘ⎥
⎦
⎤⎢⎣
⎡ρρρρ ∫∫
π
Otherwiseji
0
Cd)( )(d)(R)(R j
j
2
0ij
1
0i
This looks like the 1D Example,so sin(mθ) and cos(mθ) a possibility
This has extra ρ in it, so we need different functions
ANSI Standard Zernikes
⎪⎩
⎪⎨⎧
<θρ−≥θρ
=θρ 0 mfor ; msin)(RN
0mfor ; mcos)(RN),(Z mn
mn
mn
mnm
n
Double Indexn is radial orderm is azimuthal frequency
Normalization
RadialComponent
AzimuthalComponent
ANSI Z80.28-2004 Methods for Reporting Optical Aberrations of Eyes.
14
ANSI Standard Zernikes
only dependson |m| (i.e. samefor both sine &cosine terms
Powers of ρ
[ ] [ ]s2n
2/)mn(
0s
smn ! s)mn(5.0! s)mn(5.0!s
)!sn()1()(R −−
=
ρ−−−+
−−=ρ ∑
Constant that dependson n and m
2n2d)(R)(R 'nnm
'n
1
0
mn +
δ=ρρρρ∫
The Radial polynomials satisfy the orthogonality equation
ANSI Standard Zernikes
constant thatdepends on n & m
0m
mn 1
2n2Nδ++
=
15
Orthogonality
⎩⎨⎧ ==
=θρρθρθρ∫∫π
Otherwisem'm;n'n for
0
Cdd),(Z),(Z mn,m
n
2
0
1
0
'm'n
( )( )
( )( )
⎩⎨⎧ ==
=ρρρρ×
θ⎭⎬⎫
⎩⎨⎧
θ−θ
⎭⎬⎫
⎩⎨⎧
θ−θ
∫
∫π
Otherwisem'm;n'n for
0
Cd)(R)(R
dmsin
mcos'msin
'mcosNN
mn,mn
1
0
'm'n
2
0
mn
'm'n
Orthogonality
( )[ ]⎩⎨⎧ ==
=⎥⎦⎤
⎢⎣⎡
+δ
πδ+δ Otherwise
m'm;n'n for
0C
2n2 1NN mn,n'n
0mm'mmn
'm'n
This equals zerounless m=m’ This equals zero
unless n=n’So this portion issatisfied
What happens when n=n’ and m=m’?
16
Orthogonality
( ) ( )[ ] mn,0m2m
n C2n2
1 1 N =⎥⎦⎤
⎢⎣⎡
+πδ+
When n=n’ and m=m’
( )[ ] m,n0mm0
C2n2
1 1 1
22n=⎥⎦
⎤⎢⎣⎡
+πδ+⎥
⎦
⎤⎢⎣
⎡δ++
π=m,nC
Orthogonality
m'mn'nmn
2
0
1
0
'm'n dd),(Z),(Z δπδ=θρρθρθρ∫∫
π
17
The First Few Zernike Polynomials( )( )( )( ) ( )( ) ( )( ) ( )θρ=θρ
−ρ=θρ
θρ=θρ
θρ=θρ
θρ=θρ
=θρ
−
−
2cos6,Z
123,Z
2sin6,Z
cos,Z
sin,Z
1,Z
222
202
222
11
11
00
Zernike Polynomials
Azimuthal Frequency, θ
Rad
ialP
olyn
omia
l, ρ
Z00
Z11Z1
1−
Z20
Z31− Z3
1
Z40 Z4
2
Z22
Z42−
Z33− Z3
3
Z44Z4
4−
Z22−
18
Caveats to the Definition ofZernike Polynomials
• At least six different schemes exist for the Zernike polynomials.• Some schemes only use a single index number instead of n and m.
With the single number, there is no unique ordering or definition for the polynomials, so different orderings are used.
• Some schemes set the normalization to unity for all polynomials.• Some schemes measure the polar angle in the clockwise direction from
the y axis.• The expansion coefficients depend on pupil size, so the maximum
radius used must be given.• Some groups fit OPD, other groups fit Wavefront Error.• Make sure which set is being given for a specific application.
Another Coordinate System
x
y
ρφ
Normalized Polar Coordinates:
⎟⎟⎠
⎞⎜⎜⎝
⎛=φ
=ρ
−
yxtan
rr
1
max
1
ρ ranges from [0, 1]φ ranges from [-180°, 180°]
NON-STANDARD
19
Zernike Polynomials - Single Index
Azimuthal Frequency, θ
Rad
ialP
olyn
omia
l, ρ
Z0
Z1
Z4 Z5Z3
Z9Z8Z7Z6
Z10 Z11 Z12 Z13 Z14
Z2
ANSI STANDARD
Starts at 0Left-to-RightTop-to-Bottom
Other Single Index Schemes
Z1
Z3
Z4 Z6Z5
Z10Z8Z7 Z9
Z15Z13Z11 Z12 Z14
Z2
NON-STANDARD
Starts at 1cosines are even termssines are odd terms
Noll, RJ. Zernike polynomials and atmospheric turbulence. J Opt Soc Am 66; 207-211 (1976).
Also Zemax “Standard Zernike Coefficients”
20
Other Single Index Schemes
Z1
Z3
Z4 Z5 Z6
Z10Z7 Z8 Z11
Z18Z13Z9 Z12 Z17
Z2
NON-STANDARD
Starts at 1increases along diagonalcosine terms first35 terms plus two extraspherical aberration termsNo Normalization!!!
Zemax “Zernike Fringe Coefficients”
Also, Air Force or University of Arizona
Other Single Index Schemes
• Born & Wolf• Malacara• Others??? Plus mixtures of non-normalized, coordinate
systems.
NON-STANDARD
Use two indices n, m to unambiguously define polynomials.Use a single standard index if needed to avoid confusion.
21
ExamplesExample 1:
4m
0.25 D of myopia for a 4 mm pupil (rmax = 2 mm)
( ) ( ) ( )θρ+θρ=ρ
=ρ
== ,Z34000
1,Z4000
120008000
28000
rW 02
00
222
4mm
ExamplesExample 2:
1m
1.00 D of myopia for a 2 mm pupil (rmax = 1 mm)
( ) ( )θρ+θρ=ρ
== ,Z34000
1,Z4000
120002000
rW 02
00
22
2mm
Same Zernike Expansion as Example 1, but different rmax.
Always need to give pupil size with Zernike coefficients!!
22
RMS Wavefront Error
• RMS Wavefront Error is defined as
( )∑∫∫
∫∫>
=φρρ
φρρφρ=
m all,1n
2m,n
2
WFE add
dd)),(W(RMS
Zeroth Order Zernike Polynomials
Z00
This term is called Piston and is usually ignored.The surface is constant over the entire circle, sono error or variance exists.
23
First Order Zernike Polynomials
Z11Z1
1−
These terms represent a tilt in the wavefront.
max11
max11
1111
1111
1111
rxa
rya
cosasina),(Za),(Za
+=
θρ+θρ=θρ+θρ
−
−
−−Combining these terms results in a
general equation for a plane, thusby changing the coefficients, a planeat any orientation can be created.This rotation of the pattern is truefor the sine/cosine pairs of Zernikes
Second Order Zernike Polynomials
Z20 Z2
2Z22−
These wavefronts are what you would expect from Jackson crossedcylinder J0 and J45 and a spherical lens. Thus, combining these termsgives any arbitrary spherocylindrical refractive error.
24
Third Order Zernike Polynomials
Z31− Z3
1Z33− Z3
3
The inner two terms are coma and the outer two terms are trefoil. These terms represent asymmetric aberrations that cannot be corrected with convention spectacles or contact lenses.
Fourth Order Zernike Polynomials
Z40 Z4
2Z42− Z4
4Z44−
SphericalAberration
4th orderAstigmatism
4th orderAstigmatismQuadroil Quadroil
These terms represent more complex shapes of the wavefront.Spherical aberration can be corrected by aspheric lenses.
25
Discrete data
• Up to this point, the data has been continuous, so we can mathematically integrate functions to get expansion coefficients.
• Real-world data is sampled at discrete points.• The Zernike polynomials are not orthogonal for discrete
points, but for high sampling densities they are almost orthogonal.
Speed• The long part of calculating Zernike polynomials is
calculating factorial functions.
⎪⎩
⎪⎨⎧
<θρ−≥θρ
=θρ 0 mfor ; msin)(RN
0mfor ; mcos)(RN),(Z mn
mn
mn
mnm
n
[ ] [ ]s2n
2/)mn(
0s
smn ! s)mn(5.0! s)mn(5.0!s
)!sn()1()(R −−
=
ρ−−−+
−−=ρ ∑
26
Speed• Chong et al.* developed a recurrence relationship that
avoids the need for calculating the factorials.• The results give a blazing fast algorithm for calculating
Zernike expansion coefficents using orthogonality.
*Pattern Recognition, 36;731-742 (2003).
Least Squares Fit
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
=
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛−
−
−
−
)y,x(f
)y,x(f)y,x(f
a
aaa
)y,x(Z)y,x(Z)y,x(Z)y,x(Z
)y,x(Z)y,x(Z)y,x(Z)y,x(Z)y,x(Z)y,x(Z)y,x(Z)y,x(Z
NN
22
11
nm
11
11
00
NNmnNN
11NN
11NN
00
22mn22
1122
1122
00
11mn11
1111
1111
00
MM
L
MLMMM
L
L
( ) FZZZA
FZZAZFZA
T1T
TT
−=
=
=
27
Gram-Schmidt Orthogonalization• Examines set of discrete data and creates a series of
functions which are orthogonal over the data set.• Orthogonality is used to calculate expansion coefficients.• These surfaces can then be converted to a standard set of
surfaces such as Zernike polynomials.Advantages• Numerically stable, especially for low sampling density.Disadvantages• Can be slow for high-order fits• Orthogonal functions depend upon data set, so a new set
needs to be calculated for every fit.
Elevation Fit Comparison
0.125 SecondsChong Algorithm
10 SecondsGram-Schmidt
32 Orders or 560 total polynomials
28
Shack-Hartmann Wavefront Sensor
Plane WavefrontsEye
Lenslet Array
Aberrated WavefrontsEye
Lenslet Array
Perfect wavefronts give a uniform grid of points, whereas aberratedwavefronts distort the grid pattern.
Least Squares Fit
( ) FZZZA
FZZAZFZA
T1T
TT
−=
=
= Again, conceptually easy to understand, although this can be relatively slow for high order fits.
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
=
dy/)y,x(dW
dy/)y,x(dWdy/)y,x(dWdx/)y,x(dW
dx/)y,x(dWdx/)y,x(dW
a
aa
dy/)y,x(dVdy/)y,x(dVdy/)y,x(dV
dy/)y,x(dVdy/)y,x(dVdy/)y,x(dVdy/)y,x(dVdy/)y,x(dVdy/)y,x(dVdx/)y,x(dVdx/)y,x(dVdx/)y,x(dV
dx/)y,x(dVdx/)y,x(dVdx/)y,x(dVdx/)y,x(dVdx/)y,x(dVdx/)y,x(dV
Z
NN
22
11
NN
22
11
J
2
1
NNJNN2NN1
22J222221
11J112111
NNJNN2NN1
22J222221
11J112111
M
M
M
L
MMMM
L
L
L
MMMM
L
L
29
Example Image
Wavefront Reconstruction
PSF
Top Related