Surface Measurement Using Compressed Wavefront Sensing

Compressed sensing leverages the sparsity of signals to reduce the amount of measurements required for its reconstruction. The Shack-Hartmann wavefront sensor meanwhile is a flexible sensor where its sensitivity and dynamic range can be adjusted based on applications. An investigation is done by using compressed sensing in surface measurements with the Shack-Hartmann wavefront sensor. The results show that compressed sensing paired with the Shack-Hartmann wavefront sensor can reliably measure surfaces accurately. The performance of compressed sensing is compared with those of the iterative modal-based wavefront reconstruction and Fourier demodulation of Shack-Hartmann spot images. Compressed sensing performs comparably to the modal based iterative wavefront reconstruction in both simulation and experiment while performing better than the Fourier demodulation in simulation.


Introduction
The accuracy of surface measurement systems is important as they validate the quality of machined or polished surfaces. There are many applications with functions that depend on the surface geometry, such as in mirrors and lenses. The shape of these surfaces has also shifted from simple spherical surfaces to more complex shapes, leading us to aspherical and freeform surfaces. Aspheres and freeform surfaces have been gaining popularity due to their ability to reduce the size of optical assemblies by reducing the number of optical elements required [1]. Important considerations for measurement systems include lateral resolution, dynamic range, configuration complexity, and flexibility [2].
Multiple techniques have been developed to cover this need, and they can be categorized to contact and non-contact based methods [3]. These techniques include contacting stylus, interferometry, confocal microscopy, structured light techniques, scanning electron microscopy, and atomic force microscopy among others [4]. Generally, the more accurate methods are scanning based methods which use either a contact or a non-contact probe. However, they are slow as they must scan over the whole surface for an accurate measurement [3]. Contact probes could also damage the surface of the sample during the scanning process [5]. Non-scanning methods are faster because they can measure a larger area of the surface at a time. Examples include phase measuring deflectometry [6], which is a structured light technique, interferometry [7], and the Shack-Hartmann wavefront sensor [8]. However, the interferometric methods require null lenses, or computer-generated holograms, to correct the incident wavefront due to its high sensitivity and limited dynamic range.
There are attempts to use the Shack-Hartmann wavefront sensor as a surface measurement system. This is due to its flexibility where the sensitivity and dynamic range of the sensor can be optimized by changing the parameters of the lenslet array depending on its application [9,10]. Similar to the shearing interferometric systems, the Shack-Hartmann wavefront sensor measures phase slopes, which are the partial derivatives of the surface profile, instead of surface height, thus making the system more sensitive [11]. The Shack-Hartmann wavefront sensor does not require a null lens as it is able to measure the wavefront slopes in situ [12]. However, the spot images obtained from the Shack-Hartmann wavefront sensor could be distorted if there is too much variation in the gradient in an area [12,13]. These distorted spots would affect the accuracy of centroid calculation and thereafter, the average slope of the area. The variation in gradient of the surface could also cause crosstalk between lenslets of the sensor [14]. This again would affect the accuracy of the slope measured due to the error in centroid calculation.
Therefore, by using the Shack-Hartmann wavefront sensor as a general surface measurement tool, losses in raw data captured should be considered.
The advantage of compressed sensing is that it enables a system to sample a signal at sub-Nyquist rate and still be able to fully preserve the information of the signal [15]. Several implementations of compressed sensing introduce an additional constraint to ensure that the partial derivatives are continuously differentiable in both x and y directions [16]. This form of derivative compressed sensing (DCS) has been used in a number of applications, including 3D surface reconstructions [17], deblurring of images [18], and phase unwrapping [16]. In phase unwrapping, DCS is used to first recover the partial derivatives of the signal from sub critically sampled measurements. The recovered slopes are then integrated by solving a Poisson equation. The authors note that deciding the optimal basis functions to represent gradients, and using other constraints in compressed sensing are open problems to be solved [16]. DCS is also used to estimate the point spread function of an imaging system, which then allows the deblurring of images obtained from that system. The subsampling of partial derivatives is achieved by randomly selecting a set of discretized slope measurements while the basis function used is a set of wavelets, corresponding to a four-level orthogonal wavelet transform [17]. Both these applications however have a concern on the performance of compressed sensing with the presence of side information, which in the case of DCS is the cross-derivative constraint.
This paper proposes the use of compressed sensing in the Shack-Hartmann wavefront sensor as a surface measurement system. The application of compressed sensing in the Shack-Hartmann wavefront sensor is possible because the wavefronts measured can be expressed in a sparse domain, the Zernike domain [19]. Zernike polynomials are the primary functions used to describe wavefronts in general [20]. Another representation that could be used is the wavelet orthobasis function [17]. However, expressing the wavefront slopes in the Zernike domain would simplify the reconstruction as Zernike polynomials are already continuously differentiable across x and y directions [21]. Using wavelets would require an additional constraint to be used like in the case of DCS. Fourier methods are also popular in the reconstruction of partial derivatives and slope measurements using the focal spot images from the Shack-Hartmann wavefront sensor [22,23]. Fourier demodulation of spot images is a convenient method for the recovery of slope measurements from spot images as a whole when compared with the controiding algorithm which is commonly used. These phase slopes could then be integrated to obtain the wavefront. The use of Fourier based data in compressed sensing has also been done in a variety of image reconstruction techniques, particularly in magnetic resonance imaging (MRI) [24]. Similarly, the image reconstruction uses partial derivative measurements, which in this case are encoded as Fourier measurements. The possibility of this technique being used in wavefront or surface reconstruction using partial derivative information in the Fourier domain could be explored.
The ability of compressed sensing to recover signals accurately from their subcritical measurements can be leveraged in applications where the amount of data required are large [25] or when there are too few measurements. When paired with the Shack-Hartmann wavefront sensor, it would be possible to use measurements with discarded data to reconstruct wavefronts at similar performance levels. Higher dynamic range applications when paired with partially filled microlens arrays could achieve similar sensitivity and accuracy if compressed sensing is used. In short, compressed sensing allows a variety of reduced sampling schemes to be paired with the Shack-Hartmann wavefront sensor while achieving a similar level of performance. Thus, it is important to investigate the accuracy of compressed sensing at existing applications and sampling schemes.

