Most Shack-Hartmann based aberrometers use infrared light, for the comfort of the patients. A large amount of the light that is scattered from the retinal layers is recorded by the detector as background, from which it is not trivial to estimate the centroid of the Shack-Hartmann spot. For a centroiding algorithm, background light can lead to a systematic bias of the centroid positions towards the centre of the software window. We implement a matched filter algorithm for the estimation of the centroid positions of the Shack-Hartmann spots recorded by our aberrometer. We briefly present the performance of our algorithm, and recall the well-known robustness of the matched filter algorithm to background light. Using data collected on 5 human eyes, we parameterise a simple and fast centroiding algorithm and reduce the difference between the two algorithms down to a mean residual wavefront of 0.02 μm rms.
©2010 Optical Society of America
The Shack-Hartmann wavefront sensor has a large number of ophthalmic applications, some of which have a great impact on the future life of the patients. Naturally, its performance has been questioned by many authors, usually for the problem of reconstructing the wavefront map from the measured centroid positions [1–5]. However, the measurement of the centroid positions is the core of the Shack-Hartmann wavefront sensor, and corresponds to the largest reduction of data in the measurement process [6, 7].
Aberrometers are usually designed with a large number of CCD pixels per single lenslet, in order to cope with the extended nature of the Shack-Hartmann spots and provide adequate dynamic range. Shack-Hartmann spots are processed independently using a “software window”, which typically corresponds to the aperture of one lenslet (between 10 × 10 and 20 × 20 pixels). As result, a large number of noisy pixels do not carry any significant information about the measured wavefront, and are responsible for a lack of precision in the estimation of the centroid positions.
The noise that corrupts the CCD data recorded by a Shack-Hartmann wavefront sensor is classically described by combined Poisson and Gaussian statistics, in order to model the fundamental randomness of the detection and the processing of photoelectrons . For an open-loop aberrometer, both the precision and the accuracy of the estimated centroid positions are of primary interest. Precision is usually improved by an adequate reduction of the CCD data, so that noisy CCD pixels are partially suppressed. Methods to suppress irrelevant pixels mainly consist of applying a rectangular or Gaussian weighting function [9–15] and/or thresholding the data [16–18]. These methods can bias the estimated centroid positions if significant information is thrown away [19–23].
Matched filter algorithms have been introduced for solar adaptive optics , an application of the Shack-Hartmann wavefront sensor for which no point source is available. They allow to track the spatial features of an extended object, which is imaged by each lenslet of the Shack-Hartmann. For the estimation of the centroid position of a Gaussian Shack-Hartmann spot, a matched filter algorithm has also the advantage of being more linear than a simple centroiding [23,25].
Near infrared light is commonly used for aberrometry in the eye , at the cost of an increased amount of scattered background in the recorded CCD data. The major consequence of the background light on a centroiding algorithm is to bias the estimated centroid position towards the centre of the software window, simply because of its uniform distribution across the detector plane. We show in the next section that this feature is of particular relevance for aberrometry of the eye. As an alternative, we stress the benefit of estimating the centroid position of the Shack-Hartmann spot with a matched filter algorithm. The linearity of the matched filter algorithm is insensitive to the amount of background light, when the cross correlation is computed with Fourier transforms .
2. Numerical simulations
2.1. Description of the custom-built aberrometer
We present in this section some numerical simulations of the performance of a matched filter and a centroiding algorithms. We parameterise our simulations to realistically model the measurement process of a custom-built aberrometer, which we present in Fig. 1. The 0.2 mm pitch of a lenslet corresponds to 18.5 pixels of the CCD, and the data are processed using 15 × 15 software windows. The aberrometer uses a very narrow probing beam of full width at half maximum (FWHM) 0.5 mm in the pupil of the eye, in order to consistently obtain Gaussian Shack-Hartmann spots of FWHM w ≃ 3.5 pixels. We typically use a 15 μ W probing beam to obtain spots with a mean peak a ≃ 400 D.U., at a 100 Hz frame rate. The detector has a 40 ē rms readout noise, and a gain of 30 ē/D.U. The use of a scanning mirror, which is conjugated with the pupil of the eye, reduces drastically the speckled aspect of the spots due to scattering . For a mean signal a ≃ 400 D.U., we experimentally evaluated the precision of the centroid positions estimated with a matched filter algorithm as a standard deviation of 0.006 pixels. To do so, we measured a sequence of 1000 wavefronts using an artificial eye (a 18 mm lens, with an opaque screen in the back focal plane) in a “double-pass” configuration. This random error corresponds to a 2.5 nanometers rms error on the estimated wavefronts. We summarise the main parameters of our custom-built aberrometer in Table 1.
2.2. Parameterisation of the simulations
We model the 15 × 15 noise-free CCD image recorded by our custom-built aberrometer as a Gaussian profile with an additional homogeneous background. The FWHM of the simulated Shack-Hartmann spot is w = 3.5 pixels, the peak signal is a = 400 (10 bit) Digital Unit (D.U.), and the background b = 50 D.U. These values are typical for our aberrometer, operating at 780 nm. The centroid position of the spot is parameterised by the 2-dimensional vector ρ (in pixels, with the centre of the software window taken as origin). Only shifts smaller than 0.5 pixels are considered, which corresponds to accurately positioned software windows (“second pass centroiding”). We model the noise of each CCD pixel independently, as combined Poisson and Gaussian statistics, parameterised by the gain and the readout noise of the camera. (See Table 2.)
2.3. Matched filter algorithm
The matched filter algorithm estimates the shift that maximises the scalar product of a reference image (Gaussian spot, of FWHM 3.5 pixels) with the recorded data . The scalar product of the two images can be seen as a cross correlation and thus be computed using the Fourier transform, according to the correlation theorem [23, 27, 29]. The linearity of the algorithm can be understood with the Shannon sampling theorem and the concept of space-bandwidth product . The algorithm that we implemented is described in . The accuracy of the estimated shift of the spot depends on the interpolation of the cross correlation. We do this interpolation by padding the cross spectrum of the two functions with zeroes, so that the estimated cross correlation has a size of 45 × 45 pixels.
The amount of shift that can be estimated without noticeable bias depends on the FWHM of both images. The accuracy of the algorithm is better than 0.001 pixels in the absence of noise for spots of FWHM w = 3.5 pixels shifted up to ρ x = 4 pixels, independent of the amount of homogenous background.
2.4. Centroiding algorithm
The matched filter is compared in this paper with a centroiding algorithm that uses a rectangular window, of width R (in pixels), and a normalised threshold 0 ≤ t ≤ 1. The algorithm first computes the minimum b and the maximum a of the 15 × 15 local data, and then set to zero the data that are bellow the threshold value (2a/3 - b) × t + b. A rectangular windowing is then applied, and the center of mass is computed as an estimate of the centroid position. The algorithm is shown in Fig. 2. For t = 0, there is no effective thresholding of the data. For t = 1, the threshold level is 2a/3.
2.5. Effect of background light on the centroid estimates
The main effect of background light on a centroiding algorithm is to introduce non-linearity in the estimated centroid positions. As soon as the “true” centroid position (that we define with the noise-free simulation) moves away from the centre of the software window, the centroiding algorithm leads to a biased estimation of the centroid position towards the centre of the window. Without background light, a centroiding algorithm has a given range of linearity, which corresponds to the domain of true centroid positions for which there is no truncation of the Shack-Hartmann spots by the weighting function.
We illustrate this effect with numerical simulations. An ensemble of 1000 noise realizations is simulated for each noise-free Gaussian spot, which is parameterised by a variable centroid position ρ = [ρx, 0] and the numerical values of Table 2. Fig. 3 shows the Mean Square Error  (MSE, in pixels squared) in the estimated x-position of the centroid (ρ̂x) as a function of the noise-free centroid (ρx), using two unthresholded (t = 0) centroiding algorithms (R = 5 and R = 15) and the matched filter algorithm.
For a peak signal a = 400 D.U. and a background b = 50 D.U., the non-linearity of the unthresholded centroiding algorithm is important, for both the R = 5 (red dots) and the R = 15 (blue dots) algorithms. The MSE increases with the amount of shift of the true spot. For ρx = 0.5, the error is around 0.33 pixels for R = 15, and 0.26 pixels for R = 5.
For the R = 15 algorithm, this effect is due to the contribution of the uniform background light, the centroid of which is in the middle of the processed window. As a result, the estimated position of the centroid is biased towards zero. Without background light, the R = 15 centroiding algorithm remains linear (blue solid graph), because there is no significant truncation of the Gaussian spot over the full [0 – 0.5] pixels range of shifts.
The R = 5 centroiding algorithm is not linear both with and without background light (red dotted and solid graphs respectively), because there is a significant truncation of the Shack-Hartmann spot by the 5 × 5 rectangular window. For ρx = 0.5, the error is 0.17 pixels without background, and 0.27 pixels with background. With background light, the error arises from a combined effect of the truncation of the Shack-Hartmann spot and the background. In the zero shift case (ρx = 0), the low MSE error of the R = 5 centroiding algorithm (MSE ≃ 2 × 10-5 pixels squared, both with and without background) should be carefully interpreted. This is a typical feature of a biased estimator, which can perform better than the theoretical lower bound of the variance . This so called Cramer-Rao lower bound  has been investigated for the estimation of the centroid position of a point source [31, 32], which is of particular relevance for the Shack-Hartmann wavefront sensor.
The matched filter remains linear over the whole [0-0.5] pixels range of shifts, even with the background light. The MSE of the matched filter is higher with the background light, because it is subject to the combined Poisson and Gaussian noise. For a non-biased estimator, having a larger error (variance) when the contrast of the image decreases is “natural”.
Figure 3 thus demonstrates that great caution is required in using a centroiding algorithm in practice, even when “smart” centroiding (recursive variable threshold, variable width centroiding) is used. Taking the matched filter as a reference, we discuss in Section 3 the performance of the centroiding algorithm, for data recorded on 5 human eyes. The comparative study of Section 3 confirms the large non-linearity of the unthresholded centroiding algorithm in the presence of background light. We also quantify the effect of the normalised threshold t on the centroid positions estimated by the centroiding algorithm.
3. Comparative study on human eyes
We present in this section a comparative study of the matched filter and the centroiding algorithms, using experimental data obtained with our custom-built aberrometer. We measure 5 young subjects during a 1 second trial that has no occurrence of blinks, and we compute the difference Δ ρ = ρ̂cent - ρ̂mf between the centroid positions estimated by the matched filter ρ̂mf and the centroiding algorithm ρ̂cent. The centroiding algorithm uses a threshold t and a rectangular window of size R, which is positioned on the integer value of the centroid position ρ̂mf. We present in Table 3 the mean values of the peak a and the background b of the data, which are estimated for each subject by spatio-temporal averaging of the minimum and maximum values of the processed local data. The values presented in Table 3 are close to the values we used in the simulations of Section 2(a = 400 D.U. and b = 50 D.U.). We record more background light on subject 1 than on the other subjects, and we interpret this result by the low pigmentation of his eyes.
3.2. Non-linearity of the unthresholded centroiding algorithm
Figure 4 shows that, for subject 2, the centroid positions ρ̂cent (“·”) are systematically biased towards the centre of the software window, for R = 9 and no thresholding (t = 0). This effect is also apparent in Fig. 5, which shows that the norm of Δ ρ is proportional to the norm of the centroid positions ρ̂mf. The larger departures from a straight line obtained for the R = 15 centroiding algorithm (right graph of Fig. 5) are due to the contribution of a larger number of noisy pixels. Without any thresholding applied, the centroiding algorithm is barely sensitive to a sub-pixel shift of the Shack-Hartmann spot, for any size R of software window.
3.3. Effect of thresholding
Figure 6 shows (for subjects 1 and 2) the root mean square value of the differentiated centroid positions, as a function of the threshold t. (∩〉 denotes spatio-temporal averaging for a given subject.) The centroiding algorithm with a R = 15 window and a low threshold provides estimates that are very different from the matched filter estimates (up to σ ≃ 0.6 pixels, for t ≃ 0.2). This peak in σ(t) comes from the inhomogeneity of the scattered light, and is significant for both subjects 1 and 2. The threshold level t has thus to be set sufficiently high to eliminate completely the background of the local data. Figure 7 shows the partially thresholded CCD data obtained with subject 2, for t = 0.1 (left) and t = 0.2 (middle). In both images, the pixels that are set to zero are not symmetrically distributed around the core of the spot. This leads to a large bias in the centroid estimates.
For both subjects 1 and 2, the error is close to a minimum value for t = 0.8, independent of the size of the centroiding window R. For subject 2, σ is relatively insensitive to the value of the threshold in the range 0.4 < t < 0.8. We interpret the difference between the results of subject 1 and 2 by the high amount of background light recorded on subject 1. Given the results of Fig. 6, we will consider in the following the effect of thresholding the data for all subjects, with/ = 0.8.
Thresholding reduces the residual error of the centroiding algorithm, from approximatively σ ≃ 0.3 pixels (t = 0) down to σ ≃ 0.13 pixels (t = 0.8). The residual error does not fall bellow 0.13 pixels. We interpret this residual error by the truncation of the spot, which leads to bias in the centroid estimates. The truncation is illustrated in Fig. 7 (right graph, obtained with a threshold level t = 0.6). Regardless of t, the residual error is well above the 0.006 pixels precision of our aberrometer, which we experimentally measured using an artificial eye. Figure 8 shows for 5 subjects the mean rms error of the tip/tilt removed residual wavefront, for t = 0 and t = 0.8. This residual rms is computed using a modal reconstruction of Zernike coefficients (up to the tenth radial order). A t = 0.8 threshold allows to consistently decrease the difference between the matched filter and the centroiding algorithm down to a mean error of 0.02 μm rms, for the 3 window sizes. Without thresholding, we found a mean rms value of 0.045 /im for R = 5 and R = 9, and 0.062 μm for R = 15.
The extended nature of Shack-Hartmann spots and the amount of background light obtained in human eyes justify the choice of the matched filter algorithm for aberrometry. Its close relationship to the least-squares estimator makes it also suitable for dealing efficiently with a larger number of pixels subject to Gaussian readout noise .
However, we have shown that the difference between the (tip/tilt removed) estimated aberrations becomes in the order of 0.02 μm rms when an appropriate thresholding of the data is applied before centroiding (t = 0.8), independently of the size of the rectangular window R. This residual error is not significant for most ophthalmic applications of the Shack-Hartmann wavefront sensor, as it corresponds to λ/25 for a 0.5 μm wavelength. Using MATLAB 7.4.0, we found our implementation of the matched filter algorithm 6 times slower than the centroiding algorithm, for the processing of 15 × 15 pixels images. For an adaptive optics system, the modest gain in accuracy obtained with the matched filter algorithm might therefore be obtained at the cost of a reduced bandwidth, unless appropriate parallel processing of the data is implemented (using field programmable gate arrays for instance).
Without thresholding, the centroiding algorithm leads to centroid positions that are systematically estimated at the centre of the software window. With our custom-built aberrometer, we estimated the corresponding (tip-tilt removed) error between 0.045 and 0.062 μm rms.
This research was funded by Science Foundation Ireland under Grant No 07/IN.1/I906.
References and links
1. S. Bara, “Measuring eye aberrations with Hartmann-Shack wave-front sensors: Should the irradiance distribution across the eye pupil be taken into account?” J. Opt. Soc. Am. A 20, 2237–2245 (2003). [CrossRef]
2. L. Diaz-Santana, G. Walker, and S. Bara, “Sampling geometries for ocular aberrometry: A model for evaluation of performance,” J. Opt. Soc. Am. A 13, 8801–8818 (2005).
3. S. Bara, “Characteristic functions of Hartmann-Shack wavefront sensors and laser-ray-tracing aberrometers,” J. Opt. Soc. Am. A 24, 3700–3707 (2007). [CrossRef]
5. L. Llorente, S. Marcos, C. Dorronsoro, and S. Burns, “Effect of sampling on real ocular aberration measurements,” J. Opt. Soc. Am. A 24, 2783–2796 (2007). [CrossRef]
6. R. Cannon, “Global wave-front reconstruction using Shack-Hartmann sensors,” J. Opt. Soc. Am. A 12, 2031–2039 (1995). [CrossRef]
7. H. Barrett, C. Dainty, and D. Lara, “Maximum-likelihood methods in wavefront sensing: stochastic models and likelihood functions,” J. Opt. Soc. Am. A 24, 391–414 (2007). [CrossRef]
8. H. H. Barrett and K. J. Myers, Foundations of Image Science (Wiley-Interscience, 2003).
9. G Rousset, “Wave-front sensors,” in Adaptive Optics in Astronomy, F. Roddier eds. (Cambridge University Press, 1999). [CrossRef]
10. J. Porter, H. Queener, J. Lin, K. Thorn, and A. Awwal, eds., Adaptive Optics for Vision Science: Principles, Practices, Design and Applications (Wiley, 2006). [CrossRef]
11. L. Diaz-Santana Haro, Wavefront Sensing in the Human Eye with a Shack-Hartmann Sensor (PhD thesis, 2000).
12. P. Prieto, F. Vargas-Martn, S. Goelz, and P. Artal, “Analysis of the performance of the Hartmann-Shack sensor in the human eye,” J. Opt. Soc. Am. A 17, 1388–1398 (2000). [CrossRef]
13. T. Fusco, M. Nicolle, G. Rousset, V. Michau, J.-L. Beuzit, and D. Mouillet, “Optimisation of Shack-Hartmann based wavefront sensor for XAO system,” in Advancements in Adaptive Optics, Proc. SPIE 5490, 1155–1166 (2004). [CrossRef]
16. J. Ares and J. Arines, “Effective noise in thresholded intensity distribution: influence on centroid statistics,” Opt. Lett. 26, 1831–1833 (2001). [CrossRef]
17. J. Arines and J. Ares, “Minimum variance centroid thresholding,” Opt. Lett. 27, 497–499 (2002). [CrossRef]
19. B. Welsh, B. Ellerbroek, M. Roggemann, and T. Pennington, “Fundamental performance comparison of a Hart-mann and a shearing interferometer wave-front sensor,” Appl. Opt. 34, 4186–4195 (1995). [CrossRef] [PubMed]
20. R. Irwan and R. Lane, “Analysis of optimal centroid estimation applied to Shack-Hartmann sensing,” Appl. Opt. 38, 6737–6743 (1999). [CrossRef]
21. M. Van Dam and R. Lane, “Wave-front slope estimation,” J. Opt. Soc. Am. A 17, 1319–1324 (2000). [CrossRef]
22. J. Arines and J. Ares, “Significance of thresholding processing in centroid based gradient wavefront sensors: effective modulation of the wavefront derivative,” Opt. Commun. 237, 257–266 (2004). [CrossRef]
23. S. Thomas, T. Fusco, A. Tokovinin, M. Nicolle, V. Michau, and G. Rousset, “Comparison of centroid computation algorithms in a Shack-Hartmann sensor,” Mon. Not. R. Astron. Soc. 371, 323–336 (2006). [CrossRef]
24. T.R. Rimmele and R.R. Radick, “Solar Adaptive Optics at the National Solar Observatory,” Proc. SPIE 3353, 72–81 (1998). [CrossRef]
25. J. Ruggiu, C. Solomon, and G. Loos, “Gram-Charlier matched filter for Shack-Hartmann sensing at low light levels,” Opt. Lett. 23, 235–237 (1998). [CrossRef]
28. H. Hofer, P. Artal, B. Singer, J. Aragn, and D. Williams, “Dynamics of the eye’s wave aberration,” J. Opt. Soc. Am. A 18, 497–506 (2001). [CrossRef]
30. J. W. Goodman, Introduction to Fourier Optics (Roberts and Company, 2005).
31. K. Winick, “Cramér-Rao lower bounds on the performance of charge-coupled-device optical position estimators,” J. Opt. Soc. Am. A 3, 1809–1815 (1986). [CrossRef]