Accuracy Analysis for Shack–Hartmann Wave Front Sensing with Extended Sources

Correlating the Shack–Hartmann wave front sensor (SH-WFS) with extended targets is widely used in solar adaptive optics systems. This paper aims to introduce a theoretical analysis that evaluates the accuracy of the SH-WFS on extended sources, with a specific focus on the implementation of the Normalized Cross-correlation (NCC) algorithm. To obtain an accurate error description, we utilized the calculation formula of the NCC algorithm to directly express the coordinates of the maximum value in the correlation function matrix. Furthermore, we determined the variance of the centroid position through the error transfer function, which quantifies the measurement error. In comparison with the previous findings of Michau et al., our result exhibits a coefficient disparity, specifically obtaining results 1.5 times higher than their work. The extensive solar granulation simulation and experimental results validate the theoretical error formulas. These error formulas can effectively estimate the accuracy of the SH-WFS, providing a theoretical foundation for the design of optical systems.


Introduction
The Shack-Hartmann wave front sensor (SH-WFS) has found widespread application in various fields, including optical system design, calibration, and adaptive optics (AO; Platt & Shack 2001;Primot 2003;Guo et al. 2022).This is attributed to its compact structure, high optical efficiency, and ability to operate with continuous target light.The SH-WFS plays a prominent and critical role in identifying and rectifying irregularities in lenses, errors in the installation of optical components, and aberrations in optical systems.
Traditional SH-WFS setups typically comprise microlens arrays and a CCD camera, as depicted in Figure 1.When distortions or deformations occur in the wave front, the positions of the pixels will be shifted due to the focusing of each microlens on a specific region (Rao et al. 2012;Nikitin et al. 2019;Mikhaylov et al. 2020).A camera or detector array is employed to capture the positional data of these displaced spots (see Marzoa Domínguez & Vallmitjana Rico 2021).By quantifying the real-time shifts between these positions, the wave front's phase distortions and gradient distribution can be determined, providing valuable information about its shape and phase.This information enables the reconstruction of the wave front's shape and the subsequent analysis or correction of distortions in the optical system (see Tako et al. 2021), resulting in improved optical performance.Therefore, employing SH-WFS allows for the precise quantification and evaluation of wave front aberrations in optical systems, leading to enhanced imaging capabilities.These insights contribute to the design and enhancement of optical systems, advancing optical technology and facilitating the achievement of various scientific and technological objectives.
During the measurement process, the SH-WFS is subject to several sources of errors.These errors originate from the sensor itself, including sampling point position errors, sensor nonlinearity, and sensor response nonuniformity.Measurement noise, which arises from environmental light and electronic noise, can further introduce measurement errors.Moreover, system errors associated with optical system distortions and variations in the refractive index can impact the detection accuracy of the SH-WFS to different extents (see Jiang et al. 1997).Therefore, it is crucial to carefully acknowledge and address these errors to ensure precise measurements with the SH-WFS.
The accuracy of SH-WFS measurements is significant, as it directly impacts the reliability and accuracy of the obtained data.High accuracy in the SH-WFS allows for the precise analysis of wave front shapes and the generation of high-quality observation images.Moreover, the measurement accuracy of these sensors is of great importance in both scientific research and technological applications.In scientific research, it helps to deepen the understanding of optical phenomena and physical principles by providing insights into wave front shape and phase distortions in optical systems.In technological applications, the accurate measurement of wave front shape plays a significant role in various fields, such as optical imaging, laser processing, and optical communications, supporting the achievement of highprecision optical functionalities and applications.
Solar telescopes enable the observation of various surface features of the Sun, including sunspots, prominences, the solar corona, and activities like radiation, magnetic fields, and solar flares (see Rao et al. 2020).Through these observations, scientists can study the Sun's internal structure, solar wind, coronal mass ejections, and solar flares, thereby enhancing our understanding of solar activity and the origins of the universe (Matthews et al. 2016;Gong et al. 2023).Additionally, solar telescopes are utilized to monitor the impact of solar activity on Earth and the space environment.They also find applications in areas such as solar energy utilization and space weather forecasting.
Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence.Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.Solar telescope observations (Rao et al. 2018;Zhang et al. 2023) primarily focus on structurally complex extended targets under optimal observational conditions, which are different from night astronomical observations.First, the field of view and resolution of the telescope impose limitations on observing extended targets and resolving their internal details.Second, extended targets have low surface brightness, requiring longer exposure times to capture sufficient signals.This increases the complexity of the observation time and data processing (see Sidick et al. 2008).Additionally, atmospheric turbulence has a significant impact on extended targets, highlighting the importance of AO technology in solar observations (see Sidick et al. 2007).
The SH-WFS utilizes template matching and correlation algorithms to calculate image shifts, enhance matching accuracy, and effectively reconstruct wave fronts, thereby improving the quality of solar observations (Ghaffary 1985;Rao et al. 2002).Figure 2 illustrates the principle of template matching, where L represents the live template and R represents the reference image.The reference image R is selected, and its position and size in the image are determined.Subsequently, upon selecting the live image L, a template-matching algorithm is employed to slide or search through the image, quantifying the similarity between R and its overlapping region in L. This process identifies the bestmatching position, corresponding to the local region image that exhibits the highest similarity to the template.
Several well-known correlation algorithms, such as the Absolute Difference Function, Normalized Cross-correlation (NCC), and the Covariance Function in the Fourier domain (CFF), have been widely utilized (Smithson & Tarbell 1977;Von Der Lühe 1983;Miura et al. 2009).These algorithms effectively capture subtle image differences and deliver dependable matching results.NCC, in particular, is highly regarded for its user-friendly nature, straightforward hardware implementation, and remarkable reliability against noise and deformations (see Zhao et al. 2006).It has proven to be  resistant to changes in brightness and contrast, contributing to its extensive utilization with the SH-WFS (see Cui et al. 2020).Cao & Yu (1994) conducted a detailed analysis of the characteristics, patterns, and relationships of image spot centroid errors in the SH-WFS, considering discrete finite sampling, photon noise, and detector readout noise.The research findings by Li et al. (2008) indicate that photon noise errors and sampling errors increase with higher energy values, while readout noise and background noise errors decrease at certain energy values.The relationship between slope estimation performance in extended targets and scene content and illumination was investigated by Poyneer (2003), who derived the patterns of error variation with changes in illumination.Thomas et al. (2006) performed a comparative analysis of different centroid algorithms using theoretical analysis and extensive numerical simulations, identifying the optimal centroid algorithm for different flux levels.
After defining the mean of all subapertures as the noise-free subaperture image, Michau et al. (2006) calculate the autocorrelation functions of both the live and reference images.After obtaining the coordinates of the maximum value in the correlation function matrix, the autocorrelation function is directly substituted into an approximated variance formula.Calculation and simplification are performed to obtain the tilt variance.In the derivation process, assumptions are made regarding the relationship between the autocorrelation functions of the live and reference images, as well as the peak value of the autocorrelation function and its surrounding region.In contrast to Michau et al. (2006), we take a different approach, by directly defining the image containing noise.We input this image into the correlation function and directly calculate the variance of the correlation function.After obtaining the coordinates of the maximum value in the correlation function matrix, the measurement variance is determined using the error transfer function.The variance of the correlation function is then inserted into the error transfer function, allowing for the direct calculation of the variance of the tilt measurement based on the properties of variance.
Generally, the following Section 2 introduces the principles of the NCC algorithm and the implementation of interpolation algorithms.The theoretical error associated with the shift is derived in Section 3. Section 4 validates the obtained results using digital solar granulation, while Section 5 employs authentic solar granulation to further validate the results.Section 6 concludes the paper by summarizing the findings.