Shack-Hartmann wavefront sensor
The Shack-Hartmann wavefront sensor measures the slope of the wavefront using an array of lenslets and a camera. These lenslets focus light onto the camera and act like an optical lever. The average local tilt of the wavefront over the subaperture proportionally displaces the focused ray spot on the camera. The tilt is measured by comparing the difference in positions of the spots obtained from a reference wavefront, usually a flat or spherical wavefront and the measured wavefront. Figure 1 shows the schematic diagram of the Shack-Hartmann wavefront sensor and the focal spot displacement from the aberated wavefront.   Before measuring the local tilt, it is necessary to obtain the locations of the focal spots. The locations of these spots are determined by calculating their centroids along both the x and y axes. The common method to obtain the centroids is by using the weighted average of the focal spot across the subaperture of the sensor with a pixel size of c, using the intensity of each pixel as weights. With i denoting the index in the x direction and j denoting the index in the y direction, the equation is given as follows: This equation is evaluated after a threshold is applied to the spot image. This threshold would reduce the background noise and increase the accuracy of the centroid calculation.
The wavefront slopes are calculated based on the movement of the focused spot. The local tilt of the wavefront causes a shift in the position of the focal spot. This approximation is shown in the schematic of the focal spot displacement in Fig. 3. The relationship among this shift, ∆x, the focal length of the lenslet, f ,and the slope is given by the equation as follows: (2) Using these shifts in focal spot locations, the slope is obtained and integrated to reconstruct the final measured wavefront. The modal wavefront reconstruction method uses the least squares method to obtain the reconstructed wavefront. The slope measurements are arranged into a column vector S. Using a set of basis functions E (organized as a matrix with the functions as columns) to describe the wavefront and given that A is the corresponding coefficient (as a column vector), the reconstruction is given as follows: Using the set of coefficients A, the wavefront W is then described by the predetermined basis function E as follows:

