January 26-29 2006 Atlantis Hotel, Paradise Island, Bahamas
January 26-29 2006
Atlantis Hotel, Paradise Island, Bahamas
Extracting wavefront errorExtracting wavefront errorfrom S/H images usingfrom S/H images usingSpatial DemodulationSpatial Demodulation
Edwin J. Sarver, PhDEdwin J. Sarver, PhD
OutlineOutline
Traditional Shack-Hartmann (SH)Traditional Shack-Hartmann (SH)processingprocessing
Fourier Transform (FT) processing ofFourier Transform (FT) processing ofSH imagesSH images
Spatial Demodulation (SD) processingSpatial Demodulation (SD) processingof SH imagesof SH images
Simulation and exam examplesSimulation and exam examples DiscussionDiscussion
SH wavefront sensorSH wavefront sensor
Micro lens array Image plane
Wavefront propagation
f Z
Y
SH wavefront sensorSH wavefront sensor
Micro lens array Image plane
Wavefront propagation
f Z
Y
IncidentPlane wavefront
Reference spots in regulargrid on image plane
SH wavefront sensorSH wavefront sensor
Micro lens array Image plane
Wavefront propagation
f Z
Y
SH wavefront sensorSH wavefront sensor
Micro lens array Image plane
Wavefront propagation
f Z
Y
Aberrated wavefrontAberrated spots in irregulargrid on image plane
Traditional SH ProcessingTraditional SH Processing11
Find centroid corresponding to eachFind centroid corresponding to eachmicro lensmicro lens
Deviation Deviation dxdx, , dy dy of detected centroidof detected centroidfrom reference spots yields wavefrontfrom reference spots yields wavefrontgradientgradient
Reconstruct wavefront from gradientReconstruct wavefront from gradient(e.g., Zernike or Fourier)(e.g., Zernike or Fourier)
Traditional SH Processing
1Tyson, Principles of adaptive optics, second edition, Academic Press,New York, 1998.
WF gradient found fromWF gradient found fromspot deviationspot deviation……
Micro lens array Image plane
f
f
delY
dW(x,y) / dy = -delY / f
dW(x,y) / dx = -delX / f
Traditional SH Processing
Fourier SH ProcessingFourier SH Processing11
Compute Fourier Transform of SH imageCompute Fourier Transform of SH image Isolate region of interest (band-pass filter)Isolate region of interest (band-pass filter)
and shift to centerand shift to center Compute inverse Fourier Transform andCompute inverse Fourier Transform and
compute complex angle to yield wrappedcompute complex angle to yield wrappedphasephase
Unwrap phase to yield wavefront gradientUnwrap phase to yield wavefront gradient Reconstruct wavefront from gradients (e.g.,Reconstruct wavefront from gradients (e.g.,
Zernike or Fourier)Zernike or Fourier)
Fourier SH Processing
1Carmon and Ribak, Phase retrieval by demodulation of a Hartmann-Shack Sensor, Optics Comm., 215, 285-8, 2003.
Looking at sameLooking at sameneighborhood as beforeneighborhood as before……
Micro lens array Image plane
ff
delY
Y
Y’
Y
Fourier SH Processing
Warp function is keyWarp function is key……
delY
Y
Y’
Yf
Wavefront warps lens center locations from MLA plane to the image plane.
g0(Y) g1(Y’) = g0(Y’-delY)
( )
( ) ( )
×+=
×−=
fdyydWygyg
fdyydWdelY
'0'1
Fourier SH Processing
If we warp the coordinates of a referencespot pattern, what happens to its FourierTransform?
First, we look at just the reference spots…
Spots and FT of SpotsSpots and FT of Spots
( )
( ) ( ) L
++
−+=
+×
+=
vp
uvp
uvuG
yp
xp
yxg
yx
yx
,1,1810,0
41,
2cos21
212cos
21
21,
0
0
δδδ
ππ
Fourier SH Processing
Reference spots: gReference spots: g00(x,y)(x,y)
Fourier SH Processing
FT of reference spots: GFT of reference spots: G00(u,v)(u,v)
Fourier SH Processing
Now, warped spotsNow, warped spots……
( ) ( ) ( )[ ]
( )( ) ( )( )
++×
++=
++=
yxByp
yxAxp
yxByyxAxgyxg
yx
,2cos21
21,2cos
21
21
,,,, 01
ππ
( ) ( ) ( ) ( ) fdy
yxdWyxBfdx
yxdWyxA ×=×= ,,,,, 22
Fourier SH Processing
And FT of warped spotsAnd FT of warped spots……
( ) ( ) ( )
( ) ( ) dydxeexg
dydxeyxAxgvuGvyuxjyxAj
vyuxj
∫∫
+−
+−
=
+=
ππ
π
2),(2
22 ),(,
Our goal is to recover A(x,y) from the low-pass signal exp(j2! A(x,y)) .
Similarily, for B(x,y).
Fourier SH Processing
Sample image of warpedSample image of warpedspotsspots……
Fourier SH Processing
……and its Fourier transformand its Fourier transform
Fourier SH Processing
Regions of interest in FT ofRegions of interest in FT ofspotsspots……
u
v
This region has info about dW/dx
This region has info about dW/dy
Fourier SH Processing
Constraint on WFConstraint on WF……
WF Requirement:WF Requirement:–– Wavefront spectrum must be band limitedWavefront spectrum must be band limited–– In particular, the wavefront slope frequency isIn particular, the wavefront slope frequency is
low compared to MLA spot frequencylow compared to MLA spot frequency
Spot pattern requirement:Spot pattern requirement:–– The width of the spot pattern should be largeThe width of the spot pattern should be large
relative to the spot pitch relative to the spot pitch –– we should have quite we should have quitea few spots across the imagea few spots across the image
Fourier SH Processing
Phase unwrappingPhase unwrapping
Why is it required?Why is it required?–– Because the wavefront slope appears inBecause the wavefront slope appears in
the recovered exponential and the recovered exponential and ““wrapswraps””around every around every 22! . .
How is it done?How is it done?–– If no If no ““residuesresidues””, unwrapping is simple., unwrapping is simple.–– If residues are present, unwrapping canIf residues are present, unwrapping can
be difficult (see be difficult (see 11))
1 Ghiglia and Pritt, Two-Dimensional Phase Unwrapping, John Wiley, 1998.
Fourier SH Processing
Simple unwrappingSimple unwrapping
0
!
2!
Unwrapped function
Wrapped function
Fourier SH Processing
Simple unwrappingSimple unwrapping……
Set U(0) = W(0)Set U(0) = W(0) For n=1 to the end do the followingFor n=1 to the end do the following
D = W(n) D = W(n) – W(n W(n – 1) 1)If D < If D < – Pi then D = D + 2 PiIf D > Pi then D = D – 2 PiU(n) = U(n-1) + D
U = unwrappedW = wrapped
Fourier SH Processing
Test for ResidueTest for Residue
For a continuous surface (wavefront slopes) the sum of the deltasaround a closed curve should be zero.
D(1)
D(2)
D(3)
D(4)
If the sum is non-zero, a residue exists and the simple unwrappingmethod is not valid. Examples given below.
Fourier SH Processing
FT processing steps forFT processing steps forPlane wavePlane wave……
Fourier SH Processing
Contours in input imageContours in input image
Fourier SH Processing
FT of input image (DCFT of input image (DCsuppressed)suppressed)
Fourier SH Processing
Shift spectrum to centerShift spectrum to centerROIROI’’ss……
Fourier SH Processing
Shift to center ROI for dW/dX Shift to center ROI for dW/dY
Shift spectrum to centerShift spectrum to centerROIROI’’ss……
Fourier SH Processing
Shift to center ROI for dW/dX Shift to center ROI for dW/dY
ROIROI’’ss isolated isolated……
Fourier SH Processing
ROI for dW/dX ROI for dW/dY
Wrapped phaseWrapped phase
Fourier SH Processing
Wrapped phase for dW/dX Wrapped phase for dW/dY
Unwrapped phaseUnwrapped phase
Fourier SH Processing
Unwrapped phase for dW/dX Unwrapped phase for dW/dY
Reconstructed wavefrontReconstructed wavefront
Fourier SH Processing
Note zero aberrations since plane wave.
Spatial demodulationSpatial demodulation11
Similar to FT method, but does not requireSimilar to FT method, but does not requireFFTsFFTs
Multiply spots image by complexMultiply spots image by complexexponential to shift the desiredexponential to shift the desiredneighborhood to origin in the frequencyneighborhood to origin in the frequencydomaindomain
Low-pass filter to isolate the desiredLow-pass filter to isolate the desiredfrequency band (box filter is fast)frequency band (box filter is fast)
Unwrap the resultUnwrap the result Reconstruct the wavefrontReconstruct the wavefront
Spatial Demodulation SH Processing
1Talmi and Ribak, Direct demodulation of Hartmann-Shack patterns, JOSA; vol 21, No 4, 632-9, 2004.
FT modulation relationFT modulation relation
( ) ( )asFxfe FTaxj +→←− π2
The FT modulation relation shows that multiplication by a complexexponential in the spatial domain shifts the Fourier Transform in thespectral domain.
Spatial Demodulation SH Processing
Low-pass box filterLow-pass box filter
For spatial demodulation, low-pass filter isFor spatial demodulation, low-pass filter isperformed via convolutionperformed via convolution
To provide efficient calculation, a box filterTo provide efficient calculation, a box filteris used -- (all coefficients equal)is used -- (all coefficients equal)
Using a sliding sum, the filter is computedUsing a sliding sum, the filter is computedusing only 4 adds per output sample (nousing only 4 adds per output sample (nomultiplies)multiplies)
We use two passes to provide a We use two passes to provide a ““cleanercleaner””frequency responsefrequency response
Spatial Demodulation SH Processing
RectRect SincSinc
( )
→←assinc
aaxrect FT
1
Rect x 0.5,( )
x
Sinc x 0.5,( )
x
Spatial Demodulation SH Processing
Triangle Triangle Sinc Sinc22
( ) ( )2
1)(*
→←=assinc
aaxtriangleaxrectaxrect FT
Triangle x 0.5,( )
x
Sinc x 0.5,( )2
x
Spatial Demodulation SH Processing
Comparison of FT domainComparison of FT domainand Spatial domainand Spatial domain Shift spectral region to centerShift spectral region to center
–– FT: Compute FT and shift complex arrayFT: Compute FT and shift complex array–– SD: Multiply spots image by complex exponentialSD: Multiply spots image by complex exponential
Remove unwanted frequenciesRemove unwanted frequencies–– FT: Zero areas outside ROIFT: Zero areas outside ROI–– SD: Apply low-pass filter via convolutionSD: Apply low-pass filter via convolution
Obtain wrapped wavefront derivativesObtain wrapped wavefront derivatives–– FT: Take IFT and calculate complex phaseFT: Take IFT and calculate complex phase–– SD: Calculate complex phaseSD: Calculate complex phase
Rest of processing the sameRest of processing the same……
ExamplesExamples
Simulated spot imagesSimulated spot images–– Astigmatic wavefrontAstigmatic wavefront–– High dynamic range (High dynamic range (±± 20 D) 20 D)–– High resolution (-0.01 D)High resolution (-0.01 D)–– Third-order aberrations (trefoil & coma)Third-order aberrations (trefoil & coma)
Eye imageEye image–– Large amount of background noiseLarge amount of background noise
Simulated Simulated ““badbad”” exam exam–– Not sufficiently band limitedNot sufficiently band limited
Astigmatic wavefrontAstigmatic wavefront-5 S -2 C x 17-5 S -2 C x 17
Examples
Detected contoursDetected contours
Astigmatic wavefront
MTF of input imageMTF of input image
Astigmatic wavefront
Regions of interest in MTFRegions of interest in MTF
Astigmatic wavefront
Wrapped phaseWrapped phase
Astigmatic wavefront
dW/dX dW/dY
Unwrapped phaseUnwrapped phase
Astigmatic wavefront
dW/dX dW/dY
Reconstructed wavefrontReconstructed wavefront
Astigmatic wavefront
High dynamic rangeHigh dynamic range
-20 D + 20 D
Examples
Detected contoursDetected contours
-20 D + 20 D
High dynamic range
MTF of input imageMTF of input image
-20 D + 20 D
High dynamic range
Regions of interest in MTFRegions of interest in MTF
-20 D + 20 D
High dynamic range
Wrapped x-gradientWrapped x-gradient
-20 D + 20 D
High dynamic range
Unwrapped x-gradientUnwrapped x-gradient
-20 D + 20 D
High dynamic range
Wrapped y-gradientWrapped y-gradient
-20 D + 20 D
High dynamic range
Unwrapped y-gradientUnwrapped y-gradient
-20 D + 20 D
High dynamic range
Reconstructed wavefrontReconstructed wavefront
-20 D + 20 D
High dynamic range
Zernike bar graphZernike bar graph
-20 D + 20 D
High dynamic range
High Resolution: -0.01DHigh Resolution: -0.01D
Examples
Detected contoursDetected contours
High resolution
MTF of input imageMTF of input image
High resolution
Regions of interest in MTFRegions of interest in MTF
High resolution
Wrapped phaseWrapped phase
High resolution
dW/dX dW/dY
Unwrapped phaseUnwrapped phase
High resolution
dW/dX dW/dY
Reconstructed wavefrontReconstructed wavefront
High resolution
Third-order aberrationsThird-order aberrationsTrefoil and ComaTrefoil and Coma……
Examples
Trefoil Coma
Detected contoursDetected contours
Third-order aberrations
Trefoil Coma
MTF of input imageMTF of input image
Third-order aberrations
Trefoil Coma
Regions of interest in MTFRegions of interest in MTF
Third-order aberrations
Trefoil Coma
Wrapped phase for Wrapped phase for dxdx
Third-order aberrations
Trefoil Coma
Unwrapped phase for Unwrapped phase for dxdx
Third-order aberrations
Trefoil Coma
Wrapped phase for Wrapped phase for dydy
Third-order aberrations
Trefoil Coma
Unwrapped phase for Unwrapped phase for dydy
Third-order aberrations
Trefoil Coma
Reconstructed wavefrontReconstructed wavefront
Third-order aberrations
Trefoil Coma
Zernike bar graphZernike bar graph
Third-order aberrations
Trefoil Coma
Real eyeReal eye
Examples
Enhanced captured imageEnhanced captured image
Real eye
MTF of input imageMTF of input image
Real eye
Regions of interest in MTFRegions of interest in MTF
Real eye
Wrapped phaseWrapped phase
Real eye
dW/dX dW/dY
Unwrapped phaseUnwrapped phase
Real eye
dW/dX dW/dY
Reconstructed wavefrontReconstructed wavefront
-3.37 – 2.07 x 125 -3.12 – 1.80 x 125
Real eye
SD Reconstruction Spot Centroid Reconstruction
What do bad cases lookWhat do bad cases looklike?like?
C10 = C11 = 2 micronsC10 = C11 = 2 microns–– Not properly band limitedNot properly band limited
C10 = C11 = 2 micronsC10 = C11 = 2 microns
Not band limited
Detected contoursDetected contours
Not band limited
MTF of input imageMTF of input image
Not band limited
Wrapped phaseWrapped phase
Not band limited
dW/dX dW/dY
Unwrapped phaseUnwrapped phase
FAIL TO UNWRAP
Not band limited
dW/dX dW/dY
DiscussionDiscussion
Compared to SH centroid method theCompared to SH centroid method theFT/SD method:FT/SD method:–– Does not require finding spot centroidsDoes not require finding spot centroids–– Easily allows spots to move outside theirEasily allows spots to move outside their
initial aperture regioninitial aperture region–– Requires phase unwrapping processingRequires phase unwrapping processing
The FT technique is especially suitedThe FT technique is especially suitedto large arrays and large aberrationsto large arrays and large aberrations
DiscussionDiscussion……
Compared to FT method the SDCompared to FT method the SDmethod:method:–– Does not require FT of arraysDoes not require FT of arrays–– Allows handling unwrapping problemsAllows handling unwrapping problems
locallylocally
Discussion
SummarySummary
FT/SD method provides another tool forFT/SD method provides another tool forfinding wavefront from a SH imagefinding wavefront from a SH image
For simulated images the FT/SD method:For simulated images the FT/SD method:–– Has a large dynamic rangeHas a large dynamic range–– Has high resolutionHas high resolution
Caution: Errors occur when the bandwidthCaution: Errors occur when the bandwidthof the wavefront exceed the thresholdof the wavefront exceed the thresholdimposed by the MLA lens spacingimposed by the MLA lens spacing
Thank you!Thank you!
January 26-29 2006
Atlantis Hotel, Paradise Island, Bahamas