A method for Hartmann spot integrity recovery by Gaussian template out-expansion-interpolation with pitch driving
By using a spacing-driven Gaussian template expansion-interpolation method, the problem of incomplete light spot arrays in Hartmann wavefront sensors under bright gradient and dense speckle scenes was solved, realizing the self-growth and integrity reconstruction of light spots, thus improving measurement accuracy and robustness.
Patent Information
- Application Number
- CN202511615061.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-11-06
AI Technical Summary
Existing Hartmann wavefront sensors are prone to beam array defects and reduced restoration accuracy in scenarios with significant brightness gradients and dense spot density, resulting in insufficient system automation and robustness.
A Gaussian template expansion-interpolation method driven by spacing is adopted. The Gaussian template is generated in real time using the average center distance of the detected spots in the current frame. The template is expanded and matched point by point, and the gaps inside the spot array are interpolated to achieve self-growth and integrity reconstruction of missing spots.
Significantly improves the robustness and measurement accuracy of Hartmann wavefront sensors under complex lighting and low signal-to-noise ratio conditions, increases spot utilization, improves array integrity, and meets real-time measurement requirements.
Smart Images

Figure CN121073839B_ABST
Abstract
Description
Technical Field
[0001] This invention provides a method for restoring the integrity of a Hartmann spot using a Gaussian template expansion-interpolation driven by a spacing, belonging to the field of signal processing technology for beam wavefront measurement. Background Technology
[0002] The Shack–Hartmann Wavefront Sensor (SH-WFS) divides the incident wavefront into several sub-wavefronts using a microlens array and records the centroid shift of the focal spot in each sub-aperture using a detector (CCD, CMOS camera), thereby inverting the wavefront phase. This technology has advantages such as non-contact operation, good real-time performance, and high accuracy, and is widely used in fields such as optical component inspection, adaptive optics, and laser beam diagnostics.
[0003] The normal operating procedure of SH-WFS requires pre-calibration using an ideal plane wave: a fixed threshold binarization is used to obtain the number of reference spots and the location of the reference centroid, and a restoration matrix E (dimensional 2K×(N−1), where K is the number of effective sub-apertures and N is the Zernike fitting order) is constructed. However, in actual calibration or measurement, due to factors such as uneven energy distribution of the light source, nonlinear detector response, manufacturing errors of the microlens array, and optical path assembly deviations, a brightness gradient of "dark center, bright edges" often occurs. If a fixed threshold is continued to be used in this situation, it will lead to:
[0004] 1. Some effective sub-apertures were missed, resulting in a fragmented spot array;
[0005] 2. The amount of data involved in wavefront reconstruction is reduced, resulting in decreased reconstruction accuracy;
[0006] 3. The threshold needs to be manually adjusted repeatedly, and the system lacks automation and robustness.
[0007] While existing technologies have proposed improvements such as local adaptive thresholding and iterative thresholding, they still rely on global or statistical priors and fail to maintain array integrity in scenarios with significant brightness gradients and dense speckle formation.
[0008] Therefore, there is an urgent need for a method that does not require pre-setting ideal grid points and can adaptively recover missing light spots according to the local brightness of the image, so as to improve the reliability and measurement accuracy of SH-WFS under complex lighting conditions. Summary of the Invention
[0009] To overcome the problems of incomplete light spot arrays and reduced restoration accuracy caused by brightness gradients and dense spot defects due to non-ideal factors in the existing technology, this invention provides a spacing-driven Gaussian template expansion-interpolation Hartmann light spot integrity restoration method. This method does not require preset ideal grid points, but only uses the average center distance of the detected light spots in the current frame to generate a Gaussian template in real time, and expands it outward point by point along the row and column directions with the spacing as the step size. At the same time, it performs hole interpolation on the inside of the existing spot array, thereby realizing the self-growth and integrity reconstruction of missing light spots under complex illumination and low signal-to-noise ratio conditions, significantly improving the robustness and measurement accuracy of Hartmann wavefront sensors.
[0010] The technical solution of this invention is as follows:
[0011] A method for restoring the integrity of a Hartmann spot using a spacing-driven Gaussian template expansion-interpolation technique includes the following steps:
[0012] S1, preprocess the original image and extract the centroid coordinates P0 of all detected light spots;
[0013] S2, calculate the measured average center distance d;
[0014] S3, dynamically generates Gaussian templates;
[0015] S4, using P0 as the seed, performs row and column tracking expansion and internal gap filling, iterating continuously until the number of new points is less than K. min Or reach the maximum number of iterations N max ;
[0016] S5 outputs a complete list of light spots.
[0017] Preferably, in step S1, the original image acquired by the Hartmann detector is linearly stretched to obtain an 8-bit grayscale image. Then, operations such as fixed threshold binarization, area filtering, and morphological closing operation are performed to obtain an initial binary spot. The centroid coordinates of all detected spots are extracted using connected component analysis and denoted as set P0.
[0018] For original image data of 8 bits or more, linear conversion to 8 bits is required first. If the original data is already 8 bits, no conversion is needed, and fixed threshold binarization can be performed directly. In subsequent operations, area filtering, morphological closing operation, and connected component analysis are common image processing methods to obtain the centroid coordinate set P0 of the binarized spot.
[0019] Preferably, in step S2, the distance between the coordinates of each point is calculated by P0, and the average value of the minimum spacing between each point is taken as the measured average center distance d (in pixels) for subsequent adaptive setting of template scale and search step size.
[0020] The distance between the coordinates of each point is the Euclidean distance dist:
[0021] ;
[0022] in( , ), ( , Let be the coordinates of any two points in P0. The distance between adjacent light spots is the smallest. For each light spot, the minimum value of all distances is taken as the result of calculating the center-to-center distance of that point. The average value of the calculation results of all light spots is taken as the average center-to-center distance d.
[0023] Preferably, in step S3, σ=K1W spot A two-dimensional Gaussian kernel template G is generated, with a template size of (d+1)×(d+1), to obtain a relevant template that matches the spot size of the current frame in real time; where σ represents the feature width of the Gaussian template, W spot K1 represents the theoretical width of a single light spot, and K1 represents the multiple.
[0024] The detailed derivation process is as follows:
[0025] When a plane wave is incident, the energy distribution of the focal spot in the sub-aperture can be approximated as a Gaussian distribution:
[0026] ;
[0027] Where A is the maximum value of the template. , For template coordinates, The characteristic width of the Gaussian template is equal to the theoretical width W of a single light spot. spot K1 times, used to control the matching of the template with the lateral size of a single light spot.
[0028] K1 is calculated as follows: the full width at half maximum (FWHM) of the Gaussian distribution and its parameters. The relationship is:
[0029] ;
[0030] The theoretical width W of a single light spot spot The relationship with FWHM can be expressed as:
[0031] ;
[0032] in The incident light wavelength, For the sub-aperture focal length, Here are the sub-aperture dimensions, all of which are known parameters. Therefore:
[0033] ;
[0034] Denoted as σ = K1W spot .
[0035] Through the above reasoning and analysis, it can be obtained that:
[0036] , K1 = , and then according to σ = K1W spot σ is obtained.
[0037] The template size is taken as (d + 1)×(d + 1), which means performing correlation matching within a sub-aperture region to check for light spots missed due to fixed-threshold binarization. Different sub-aperture shapes will result in the energy distribution of the focal spot not being a strictly Gaussian distribution, such as rectangular sub-apertures, hexagonal sub-apertures and other non-circular sub-apertures, but there are corresponding theoretical templates, which can be selected according to the actual situation.
[0038] Preferably, in step S4, the process of row-column tracing and outward expansion is as follows:
[0039] S41, traverse the coordinates in P0, and extrapolate candidate coordinates [x k , y k point by point in the four directions of ±x and ±y with a step size of d;
[0040] That is, look for missing light spots in the four directions of "up, down, left, and right" of P0 with a step size of d. Taking the point (x1, y1) as an example, check whether there are coordinates already existing in P0 near the four positions (x1 + d, y1), (x1 - d, y1), (x1, y1 + d) and (x1, y1 - d). If there are, skip the inspection of this position; if not, perform cross-correlation matching;
[0041] S42, take a (d + 1)×(d + 1) image block matrix centered at each candidate coordinate position as a patch, perform cross-correlation with G, and obtain the matching degree C = Cor(patch, G);
[0042] Taking the position (x1 + d, y1) as an example, take a sub-image with a range of (x1 + d - d / 2 : x1 + d + d / 2, y1 - d / 2 : y1 + d / 2) in the original data picture as a patch, with a size of (d + 1)×(d + 1), perform cross-correlation matching operation with the template G to obtain the matching degree C, C = Cor(patch, G).
[0043] S43, if C ≥ the threshold Th, add this coordinate to the candidate set P1, and continue to extrapolate in this direction until C < Th or out of bounds and stop.
[0044] After obtaining the matching degree C of position (x1+d, y1), it is compared with the threshold Th. If C ≥ threshold Th, it means that there is a missing spot at that position, and (x1+d, y1) is added to the new coordinate set P1. Continue to search for the next spot along the positive x direction, i.e. (x1+2d, y1), until C < threshold Th or it goes out of bounds.
[0045] The choice of Th can be determined by the actual situation, and the selection range is [0,1]. If the original data has high noise, poor uniformity of light source energy distribution, or other non-ideal conditions, a higher threshold can be selected to ensure accurate search.
[0046] A suitable Th value can be pre-tested under similar operating conditions to find the optimal value. Th values of 0.3, 0.5, and 0.7 can be used for external matching, with the result of a "manual full inspection" taken as the true value. When Th = 0.3, the recall rate is 97%, but the false positive rate is 8%; when Th = 0.5, the recall rate is 95%, and the false positive rate is 2%; when Th = 0.7, the recall rate is 82%, and the false positive rate is <1%. Considering both recall and false positive rates, this embodiment preferably uses Th = 0.5. If the light source has high stability and low noise, the value can be reduced to 0.4; if the brightness gradient is drastic and the noise is significant, the value can be increased to 0.6.
[0047] Preferably, in S42, the Cor operation is:
[0048] ;
[0049] in, This indicates taking the absolute value. The coordinates in patch and G are... This represents the mean of the patch. Let G represent the mean of G; output C∈[0,1], where 0 indicates no match and 1 indicates a perfect match.
[0050] The C operation is affected by the specific location. If there is indeed a missed spot in the patch, the closer the centroid of this spot is to the patch center (x1+d, y1), the larger C will be. In order to avoid the missed spot being missed again because its centroid is not in the center of the inspection area, when inspecting the position (x1+d, y1), we will also consider inspecting it several times in the vicinity (x1+d±n, y1±n). The value of n is determined according to the actual situation and can be 0.2d~0.5d to ensure that the patch only covers one spot.
[0051] Preferably, in step S4, the internal void interpolation process is as follows:
[0052] Let P0∪P1 be the set of centroid coordinates of light spots, denoted as P'. Sort the coordinates by x first, then y (∪ represents the union), to obtain an ordered array. Traverse adjacent points and determine whether the distance between adjacent points is close to d, i.e., whether there are any missing light spots between adjacent points. If they are in the same row and Δx>K2d or in the same column and Δy>K2d, it means that there are missing light spots between the two points, and insert a new candidate [x] in the middle. mid y mid ] Execute steps S42 and S43. Those that pass are merged into P2. Those that fail indicate that the two points performed normally and there were no missed spots. Then proceed to examine the next two points. Here, Δx represents the distance between two adjacent points in the same row in the existing data P', Δy represents the distance between two adjacent points in the same column in the existing data P', and the value range of K2 is (1, 2).
[0053] In this invention, after row and column tracking expansion, the missing spots outside the original spot array are replenished. However, the missing spots may also occur inside the spot array. Therefore, it is necessary to check the inside of the array again to see if there are still any omissions.
[0054] Combining P0 and P1 yields a new coordinate set P'. Sort the coordinates by x first, then y, ensuring that any two points adjacent in space are also adjacent in order within P'. Next, iterate through adjacent points and check for missing light spots between them. If a point is in the same row and Δx > K2d, or in the same column and Δy > K2d, insert a new candidate [x] in the middle. mid y mid Similarly, matching degree related checks are performed, and those that pass are merged into P2.
[0055] Where Δx and Δy represent the distance between two adjacent points in the same row or column of the existing data P'. According to the result of step S2, when there are no missing points within the spot array, Δx and Δy should approximately equal d; if there are missing points, Δx and Δy should be approximately integer multiples of d. Therefore, K2d is used as the criterion, meaning that if the distance between adjacent spots is greater than this value, it indicates that at least one spot is missing between the two points being examined. Then, a similar matching degree operation is performed to conduct "internal expansion," [x mid y mid [x] indicates the newly inserted position coordinates in this step; those that meet the conditions will be added to the new set P2. mid y mid The candidate coordinates are derived by taking one of the two points under consideration as a reference and using d as a step size towards the other point.
[0056] Preferably, in step S4, the iterative process is as follows:
[0057] Let P0 = P0∪P1∪P2, and repeat steps S2~S4 until the number of new points is less than K.min Or reach the maximum number of iterations N max ;
[0058] Among them, K min N max It can be used when the number of light spots is huge. The settings can be adjusted according to the specific working conditions. In most cases, the light spot centroid array can be completed in 1 to 2 iterations.
[0059] Preferably, in step S5, the final complete spot centroid coordinates P0 obtained from step S4 are denoted as P. final At this point, we obtain a rough position of the centroid of the light spot. We need to use common centroid algorithms such as the centroid method and fitting method to obtain a precise reference centroid position, complete the SH-WFS calibration step, and then directly use it for subsequent wavefront slope calculation and Zernike reconstruction.
[0060] For any details not covered in this invention, please refer to the prior art.
[0061] The beneficial effects of this invention are as follows:
[0062] This invention does not require pre-setting ideal grid points. It only uses the average center distance of the detected light spots in the current frame to generate a Gaussian template in real time, and expands it outward point by point along the row and column directions with the spacing as the step size. At the same time, it performs hole interpolation inside the existing spot array, thereby realizing the self-growth and integrity reconstruction of missing light spots under complex illumination and low signal-to-noise ratio conditions, significantly improving the robustness and measurement accuracy of the Hartmann wavefront sensor. The missing spot recovery rate of this invention is significantly improved, and the integrity of the light spot array is significantly improved.
[0063] Under complex conditions such as brightness gradient and low contrast, the light spot utilization rate of the present invention is greatly improved;
[0064] This invention has a short processing time and can meet the real-time measurement requirements of Hartmann wavefront sensors. Attached Figure Description
[0065] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.
[0066] Figure 1 This is a flowchart of the spacing-driven Gaussian template expansion-interpolation Hartmann spot integrity restoration method of the present invention;
[0067] Figure 2 The original data image;
[0068] Figure 3 The image is a binary image obtained after binarizing the original data using a fixed threshold.
[0069] Figure 4This is a schematic diagram of a Gaussian template.
[0070] Figure 5 This is the result of processing a binarized image using the method of this invention. Detailed Implementation
[0071] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. However, this is not the only description; all aspects not described in detail herein are based on conventional techniques in the art.
[0072] Example 1
[0073] A pitch-driven Gaussian template expansion-interpolation Hartmann spot integrity recovery method, such as Figure 1 As shown, it includes the following steps;
[0074] S1, first the original image (such as...) Figure 2 After preprocessing such as fixed threshold binarization, area filtering, and morphological closing operations, a binarized spot image is obtained through connected component analysis (e.g., ...). Figure 3 The centroid coordinates P0 of all detected light spots are extracted. In the original image, the light spots exhibit a brightness gradient of "dark center, bright edges," but the brightness of the outer light spots is not uniform, resulting in an irregular overall shape. This is caused by non-ideal factors. At this point, the binarized image obtained using fixed threshold binarization shows a large number of missing light spots. Using this result for subsequent wavefront reconstruction would cause unnecessary data and accuracy loss.
[0075] S2, calculate the measured average center distance d:
[0076] Calculate the Euclidean distance between each point based on the data of P0, and take the average of the minimum spacing between each point as the measured average center distance d in pixels.
[0077] S3, dynamically generates Gaussian templates;
[0078] The theoretical width W of a single light spot is calculated based on Hartmann parameters. spot And according to W spot The characteristic width σ of the Gaussian template is obtained by calculating the quantitative relationship between the full width at half maximum (FWHM) and the Gaussian distribution, and a Gaussian template of size (d+1)×(d+1) is generated, as follows. Figure 4 As shown. Figure 4 The horizontal and vertical axes represent pixel units, and the bar chart represents the range of values after template normalization.
[0079] S4, using P0 as the seed, performs row and column line-following expansion:
[0080] For each P0 spot, take a (d+1)×(d+1) sub-image patch at a step size of d in the four directions of "up, down, left, and right" and perform cross-correlation matching. If the matching degree is greater than the preset threshold, the detected position is added to a new set P1 and the search continues in that direction until the matching degree no longer meets the requirements or the position to be tested goes out of bounds.
[0081] Internal void interpolation:
[0082] After merging P0 and P1, sort them in ascending order by x first, then y. Traverse adjacent points and determine whether there are any missed light spots between them according to the distance. If the distance between two points is greater than K2d, the condition is met. Similarly, enter the matching degree calculation in turn with d as the step size. If the matching degree meets the requirements, the detected position is added to the new set P2 until all the positions to be tested between the two points are searched.
[0083] Iterative process:
[0084] Merge all previously obtained sets P0, P1, and P2 to form a new P0, and repeat steps S2-S4 until the number of new points is less than K. min Or reach the maximum number of iterations N max This ensures that no spot that meets the requirements is missed, and that the complete number of spot positions is obtained.
[0085] In this embodiment, K min Preferred 2, N max Option 2 is preferred; if real-time performance requirements are extremely high, then increase K. min Reduce N max If completeness is desired, then K should be reduced. min Increase N max .
[0086] like Figure 5 As indicated by the red cross, the method proposed in this invention identifies all the light spot positions P. final Furthermore, it eliminated the influence of noise, found the originally weak signals at the edges, and significantly increased the effective data information.
[0087] S5, in P final The precise centroid position is calculated using the centroid algorithm at the recorded location, and a complete list of light spots is output, providing complete and accurate data for subsequent Hartmann data processing.
[0088] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for restoring the integrity of a Hartmann spot using a pitch-driven Gaussian template expansion-interpolation, characterized in that, Includes the following steps; S1, preprocess the original image and extract the centroid coordinates P0 of all detected light spots; S2, calculate the measured average center distance d; S3, dynamically generates Gaussian templates; S4, using P0 as the seed, performs row and column tracking expansion and internal gap filling, iterating continuously until the number of new points is less than K. min Or reach the maximum number of iterations N max ; S5, Output a complete list of light spots; In step S3, according to σ=K1W spot A two-dimensional Gaussian kernel template G is generated, with a template size of (d+1)×(d+1), to obtain a relevant template that matches the spot size of the current frame in real time; where σ represents the feature width of the Gaussian template, W spot K1 represents the theoretical width of a single light spot, and K1 represents the multiple. In step S4, the process of row and column tracking expansion is as follows: S41, traverse the coordinates in P0, and extrapolate the candidate coordinates point by point along the four directions ±x and ±y with a step size d. k y k ]; S42, take each candidate coordinate position as the center and cut out an image patch matrix of size (d+1)×(d+1) as the patch, cross-correlate it with G, and get the matching degree C=Cor(patch, G); S43, if C ≥ threshold Th, then add the coordinate to the candidate set P1 and continue to extrapolate along this direction until C < Th or the boundary is exceeded.
2. The method for restoring the integrity of a Hartmann spot using a Gaussian template with outward and inward expansion driven by a spacing-driven approach according to claim 1, characterized in that... In step S1, the original image acquired by the Hartmann detector is linearly stretched to obtain an 8-bit grayscale image. Then, fixed threshold binarization, area filtering, and morphological closing operations are performed to obtain the initial binary light spot. The centroid coordinates of all detected light spots are extracted using connected component analysis and denoted as set P0.
3. The method for restoring the integrity of a Hartmann spot using a Gaussian template with outward and inward expansion driven by a spacing-driven approach according to claim 2, characterized in that... In step S2, the distance between the coordinates of each point is calculated by P0, and the average of the minimum spacing between each point is taken as the measured average center distance d, which is used for the adaptive setting of the template scale and search step size in the subsequent process. The distance between the coordinates of each point is the Euclidean distance dist: ; in( , ), ( , Let be the coordinates of any two points in P0.
4. The method for restoring the integrity of a Hartmann spot using a Gaussian template with outward and inward expansion as described in claim 3, is characterized in that... In S42, the Cor operation is: ; in, This indicates taking the absolute value. The coordinates in patch and G are... This represents the average value of the patch. Let G represent the mean of G; output C∈[0,1], where 0 indicates no match and 1 indicates a perfect match.
5. The method for restoring the integrity of a Hartmann spot using a Gaussian template with outward and inward expansion as described in claim 4, characterized in that, In step S4, the process of interpolating internal voids is as follows: Let P0∪P1 be the set of centroid coordinates of light spots, denoted as P'. Sort the coordinates by x first, then y, to obtain an ordered array. Traverse adjacent points and determine whether the distance between adjacent points is close to d. If they are in the same row and Δx>K2d or in the same column and Δy>K2d, it means that there is a missed light spot between the two points, and insert a new candidate [x] in the middle. mid y mid ], execute steps S42 and S43, and merge the passed data into P2; where Δx represents the distance between two adjacent points in the same row in the existing data P', Δy represents the distance between two adjacent points in the same column in the existing data P', and the value range of K2 is (1, 2).
6. The method for restoring the integrity of a Hartmann spot using a Gaussian template with outward and inward expansion as described in claim 5, is characterized in that... In step S4, the iterative process is as follows: Let P0 = P0∪P1∪P2, and repeat steps S2~S4 until the number of new points is less than K. min Or reach the maximum number of iterations N max .
7. The method for restoring the integrity of a Hartmann spot using a Gaussian template with outward and inward expansion as described in claim 6, is characterized in that... In step S5, the final complete centroid coordinates P0 of the light spot, obtained from step S4, are denoted as P. final At this point, we obtain a rough position of the centroid of the light spot. After using the centroid algorithm, we obtain a precise reference centroid position, thus completing the calibration steps of SH-WFS.
Citation Information
Patent Citations
Deep learning distorted light spot center extraction method suitable for high-precision morphology measurement
CN112950650A
Shack-Hardman wavefront detection method based on global light spot matching
CN117870879A