NCC Algorithm
The NCC algorithm is a widely employed technique for image matching and pattern recognition.It evaluates the similarity between images by computing the cross-correlation value, as shown in Equation (1).During each iteration of the algorithm, grayscale information is extracted from both the live image and the reference image.The cross-correlation result is obtained by multiplying corresponding pixel values and summing the products.To account for image size and brightness variations, the result is then normalized.The cross-correlation coefficient, denoted as p, is employed to determine the optimal position of the reference image within the live image.The value of p ranges from 0 to 1, where a higher value indicates a higher degree of similarity.The pixel in the live image with the highest correlation is considered the best match for the center pixel of the reference image, and the Euclidean distance between them represents the image shift (Cao & Yu 1994): .
Therefore, the normalization process of the NCC algorithm allows it to prioritize the relative similarity of images, rather than their absolute intensity values.As a result, it becomes less sensitive to variations in lighting conditions and can effectively handle images captured under different lighting conditions, thereby enhancing the accuracy of matching.
To achieve the optimal match, it is necessary to locate the extremum points on the curve of p.However, due to the discrete nature of pixel-level data and limitations in sampling rates, the curve representing the similarity measure may lack smoothness, and the peak values may not align precisely with pixel positions.Hence, the utilization of subpixel interpolation techniques becomes essential to obtain more accurate imagematching information.
Subpixel interpolation operates by calculating values at subpixel levels by placing sampling points between pixels.Common algorithms for subpixel interpolation include 1D Least Squares (LS) Interpolation, 1D Quadratic Interpolation (QI), 2D LS, and 2D QI (as given in Equation ( 2)).Previous studies by Löfdahl (2010) have demonstrated that 2D interpolation provides higher precision compared to 1D interpolation when dealing with extended targets, with minimal computational precision differences.In this study, we utilized the 2D QI method on the results obtained from the cross-correlation: 2D QI is a technique utilized for performing interpolation on 2D images, offering more accurate pixel values.It operates by fitting a 2D quadratic function to discrete pixel points and their neighboring pixels.The algorithm estimates pixel values at positions between these points by solving for the coefficients.This enables the algorithm to excel in identifying extremum points with precision, especially in situations where the curve lacks smoothness or when peak values occur between pixels.As a result, this approach significantly enhances the accuracy and stability of image matching.