Wavefront reconstruction using compressed sensing
The Shack-Hartmann wavefront sensor typically measures the gradient of the phase map ( ) , x y φ at discrete points. As shown above, the gradient is measured using the difference in position of the centroid in the test wavefront compared with the centroid in the reference planar wavefront, which yields the partial derivatives of the phase map in both the x and y directions. The measurements can be described as The radial function is given as follows: The Zernike polynomials are commonly used to describe wavefronts over a circular aperture due to their orthogonality over a unit circle. For each subaperture or centroid location, the corresponding values of the Zernike polynomials are calculated.
The sampling process of these x and y phase slopes involves another linear operator. The phase slope measurements are reconstructed separately while using the same sampling operator. Therefore, for the case of phase slopes in the x direction is shown as follows: In the above equation, b is a random sample of the phase slope f, while ψ is the sampling operator.
In this method, the sampling operator is just a subset of rows of the identity matrix. This chooses discrete values of the phase slope f. The reconstruction of the signal is done first by solving and c′ is the recovered coefficient. Solving the above equation uses basis pursuit denoising which is an l 1 minimization method and can be represented by using the equation as follows: Using the recovered coefficient, the signal f is then reconstructed as f Zc ≈ ′.
Overall, the whole process above can be summarized by the flow chart in Fig. 4.
Using the captured spot images, the slopes are obtained from the centroids. The relative positions are then used to obtain the slope of the wavefront. The above equations are used to reconstruct both the phase slopes in the x and y directions, and f x and f y . The wavefront is then recovered by solving the Poisson equation with a least-squares based method. The theory of compressed sensing uses the sparsity of a signal to enable its reconstruction from subsampled measurements. By using a properly chosen basis function, a signal could have a relatively small number of non-zero elements. This is where the Zernike polynomials are particularly useful in the application of compressed sensing for wavefront reconstruction. A majority of higher order Zernike polynomials are negligible, thus making the wavefront sparse when represented in the Zernike domain. The subsampled measurements meanwhile can be as little as 5% [21] of the available measurements to reconstruct the wavefront. This reconstruction is achieved by using the l 1 -norm, which minimizes the sum of a particular coefficient vector. This is done in (15) which takes advantage of the sparsity of Zernike coefficients. Also in (15) is the constrain that relates the slope measurements, b, and the representation of the wavefront, Zc.
Compressed sensing is particularly useful in conditions where incomplete or insufficient measurements are obtained in a particular measurement system which measures a sparse signal. Therefore, in this paper, an investigation is done on the effect of reduced measurements on the reconstruction.

Simulation results
The performance of the compressed wavefront sensing algorithm is first evaluated in a simulated setup. 500 random wavefronts are generated using a combination of computer-generated Zernike coefficients. These surfaces are then reconstructed using the compressed wavefront sensing algorithm, the Fourier demodulation of Shack-Hartmann spot images [23], and an iterative modal-based wavefront reconstruction method [26]. Both the modal reconstruction technique and compressed wavefront sensing use 7 radial orders of the Zernike polynomials which have 36 terms. The Fourier demodulation meanwhile smoothens up to an eighth of the pitch between the simulated lenslets. The simulated microlens arrays have sizes ranging from 25 by 25 lenslets down to 13 by 13 lenslets. A circular aperture is used to subsample the available lenslets which yield sample sizes of 441 focal spots down to 113 focal spots. All three methods use the same subsampled focal spots in their phase slope reconstructions. The different sizes of simulated microlens arrays would therefore sample the wavefront at different sample sizes. This is done to investigate the effect of reduced sample sizes on the performances of these reconstruction methods. Photon noises as well as measurement noises are added to the simulated microlens images as well. A Poisson distribution with a variance equal to the intensity of each individual pixel in the spot image is used to model the photon noise while a Gaussian noise with a variance of 5% of the maximum slope measurement is used to model the measurement noise. Their performances are then compared in terms of their mean squared error relative with the original wavefront slopes. Figure 5 shows the simulated wavefront. The error maps between the reconstructed and original wavefront slopes are shown in Figs. 5(c) to 5(e). Figure 5(c) shows the error map obtained from compressed wavefront sensing while Fig. 5(e) shows the error map obtained from the iterative modal wavefront reconstruction.
The reconstruction of the wavefront slopes for all methods produces results that are similar to the original wavefront. Looking at the error maps of the reconstructed wavefront from each method, the error from the compressed wavefront sensing algorithm is quite consistent across the whole aperture. The iterative modal wavefront reconstruction mothod meanwhile shows an error which is consistently lower than other methods. Overall, across 500 wavefronts generated, the error maps from these two methods are quite similar with higher peaks at the edge of the wavefront. The Fourier demodulation method produces a higher error in slope reconstruction for all sample sizes and wavefronts. This behavior is consistent across all 500 wavefront slopes reconstructed using all simulated microlens array sizes.
To quantify the relative error between these methods, the mean squared error across 500 wavefront slopes between the reconstructed wavefront slopes and the original wavefront slopes is obtained for each wavefront and its average tabulated. The results are shown in Table 1. From Table 1, as the number of samples decreases, the general trend is an increase in mean squared error.  However, there is a reduction in mean error at 197 and 149 sample sizes for compressed wavefront sensing. There is also a drop in mean error for the 317 and 197 sample sizes for the iterative modal wavefront reconstruction. These drops could be attributed to the differences in wavefronts used during the simulation with different sample sizes. In the simulation, a single wavefront is reconstructed by all three methods once using only one sample size. Therefore, it is possible that the deviation from the general trend is caused by the differences in the simulated wavefronts. The mean error across the methods meanwhile clearly shows that the Fourier demodulation performs worst with errors consistently 1 order of magnitude higher. The error for larger sample sizes are smaller for compressed wavefront sensing while at lower sample sizes, the iterative modal wavefront reconstruction performs better. While it is shown that the error should increase as the sample size decreases, the results shown do not contradict the findings.

Experimental results
An experiment is conducted to test the viability of the reconstruction process using compressed sensing. The measurement setup consists of a laser, collimator optics, a beam splitter, and the Shack-Hartmann wavefront sensor. The Shack-Hartmann wavefront sensor used in the experiment, a Thorlabs WFS150-7AR, has an effective focal length of 5.2 mm with an array of 30 by 30 lenslets in the active area. The active area of the Shack-Hartmann wavefront sensor used is a square grid of 4.76 mm by 4.76 mm. The schematic of the surface measurement setup is shown below in Fig. 6, and the setup is shown in Fig. 7. The setup consists of a 532 nm laser diode which is collimated using the optics assembly. The collimator ensures that the incident wavefront on the test object is a plane wave. The beam is then transmitted to the test object through a beam splitter.
The reflection from the test object is then transmitted to a set of imaging lenses via the beam splitter. The set of imaging lenses are designed to have a nominal magnification of 0.5. The reflected wavefront then reaches the Shack-Hartmann wavefront sensor at the image plane of the lenses.
Using the system setup shown in Fig. 7, the performance of compressed wavefront sensing is investigated. A total of 4 specimens are used to test the accuracy of the reconstruction. These specimens are listed in Table 2. The results of the wavefront reconstruction show that both compressed sensing and the iterative modal wavefront reconstruction could resolve the global tilt as well as the curvature of the wavefront. Figure  8 shows the reconstruction results from the biconcave lens. Table 3 meanwhile summarizes the results obtained from the reconstructions by using both the compressed wavefront sensing and iterative modal wavefront reconstruction.
From Fig. 8, both methods show that they could resolve the overall shape of the concave lens. The error maps meanwhile show that compressed wavefront sensing reconstruction matches the overall just as well as the iterative modal wavefront reconstruction. The mean squared errors of the reconstructions are as follows: compressed sensing has a mean error of 0.9145 μm, and the least squares method has a mean error of 1.0648 μm. The Thorlabs wavefront sensor meanwhile measures a weighted RMS of 20.779 μm with its internal reference. Fig. 8 Comparison of 100mm focal length bi-concave lens reconstruction: (a) reconstruction results, (b) error map using compressed wavefront sensing, (c) reconstruction results, and (d) error map using iterative modal wavefront reconstruction. The errors from both reconstructions are comparable with each other with higher errors recorded for both the cylindrical lens and asphere. The larger error obtained from the reconstruction of the cylindrical lens could be caused by the nature of the Zernike polynomials used. These polynomials are optimized to describe circular patterns with waves propagating from the center. The cylindrical lens does not have a circular curve. Its gradient is zero in one of its axis.

Conclusions
The use of compressed sensing to aid the Shack-Hartmann wavefront sensor as a surface measurement system is investigated. The performance of compressed sensing is compared with that of the iterative modal based wavefront reconstruction and the Fourier demodulation of Shack-Hartmann spot images. Compressed sensing is found to perform similarly to the iterative modal-based wavefront reconstruction and better than the Fourier demodulation. It is shown empirically that compressed sensing when paired with the Shack-Hartmann wavefront sensor can perform comparably to the modal-based reconstruction method as a surface measurement device. Further investigations can be made on applications with reduced amount of measured data at the high dynamic range and sensitivity applications using a variety of sampling schemes.