Analysis of the Measurement Error
During the derivation of measurement errors, the normalization step in the NCC algorithm adds significant complexity.To simplify the derivation process, the theoretical error derivation focuses exclusively on the numerator component of the NCC algorithm, known as the CFF algorithm (Waldmann et al. 2008), as shown in Equation (3).In practical applications, achieving comparable results to the NCC algorithm involves normalizing the image and performing subsequent crosscorrelation operations (Michau et al. 1993).Image normalization eliminates variations in brightness and contrast between images, enhancing the accuracy of image matching.Furthermore, normalization reduces the impact of factors such as lighting changes and noise, resulting in a more stable and reliable image.Ultimately, normalization improves computational efficiency and enhances algorithm performance: The process of deriving measurement errors is depicted in Figure 3.To begin with, the correlation algorithm undergoes threshold determination, followed by the utilization of the centroid algorithm to calculate the peak value of its correlation matrix.Subsequently, the peak value is estimated for errors using an error transfer function, resulting in simplification and ultimate measurement error outcomes.
In order to facilitate the derivation process, continuous similarity formulas are employed for analysis.Specifically, the correlation function can be defined by Equation (4), where S r represents the region of the reference image: Sr Initially, an image threshold of s is set, and the region with the corresponding function C(x, y) s is denoted as D. Within D, the centroid algorithm is employed to calculate the coordinates (x g ,y g ) corresponding to the maximum value in the correlation function matrix.For example, in the x-direction, the coordinate x g of the maximum value is determined as Equation (5).This procedure aims to enhance the scientific rigor and clarity of the statement: The performance of the SH-WFS can be impacted by various types of noise, such as signal photon noise, background light noise, CCD readout noise, background dark level, discrete sampling error, and others (Ma et al. 2009).It is worth noting that the discrete sampling error can be mitigated by enhancing the sampling accuracy and employing methods to minimize its influence on the measurement accuracy.Moreover, in solar observation, photon noise refers to the fluctuations in photon counts resulting from the random and unpredictable nature of solar light (Shimizu et al. 2008).It is the primary source of noise in solar observation.In comparison to photon noise, other noise sources are generally smaller and can be considered negligible.Therefore, when utilizing a solar telescope for Sun observation, the level of photon noise directly determines the device's noise threshold.Photon noise is an inherent characteristic of a signal and arises from the quantum properties of light.As long as photons are received, photon noise will be present, following a Poisson distribution.This paper primarily focuses on the impact of photon noise on the measurement accuracy of the SH-WFS.
Since Poisson noise is additively added to the original image and occurs independently at each spatial location of the image, let I(x, y) (see Equation ( 6)) represent the live image, which can be separated into a noise-free image I°(x, y) and a noise image I n (x, y).Likewise, the reference image R(x, y) (see Equation (7)) can be decomposed into a noise-free image R°( x, y) and a noise image R n (x, y) as well.It is essential to highlight that the noise images I n (x, y) and R n (x, y) are typically assumed to be independent and added to the respective noisefree images: By substituting Equations ( 6) and (7) into Equation (4), the expression for the correlation function C(x, y) can be obtained, as shown in Equation (8): Building upon the previous statement, we adopt the assumption that the noise in both images follows a Poisson distribution, denoted as N ∼ P(λ), where λ represents the average rate of occurrence for the Poisson distribution, equivalently λ = σ 2 .Utilizing the Poisson distribution enables us to model the image noise more precisely and rigorously evaluate the algorithm's efficacy.Meanwhile, it is also reasonable to suppose that ( ) ( ) .With the aforementioned assumptions, we can derive the expression for the correlation function C(x, y), as written in Equation (9).The comprehensive derivation transitioning from Equations (8)-( 9) can be found in Appendix A: Assuming that the central peak of C(x, y) is | | I r 2 and the width of the autocorrelation function of the reference image is δ, we can approximate the correlation function C(x, y) by employing a parabolic equation, as shown in Equation (10): Accordingly, the region of the integration domain D in the xand y-directions can be represented by Equations ( 11) and (12), respectively.The values of a s and b s are both equal to To enhance our understanding and quantify the patterns of error propagation in the image-matching process, an accurate estimation of the errors resulting from the computation of the NCC algorithm is crucial.The relationship between the measurement error of the shift and the estimation of the centroid position is characterized by utilizing the error transfer function depicted in Equation (13): The variance and the expectation of A g can be represented as Equations ( 14) and (15), respectively: By substituting the variance and expected value of A g , along with the value of B g , into Equation (13) and simplifying, the error value for the measurement shift during the image-matching process of the NCC algorithm can be obtained, as shown in Equation ( 16).The comprehensive derivation transitioning from Equations (13)-( 16) is provided in Appendix B. In this equation, δ represents the width of the autocorrelation function of the reference image, σ 2 denotes the variance of Poisson noise, and 2 indicates the matching peak of the correlation function: Similar to the work of Michau et al. (1993), Equation ( 16) can be expressed as Equation (17).Here, n r 2 represents the total number of pixels in the reference image, and s i 2 represents the variance of the image, which satisfies the relationship given by Equation (18).The variables d, p, f, and λ represent the size of a single subaperture, the size of the CCD pixels, the length of the focal length of the microlens, and the wavelength, respectively: If the sampling satisfies the Nyquist sampling criterion, then dp/fλ = 0.5.Therefore, Equation (17) can be written in the form of Equation ( 19): The variance of the measurement error is a crucial metric for assessing the stability and accuracy of the measurement results obtained through the NCC algorithm.It quantifies the discrepancy between the measured values and the actual values.A smaller variance indicates a higher level of reliability in the measurement results, indicating a closer alignment between the measured values and the true values.Thus, minimizing the variance becomes a key objective when optimizing the NCC algorithm for the precise tracking of extended targets.
Our derived results align closely with those reported by Michau et al. (2006), with the exception of the coefficient (our coefficient is 1.5 times that of their coefficient), as confirmed through our derivation.In the subsequent section, we conduct validation tests on our theoretical calculations using Equation (16) (with units in pixels 2 ) to compare our results with those of Michau et al. (2006), by employing simulated and authentic solar images.

Artificial Simulation Validation
To further demonstrate the accuracy analysis of the SH-WFS with extended sources in our theoretical framework, we conducted a couple of corresponding experiments using simulated solar granulation and compared the results with those obtained by Michau et al. (2006).

Processing
The images were generated using the Stokes inversion code in the spectral region of 500 nm on the SH-WFS.The synthesis of the images employed a response function (see Del Toro Iniesta & Ruiz Cobo 1996).For the creation of the simulated atmosphere, we utilized snapshot 385 from the Enhanced Network simulation and the Bifrost code (Carlsson et al. 2016).The size of the image (see Figure 4(A)) covers a surface area of 24 × 24 Mm, with a pixel size of 48 km and a vertical range spanning from 2.4 to 14.4 Mm.The image itself has dimensions of 503 × 503 pixels 2 and a pixel resolution of 0 066 pixel −1 .
To reduce the pixel resolution of the high-resolution simulated granulation, we generated a point-spread function (PSF) with a wavelength of 500 nm and a Fried's parameter of 10 cm (Rao et al. 2017).The PSF is derived by simulating the idealized atmospheric turbulence effects based on the image resolution.Next, we convolved the PSF with the high-resolution simulated solar granulation, introducing phase perturbations, which resulted in a degraded image (shown in Figure 4(B)).This degraded image maintains the same pixel size and resolution as the high-resolution simulated granulation.
Although the pixel resolution of the degraded image decreased, the pixel size remained unchanged.To approximate the resolution of authentic solar granulation, we applied an 8 × 8 pixels 2 subsampling to the degraded image.This resulted in a merged image with a resolution similar to authentic solar granulation, as shown in Figure 4(C).The pixel resolution of the merged image is 0 53 pixel −1 , with a total of 62 × 62 pixels 2 .
Furthermore, to mitigate the effects of lighting and noise on the image, enhance its robustness and reliability, and improve the speed and accuracy of the algorithm calculations, a normalization process was applied.The normalization process is described by Equation (20), where ¢ I represents the normalized image, I is the original image, min(I) corresponds to the minimum value within the image, and max(I) denotes the maximum value: The effect of this normalization process is demonstrated in Figure 4(D), where the normalized image exhibits sharper, clearer, and more distinctive features compared to the merged image.After the image was normalized, Poisson noise was added, resulting in the image shown in Figure 4(E).
In Figure 5, the manipulation process of the second set of solar granulation is presented.The original high-resolution image can be found in Figure 5(A), with a pixel resolution of 0 013 pixel −1 , corresponding to a size of 10 km.The degraded image, obtained by convolving the original with a consistent PSF, is shown in Figure 5(B).The degraded image was downsampled to a resolution of 0 53 pixel −1 with a sampling rate of 40 × 40 pixels 2 , resulting in a combined image with a pixel size of 24 × 24 pixels 2 (as seen in Figure 5(C)).Finally, after normalizing and adding Poisson noise, we obtained the result shown in Figure 5(E).

Results
To thoroughly evaluate the measurement precision of the NCC algorithm and minimize the deviation of outliers in the measurement outcomes, we introduced a normal distribution shift with a mean of 0 and a standard deviation of 4/3 to the images, resulting in a range shift between −4 and 4. Subsequently, we generated and processed 1000 result images using the NCC algorithm to calculate the shifts.The distribution of shifts and the fitting results are illustrated in Figure 6.
The selection of live images with different sizes for the two sets was driven by the limited size of the result images.To ensure sufficient iteration space for the reference image, a redundancy of 5 pixels was incorporated in each direction of the live images.The first set of images had a live size of 32 × 32 pixels 2 , with the reference image indicated in Figure 4(F).Similarly, the second set of images had a size of 24 × 24 pixels 2 , which is shown in Figure 5(E).We choose 2D QI as the interpolation method.Additionally, we utilized the NCC algorithm to compute the image matching for the two sets of images, and the resulting matching matrices are presented in Figures 7(a) and (b).The matrices exhibit a significant resemblance between the reference image and the live image, as evidenced by the prominent peak in the image matching.This finding aligns with our expectations.In particular, it is worth noting that the first set of images, being larger in size and containing more information, exhibits an even more noticeable peak compared to the second group of images.
The distribution plots in Figure 8 depict the measured and actual shifts in both the x-and y-directions for the two sets of images.These plots demonstrate that the NCC algorithm yields shift values that closely match the actual values, showing fewer outliers.Therefore, the NCC algorithm accurately measures the shift for the extended target, confirming our expectations.
The rms error (RMSE; see Hananto et al. 2021) can be employed as a metric to evaluate the disparity between the calculated theoretical values and the actual values of the NCC algorithm.The theoretical calculation formula is shown in Equation (21), where a(i) signifies the shift calculated by NCC for each frame, m(i) represents the actual shift for each frame, and n denotes the number of images.RMSE calculates the average of the squared differences between the predicted and actual values and then takes the square root to obtain the final value.A smaller RMSE indicates a smaller disparity between the measured value and the actual value, thereby indicating the higher accuracy of the NCC algorithm.To mitigate the impact of the errors resulting from differences in image structure and actual shifts in the x-and y-directions on the accuracy comparison, we utilize the total RMSE, as depicted in Equation ( 22):  (

Illumination Intensity Effects
The brightness of an image plays a pivotal role in determining the matching accuracy of correlation algorithms.To rigorously assess the error formula's accuracy and the robustness of the NCC algorithm across varying illumination intensity conditions, we modified the image's photonumbers, scaling it from 0.1 to two times its original value in steps of 0.1.
Two image sets, as illustrated in Figures 4(C) and 5(C), underwent adjustments in their illumination intensities.Following this, Poisson noise was introduced due to its significant correlation with illumination levels.The sizes for the live images were set at 32 × 32 and 24 × 24 pixels 2 , and the reference image sizes were chosen to ensure an 8 pixel redundancy in each direction relative to the live images.RMSE was employed as the error estimation function.Figure 9 presents computational outcomes for both image sets across various illumination levels.Panels (a) and (b) show the results with pixel resolutions of 0 066 pixel −1 and 0 0133 pixel −1 , respectively.In the figure, W represents our calculated result, R represents the actual measurement error, and M represents the calculated result from the reference literature.
Based on the analysis, changes in illumination intensity appear to have minimal impact on the results of the three data sets.Nonetheless, due to the inherent area limitations of the second image set, its measurement accuracy lags behind that of the first set.Importantly, our algorithm demonstrates superior accuracy compared to the work of Michau et al. (2006).

Image Size Effects
To conduct a thorough validation of the accuracy and explanatory power of the derived error formula and reduce the effects of randomness, we modified the size of the reference images for two sets of images.The redundancy of the live images was gradually increased from 5 pixels in each direction, with a step size of 2 pixels, up to 8 pixels.
Figures 10(a) and (b) present the actual measurement errors of the NCC algorithm for different reference image sizes, as well as the measurement theoretical error results calculated by us and Michau et al. (2006).In these figures, W and M  represent the calculated theoretical measurement errors for us and Michau et al. (2006), respectively, while R represents the actual measurement error.The results indicate that our measurements are more accurate than those of Michau et al. (2006) across different measurement values.Furthermore, when using the same reference image size, the calculations from the first set of images show significantly higher accuracy compared to the second set.This is due to the larger size and higher level of image detail in the live images of the first set, leading to more precise matching.Additionally, increasing the size of the reference image results in a decreasing trend in the measurement error of the NCC algorithm.Also additionally, increasing the size of the reference image has been observed to correlate with a decrease in the measurement error of the NCC algorithm.In the case of the first set of images, where the size of the live image is sufficiently large (32 × 32 pixels 2 ), there is a noticeable positive correlation between the reference image size and the algorithm accuracy within a certain range.However, for the second set of images with a limited live image size (24 × 24 pixels 2 ), employing a reference image size that is too small (8 × 8 pixels 2 ) leads to significantly diminished algorithm accuracy.Notably, as the reference image size increases to 14 × 14 pixels 2 , a gradual improvement in accuracy is observed.
To assess the difference between two sets of numerical values and the accuracy of our theoretical calculation results, we compared the results obtained using the correlation error formula for both our method and the method proposed by Michau et al. (2006).Figures 11(a) and (b) illustrate the relative errors of our method (denoted as W) and the method presented by Michau et al. (2006; denoted as M) calculated using the error formulas for two sets of images with different size reference images.We also introduced a 5% relative error threshold.The results revealed that in the first set of images with different size reference images, all calculated relative errors using our method were below 5%, while the errors  calculated using the method of Michau et al. (2006) method were around 20%.In the second set of images, our calculated relative errors were still lower than those of the method of Michau et al. (2006), although the difference between the two was less significant due to the increase in actual error values.When the size of the reference image was increased, our calculated error remained below 5%.

Experimental Verification
Due to the disparities between simulated and authentic solar granulation, we conducted a validation of our derived NCC algorithm for matching the error formula on extended targets by employing authentic solar granulation.In the operational solar AO system, the SH-WFS measures real-time wave front errors that exhibit temporal and spatial variations.It calculates the average error for each frame, which is utilized to correct wave front distortions.In this section, we apply the NCC algorithm to calculate temporal shifts for continuously captured authentic solar granulation and compare the measured errors with our computed values.

Processing
This paper utilizes authentic solar granulation data obtained by the New Vacuum Solar Telescope at the Fuxian Solar Observatory in Yunnan, China, in 2017.The experimental setup involves a 7 × 7 large field-of-view SH-WFS with 30 effective subapertures and a pixel resolution of 0 5 pixel −1 .The images were captured using an EoSens-3CL camera with an 8 μm pixel size.The incident wavelength of the signal is 550 nm, and the detection frame rate is 800 Hz.A total of 1024 frames were acquired during the experiment.Prior to theoretical analysis, the captured images underwent flat-field and dark-field correction.Figure 12 displays the eighth subaperture of the corrected solar granulation obtained by the large-field SH-WFS.
The live image for this analysis is taken from the eighth subaperture region and has a size of 32 × 32 pixels 2 , as illustrated in Figure 12.Based on the observations in Figures 10 and 11, it is clear that the accuracy of the algorithm is minimally affected by the size of the selected reference image when opting for 32 × 32 pixels 2 .Therefore, in this section, we decide to use a reference image size that includes an additional 4 pixels of redundancy in each direction.

Results
Given the prevalence of Poisson noise in authentic solar images, the noise level can be estimated by averaging the image, leveraging the inherent properties of Poisson noise.By computing the δ and σ values for the live image, we can quantify the measurement error between our calculations, as described in Equation ( 16), and the results presented by Michau et al. (2006).
Upon examining the research by Fusco et al. (2004), it is discerned that for any given time t, the mean correlation  between the open-loop tilt signal time series S rec (t) and its corresponding value at (t + τ) is denoted by C rec (τ): We have shown the variance of tilt noise obtained with the measurement errors calculated using our method (referred to as W), the method proposed by Michau et al. (2006; referred to as M), and the calculated tilt noise (referred to as R) in Figure 13.At the same time, the relative errors calculated by our methods and Michau et al. (2006) have also been shown in this figure.Whether we directly compare the measurement results or evaluate the measurement accuracy based on relative errors, it can be concluded that our method yields measurement errors that are closer to the true tilt noise.

Conclusion
Errors can significantly affect the calibration results and imaging quality of AO.Having accuracy measurements of the SH-WFS accuracy is essential, as it not only influences wave front reconstruction and optical system design, but also plays a crucial role in ensuring the system's accuracy and stability.Specifically, our research aims to accurately estimate the performance of the image-matching algorithm, which is a key factor in determining its effectiveness and reliability.Our findings will offer valuable theoretical guidance for selecting algorithms and designing systems.
In this study, we estimated the peak of the NCC algorithm and utilized an error transfer function to accurately characterize the measurement error.We developed a robust and effective error formula to evaluate algorithm performance.To validate the formula and ensure its robustness and effectiveness, we simulated two sets of high-resolution solar granulation.These images were degraded, pixel-merged, normalized, and noise was added to closely resemble authentic solar granulation.We then performed 1000 shifts on each image, ranging from −4 to 4 pixels, following a normal distribution for both sets of 1000 frames.By employing the NCC algorithm for correlation operation, we calculated the theoretical computing error by using RMSE.Additionally, we compared the results for different illumination intensities of the live images and sizes of reference images to enhance the formula's explanatory power and reduce randomness.
Although previous studies (Cao & Yu 1994;Poyneer 2003;Thomas et al. 2006;Li et al. 2008) have investigated the accuracy of point-source algorithms, limited research has been conducted on the measurement accuracy of spatially extended target correlation algorithms.Michau et al. (2006) have made significant contributions to the accurate estimation of correlation algorithms for extended targets.However, our results differ from those of Michau et al. (2006), mainly in several key aspects.First, there is a discrepancy in the representation of the autocorrelation function.Michau et al. (2006) defined the noise-free subaperture image as the average of all subapertures to represent the autocorrelation function.In contrast, we utilized images that include overall noise to represent the autocorrelation function, which may lead to results closer to the true values.Second, various assumptions made in our derivation process have contributed to the underestimation of errors.The combination of these factors has resulted in an overall underestimation of the results reported by Michau et al. (2006).By comparing the computed error of our error formula with the measurement theoretical error obtained from the NCC algorithm using reference images of varying illumination intensities and sizes, we have successfully verified the accuracy and validity of our error formula.To ensure precise calculations, it is recommended to select larger reference images that allow for a sufficient shift range.Furthermore, the relative error results consistently align with our theoretical expectations.Due to the complex nature of solar images, our simulations and processing can only provide an approximation rather than an exact replication of authentic solar images.Moreover, certain operations, such as pixel merging, can affect the accuracy of the algorithm's shift calculation and measurement error.While there may still be some variance between our theoretical results and actual measurement errors, these differences can serve as a basis for further analysis.Additionally, it is also worth mentioning that we utilized authentic solar granulation to validate our error measurement results, through the estimation of parameters such as image noise and tilt noise variances.Importantly, the conclusions drawn from this validation process are consistent with the results obtained from simulated granulation.These findings demonstrate the practical applicability of our work in various real-life applications, including solar observation, astronomy, and image processing.In summary, this article provides a comprehensive analysis of the accuracy of the SH-WFS when applied to spatially extended sources.The analysis aims to evaluate the performance of the SH-WFS and optimize design parameters for specific applications.Assessing the measurement performance enhances the accuracy and reliability of the SH-WFS, expanding its potential applications in various fields, such as astronomy, AO, and gravitational-wave research.Continued research and technological advancements are expected to improve the precision and performance of wave front sensing devices, further broadening their impact in various scientific and technological domains.On the other hand, our work also establishes a theoretical foundation for the matching accuracy of correlation algorithms, along with proposing methods and ideas for refining and developing improved and novel algorithms.These endeavors enhance the performance of computer vision and image processing algorithms, thereby contributing to advancements in related fields.By incorporating Equations (B3), (B4), and (B5) into Equation (B1), the error variance expression is derived, as depicted in Equation (B6), where s represents the threshold, δ

Figure 1 .
Figure 1.The schematic diagram of the SH-WFS.

Figure 2 .
Figure 2. The schematic diagram of template matching.

Figure 3 .
Figure 3.The flowchart for error measurement derivation.

Figure 6 .
Figure 6.The distribution fitting graph of the generated shifts.

Figure 7 .
Figure 7.The matching matrix of the NCC algorithm when calculating two sets of images.

Figure 8 .
Figure 8.The shifts calculated in the x-and y-directions by the NCC algorithm and the actual shifts.

Figure 9 .
Figure 9. Measurement result error verification of different illumination levels.Panels (a) and (b) show the results with pixel resolutions of 0 066 and 0 0133 pixel −1 , respectively.In the figure, W represents our calculated result, R represents the actual measurement error, and M represents the calculated result from the reference literature.

Figure 10 .
Figure 10.Measurement result error verification of different image sizes.Panels (a) and (b) show the results with pixel resolutions of 0 066 and 0 0133 pixel −1 , respectively.In the figure, W represents our calculated result, R represents the actual measurement error, and M represents the calculated result from the reference literature.

Figure 11 .
Figure 11.Calculation results of relative errors.Panels (a) and (b), respectively, represent pixel resolutions of 0 066 and 0 0133 pixel −1 .W represents our calculation results, and M represents the calculation results from the reference literature.

Figure 13 .
Figure 13.The measurement error and relative error of the authentic solar granulation.The M, R, and W in the bar chart represent the tilt noise calculated by us and Michau et al. (2006)ʼs methods and the true value, respectively.Triangles W and M represent the relative error between the calculation result and the true value, respectively.
tS t 23 rec rec rec where τ represents the temporal iterations.Similar to C rec (τ), C turb open (τ)indicate the auto-correlation function of the tilt in the time series, which emerges due to atmospheric turbulence and telescope disturbances during the open-loop process.Following that, we can establish the transfer function relationship as depicted in Equation (24): In simpler terms, the difference between the autocorrelation values of the reconstructed open-loop tilt data and the fitted autocorrelation values at the zero-point represents the variance of the tilt noise: