Calibration and Image Reconstruction in a Spot Scanning Detection System for Surface Defects

: Compared to traditional approaches, the spot scanning surface defect evaluation system (SS-SDES) has better performances on the detection of small defects and defect classiﬁcation for optical surfaces. However, the existing system deviations will cause distortions and even a missing area in the defect image which is reconstructed from the acquired raw data based on the scanning trace, thus degrading the reliability of detection results. To solve these problems, a system calibration method is proposed with the parameterization of these deviations and the modeling of practical scanning trace. A constraint function, to characterize the straightness and scale errors in the image, is deﬁned. Then an optimization is implemented to minimize it and hence to obtain the optimal estimate of the system deviations, which is subsequently used to adjust the system and reconstruct reliable defect images. Additionally, to further enhance the image quality, an image reconstruction method capable of suppressing signal noise through a weighted average strategy is proposed. Experiments show that with our methods, the system deviations are e ﬀ ectively corrected, and a complete and precise defect image with low distortions that are within 1.8 pixels is reconstructed. Therefore, the detection accuracy and reliability of the system can be improved.


Introduction
The detection of surface defects is one of the main items of surface quality evaluation for optical elements. In optical systems, scattering induced by surface defects will reduce the utilization efficiency of energy or even lead to severe damage to those with high-energy lasers, such as the inertial confinement fusion system (ICF) [1][2][3]. With the wide application of the optical elements and the development of manufacturing technology, the requirements for defect detection become higher. On the one hand, sufficient detection sensitivity for small-size defects is required to ensure the effectiveness and safety of optical elements for use. On the other hand, to obtain a comprehensive evaluation report containing hazard assessment and cause analysis of defects, the ability of quantitative detection, including defect size metrology and defect classification, has become increasingly significant.
Various detection approaches for surface defects of optical elements have been studied. Commercial microscopes, such as atomic force microscope (AFM) and scanning electron microscope (SEM), are used to detect and characterize the surface defects on fine optics [4,5]. These methods have high detection accuracy and sensitivity but require long inspection times. Because of the advantages of non-destructiveness and high throughput, optical inspection techniques have gained more and more attention. For example, Choi et al. [6] proposed a defect inspection method which obtains defect images using the photo-thermal reflectance technique. Rainer et al. [7] adopt the total internal Appl. Sci. 2020, 10, 2503 3 of 16 Figure 1 presents the system layout of the SS-SDES. A short-wavelength laser beam passes through a beam controller to obtain a specific polarization state and is subsequently focused onto the optical surface to be inspected. If there is no defect in the illuminated spot, the light will be specularly reflected by the optical surface. Otherwise, the defects will produce scattered light in all directions. An ellipsoidal mirror is used to collect the scattered light beams with a large solid angle and reflects them into a photomultiplier (PMT) for detection. The basic principle is that each beam of light that passes through a focal point of the ellipsoidal mirror will pass through another focal point after being reflected. Thus, the ellipsoidal mirror is properly placed, making its two focal points coincide with the illuminated spot and the PMT, respectively. The reflected light is led through a hole in the mirror to escape so that the scattered light is detected only. Such an optical configuration can greatly enhance the acquired scattering signal of defects while keeping the background signal at a normal level, thus offering the potential to detect smaller-size defects to the system. The SS-SDES incorporates a polarization measurement channel as well. The scattered light in the blind area of the mirror is led into this channel, where a quarter-wave plate and a polarization beam splitter (PBS) are exploited to separate the light into two beams according to its polarization state. Both of them are finally detected by two additional PMTs, respectively, forming a two-dimensional polarization signal for further defect classification [19,20].

System Layout
Appl. Sci. 2020, 10, x FOR PEER REVIEW 3 of 16 Figure 1 presents the system layout of the SS-SDES. A short-wavelength laser beam passes through a beam controller to obtain a specific polarization state and is subsequently focused onto the optical surface to be inspected. If there is no defect in the illuminated spot, the light will be specularly reflected by the optical surface. Otherwise, the defects will produce scattered light in all directions. An ellipsoidal mirror is used to collect the scattered light beams with a large solid angle and reflects them into a photomultiplier (PMT) for detection. The basic principle is that each beam of light that passes through a focal point of the ellipsoidal mirror will pass through another focal point after being reflected. Thus, the ellipsoidal mirror is properly placed, making its two focal points coincide with the illuminated spot and the PMT, respectively. The reflected light is led through a hole in the mirror to escape so that the scattered light is detected only. Such an optical configuration can greatly enhance the acquired scattering signal of defects while keeping the background signal at a normal level, thus offering the potential to detect smaller-size defects to the system. The SS-SDES incorporates a polarization measurement channel as well. The scattered light in the blind area of the mirror is led into this channel, where a quarter-wave plate and a polarization beam splitter (PBS) are exploited to separate the light into two beams according to its polarization state. Both of them are finally detected by two additional PMTs, respectively, forming a two-dimensional polarization signal for further defect classification [19,20]. To realize a scan for the whole surface, the optical sample is placed on a positioning system, which includes a rotation stage and a two-dimensional translation stage. Under the control of a computer, the positioning system rotates and translates the sample, allowing the whole surface to be scanned along a spiral trace. And the intensity signals detected by the PMTs are synchronously acquired and recorded using a data acquisition card with a specific sampling frequency. Based on the scanning trace, image reconstruction is performed on the acquired signal sequence to obtain defect images. With those, a quantitative evaluation for surface defects can be finally achieved after further image processing and analysis.

Ideal Scanning Trace and Image Reconstruction
Two coordinate systems need to be established for the analysis of scanning trace and image reconstruction. The first one is the three-dimensional system coordinate system s shown in Figure 1, which takes the horizontal two-dimensional translation stage as the x-axis and the y-axis, the vertical up as the z-axis, and the intersection of the axis of the rotation stage (the To realize a scan for the whole surface, the optical sample is placed on a positioning system, which includes a rotation stage and a two-dimensional translation stage. Under the control of a computer, the positioning system rotates and translates the sample, allowing the whole surface to be scanned along a spiral trace. And the intensity signals detected by the PMTs are synchronously acquired and recorded using a data acquisition card with a specific sampling frequency. Based on the scanning trace, image reconstruction is performed on the acquired signal sequence to obtain defect images. With those, a quantitative evaluation for surface defects can be finally achieved after further image processing and analysis.

Ideal Scanning Trace and Image Reconstruction
Two coordinate systems need to be established for the analysis of scanning trace and image reconstruction. The first one is the three-dimensional system coordinate system O s − X s Y s Z s , as shown in Figure 1, which takes the horizontal two-dimensional translation stage as the x-axis and the y-axis, the vertical up as the z-axis, and the intersection of the axis of the rotation stage (the rotation axis) and Appl. Sci. 2020, 10, 2503 4 of 16 the optical surface as the origin. The second one is the two-dimensional surface coordinate system O e − X e Y e . It coincides with O s − X s Y s at the initial system state (that is, both the rotation stage and the two-dimensional translation stage are at their own original positions). During scanning, both of them will move under the driving of the positioning system, and the surface coordinate system will also rotate as the optical surface does. Ideally, the rotation axis coincides with the Z s axis, and the illuminated spot at the initial system state (called the initial illuminated spot) is at point O s . Figure 2 illustrates the scanning diagram of the system under ideal conditions. The positioning system translates along the negative direction of the Y s axis at a constant velocity of v and rotates counterclockwise at an angular velocity of ω. At any scanning time t, as shown in Figure 2a, the coordinate of the illuminated spot p(t) in the system coordinate system is (0, vt, 0), and the rotation angle of the surface coordinate system relative to the system coordinate system is φ(t) = ωt − 2π × NR, where NR represents the number of revolutions that have been rotated. Hence, the coordinate of p(t) in the surface coordinate system, p x e (t), p y e (t) , can be calculated by rotation transformation as  , both the   rotation stage and the two-dimensional translation stage are at their own original positions). During scanning, both of them will move under the driving of the positioning system, and the surface coordinate system will also rotate as the optical surface does. Ideally, the rotation axis coincides with the s Z axis, and the illuminated spot at the initial system state (called the initial illuminated spot) is at point s O . Figure 2 illustrates the scanning diagram of the system under ideal conditions.
The positioning system translates along the negative direction of the s Y axis at a constant velocity of v and rotates counterclockwise at an angular velocity of ω . At any scanning time t , as shown in Figure 2a, the coordinate of the illuminated spot ( ) p t in the system coordinate system is ( ) 0, , 0 vt , and the rotation angle of the surface coordinate system relative to the system coordinate system is ( ) (1) where ( ) The intensity signals detected by each PMT are acquired and recorded with a sampling frequency of f , forming a discrete intensity sequence I 0 , I 1 , · · · , I N−1 , where N is the total number of sampling points. Figure 2b presents the spiral scanning trace and the distribution of sampling points. For each sampling point in the sequence, the corresponding scanning time depends on its sequence number n, as t n = n/ f , and the corresponding intensity signal is I n . By using Equation (1), the coordinate of the sampling point in the surface coordinate system can be obtained, which is subsequently converted to the image coordinate in the reconstructed image by n → (u n , v n ) T : where (u 0 , v 0 ) is the image coordinate of the first sampling point with n = 0, which needs to be preset according to the actual scanning range to ensure that the image coordinates of all sampling points are positive; the coefficient k 0 represents the actual size of each pixel. In the SS-SDES, the value of k 0 is equal to the translation distance of the positioning system by a single revolution, defined as k 0 = 2πv/ω. Combined with the derived image coordinates and corresponding intensity signals, a complete defect image can be reconstructed.

Deviations in the System and their Consequences
However, the practical scanning trace will differ from the ideal scanning trace due to the existence of system deviations, including the following: (1) angle deviation of the rotation axis from the Z s axis; (2) position deviation of the initial illuminated spot from the origin O s ; and (3) deviations of translation velocity, rotation velocity, and sampling frequency from their setting values. Because the optical sample is precisely leveled when it is placed, the surface can be considered as a horizontal plane at the initial system state. In this case, if the ideal scanning trace is still used for image reconstruction, distortions will be introduced. This section will simulate the impacts of these system deviations on the scanning trace and image reconstruction. The specific models involved in the simulation will be given in the next section. Figure 3 presents the simulated practical scanning traces (upper row) and the corresponding images (lower row) reconstructed using the ideal scanning trace, where a-d represent the cases with no deviation, angle deviation of the rotation axis, position deviation of the initial illuminated spot, and rotation velocity deviation, respectively. It can be seen that these system deviations can change the scanning traces to some degree and hence yield obvious distortions in the reconstructed images. The distortions will affect the accuracy of detection results in many aspects, such as causing the displacement of the defect's location and the scaling of the defect's size. Line-like defects, such as scratches, may appear bent, leading to an inaccurate extraction of the curvature features. Moreover, the position deviation of the initial illuminated spot will even produce an undetected area that is not scanned at the center of the surface. As shown in Figure 3c, the consequence of this issue is that the point-like defect near the center in the reconstructed image is missing. According to the analysis, the existence of system deviations will severely reduce the reliability of the SS-SDES. It is significant to propose an effective and accurate method for system calibration and image reconstruction. Combined with the derived image coordinates and corresponding intensity signals, a complete defect image can be reconstructed.

Deviations in the System and their Consequences
However, the practical scanning trace will differ from the ideal scanning trace due to the existence of system deviations, including the following: (1) angle deviation of the rotation axis from the s Z axis; (2) position deviation of the initial illuminated spot from the origin s O ; and (3) deviations of translation velocity, rotation velocity, and sampling frequency from their setting values. Because the optical sample is precisely leveled when it is placed, the surface can be considered as a horizontal plane at the initial system state. In this case, if the ideal scanning trace is still used for image reconstruction, distortions will be introduced. This section will simulate the impacts of these system deviations on the scanning trace and image reconstruction. The specific models involved in the simulation will be given in the next section. Figure 3 presents the simulated practical scanning traces (upper row) and the corresponding images (lower row) reconstructed using the ideal scanning trace, where a-d represent the cases with no deviation, angle deviation of the rotation axis, position deviation of the initial illuminated spot, and rotation velocity deviation, respectively. It can be seen that these system deviations can change the scanning traces to some degree and hence yield obvious distortions in the reconstructed images. The distortions will affect the accuracy of detection results in many aspects, such as causing the displacement of the defect's location and the scaling of the defect's size. Line-like defects, such as scratches, may appear bent, leading to an inaccurate extraction of the curvature features. Moreover, the position deviation of the initial illuminated spot will even produce an undetected area that is not scanned at the center of the surface. As shown in Figure 3c, the consequence of this issue is that the point-like defect near the center in the reconstructed image is missing. According to the analysis, the existence of system deviations will severely reduce the reliability of the SS-SDES. It is significant to propose an effective and accurate method for system calibration and image reconstruction.

System Calibration and Image Reconstruction Methods
To address the problems introduced by system deviations, this paper proposes a novel system calibration method based on straightness and scale constraints and an image reconstruction method based on weighted average. The methods will be described in detail below, including the following: (1) how to parameterize the system deviations and model the practical scanning trace; (2) how to calibrate and obtain the system parameters; and (3) how to reconstruct a quality image.

System Calibration and Image Reconstruction Methods
To address the problems introduced by system deviations, this paper proposes a novel system calibration method based on straightness and scale constraints and an image reconstruction method based on weighted average. The methods will be described in detail below, including the following: (1) how to parameterize the system deviations and model the practical scanning trace; (2) how to calibrate and obtain the system parameters; and (3) how to reconstruct a quality image. Figure 4 presents the schematic of practical system state at initial time (t = 0) and scanning time t. With the help of this figure, this section will parameterize the system deviations described above and finally derive the coordinate of the illuminated spot p(t) to establish a mathematical model of the practical scanning trace of the SS-SDES.

Modeling of the Practical Scanning Trace
Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 16 Figure 4 presents the schematic of practical system state at initial time ( 0 t = ) and scanning time t . With the help of this figure, this section will parameterize the system deviations described above and finally derive the coordinate of the illuminated spot ( ) p t to establish a mathematical model of the practical scanning trace of the SS-SDES. According to the definition of the system coordinate system, the rotation axis r l is a straight line that passes through the origin s O . r l can be described, using two parameters, by the symmetric equation of the line in space: : sin cos sin sin cos where r θ and r ϕ are the polar and azimuthal angles of the line as shown in Figure 4a.
The optical surface is a plane that passes through the origin s O . Let S t n x n y n z where t ω R is the 3 3 × rotation matrix corresponding to a rotation by an angle of t ω about the fixed axis r l , which can be computed by Rodrigues' rotation formula [21].  According to the definition of the system coordinate system, the rotation axis l r is a straight line that passes through the origin O s . l r can be described, using two parameters, by the symmetric equation of the line in space: where θ r and ϕ r are the polar and azimuthal angles of the line as shown in Figure 4a. The optical surface is a plane that passes through the origin O s . Let S g (t) be the plane equation of the surface at scanning time t. At the initial time (t = 0), the surface is horizontal, meaning that the normal vector of S g (0) is n 0 = (0, 0, 1) T . At any scanning time t, the plane equation S g (t) can be obtained by rotating S g (0) counterclockwise about l r by an angle of ωt as where R ωt is the 3 × 3 rotation matrix corresponding to a rotation by an angle of ωt about the fixed axis l r , which can be computed by Rodrigues' rotation formula [21].
Since the illuminated spot is the intersection of the illumination light and the optical surface, it is required to parameterize the illumination light by a line. Let l i (t) be the equation of the illumination line at scanning time t: Four parameters are included in the equation, where θ i and ϕ i are the polar and azimuthal angles of the illumination line, and (x i , y i ) is the coordinate of the initial illuminated spot. By solving the combined equation of Equations (4) and (5), one can obtain the coordinate of p(t) in the system coordinate system, denoted as p x s (t), p y s (t), p z s (t) ; this is subsequently transformed into the coordinate in the surface coordinate system by where R −ωt is a 2 × 3 matrix consisting of the first two rows of the rotation matrix R −ωt . By substituting the surface coordinate of the illuminated spot, p x e (t), p y e (t), into Equation (2), one can finally obtain the mapping relationship from the sequence number n to the image coordinate (u n , v n ). For brevity, we use g ψ to denote the mapping relationship, and therefore, the mapping function can be written as where is the union of all parameters involved in the modeling, called the system parameter vector, which determines the mapping relationship g ψ . In the practical implementation, the mapping function, Equation (7), is calculated by the following 7 steps: Step 1: Calculate the corresponding scanning time of the sequence number, as t = n/ f ; Step 2: Define the line equation of the rotation axis using Equation (3) with parameters θ r and ϕ r ; Step 3: Calculate the plane equation of the sample surface after rotation about the rotation axis using Equation (4) with the parameter ω; Step 4: Define the line equation of the illumination line using Equation (5) with parameters x i , y i , θ i , ϕ i and v; Step 5: Calculate the intersection point of the sample plane and the illumination line; Step 6: Transform the coordinate of the intersection point from the system coordinate system to the surface coordinate system using Equation (6) with parameters θ r , ϕ r , and ω; Step 7: Transform the surface coordinate of the intersection point to the image coordinate using Equation (2) with parameters v and ω.
It can be found that the ideal scanning trace, introduced in Section 2.2, is a special case of the practical scanning trace with the ideal system parameter vector where all the parameters are the setting values of the system, and the specific expression of the ideal mapping relationship g ψ 0 is given by Equations (1) and (2). Apparently, to reconstruct an undistorted image, an accurate system parameter vector is required for establishing the actual scanning trace and mapping relationship.

System Calibration Method
A system calibration method capable of getting the accurate system parameter vector is studied here. In this method, a specific calibration plate with a group of line-like scratches and distance-marked dot pairs on its surface is employed as the test sample. The distance-marked dot pair refers to a pair of point-like defects, such as digs, between which the distance is known. As can be found in Figure 5, this method can be divided into three major steps. The first step is to extract the feature sequence number sets, which consist of the sequence numbers of intensity signals that come from the defects. In the second step, a constraint function for constraining the image coordinates mapped from the feature sequence number sets is defined, and the third step is to perform a nonlinear optimization to minimize the constraint function, so that the optimal system parameter vector can be obtained. More details about these three steps will be given in the following. Appl. Sci. 2020, 10, x FOR PEER REVIEW 8 of 16 Figure 5. Flow chart of the system calibration method.

Extraction of Feature Sequence Number Sets
The discrete intensity sequence acquired by the SS-SDES is one-dimensional. For each intensity signal in the sequence, although its magnitude can be used to roughly distinguish whether it is a defect signal, directly determining the location and characteristics of the defect to which the signal belongs is not possible. Hence, for the extraction of the sequence numbers corresponding to specific defects on the calibration plate, an image is first reconstructed using the ideal mapping relationship 0 ψ g , called the original image. Then, image processing techniques are performed to find out the specific scratches and distance-marked dot pairs and to subsequently extract their feature points, which indicate the centroid for digs and the points on the skeleton for scratches. Finally, the sequence numbers corresponding to these feature points are obtained through a backtracking strategy: the discrete intensity sequence is traversed again to calculate the image coordinate for each sequence number; if the distance between the coordinate and any a feature point is less than 0.5 pixel, the sequence number is considered to correspond to this feature point. In addition, multiple groups of scratches and distance-marked dot pairs are selected to make the feature points locate at every part of the image as much as possible. Let l M be the number of selected scratches and k M be the number of selected distance-marked dot pairs. The obtained feature sequence number sets associated with them can be expressed by Equations (8) where n is the sequence number, and m Q represents the number of sequence numbers in the m th scratch, and m D represents the actual distance between the m th distance-marked dot pairs.

Establishment of Constraint Function
For an arbitrary system parameter vector ψ , the mapping relationship ψ g can be obtained according to the practical scanning trace model established in Section 3.

Extraction of Feature Sequence Number Sets
The discrete intensity sequence acquired by the SS-SDES is one-dimensional. For each intensity signal in the sequence, although its magnitude can be used to roughly distinguish whether it is a defect signal, directly determining the location and characteristics of the defect to which the signal belongs is not possible. Hence, for the extraction of the sequence numbers corresponding to specific defects on the calibration plate, an image is first reconstructed using the ideal mapping relationship g ψ 0 , called the original image. Then, image processing techniques are performed to find out the specific scratches and distance-marked dot pairs and to subsequently extract their feature points, which indicate the centroid for digs and the points on the skeleton for scratches. Finally, the sequence numbers corresponding to these feature points are obtained through a backtracking strategy: the discrete intensity sequence is traversed again to calculate the image coordinate for each sequence number; if the distance between the coordinate and any a feature point is less than 0.5 pixel, the sequence number is considered to correspond to this feature point. In addition, multiple groups of scratches and distance-marked dot pairs are selected to make the feature points locate at every part of the image as much as possible. Let M l be the number of selected scratches and M k be the number of selected distance-marked dot pairs. The obtained feature sequence number sets associated with them can be expressed by Equations (8) and (9), respectively: L m : n l m,q q = 1, 2, · · · , Q m , m = 1, 2, · · · , M l , K m : n k m,1 , n k m,2 , D m , m = 1, 2, · · · , M k , where n is the sequence number, and Q m represents the number of sequence numbers in the mth scratch, and D m represents the actual distance between the mth distance-marked dot pairs.

Establishment of Constraint Function
For an arbitrary system parameter vector ψ, the mapping relationship g ψ can be obtained according to the practical scanning trace model established in Section 3.1. By using g ψ , one can compute the image coordinates of each feature sequence number set and then observe the appearance of the corresponding defect in the reconstructed image. To avoid image distortions, our method will place two types of constraints on these coordinates. First, straight scratches should not be bent in the reconstructed image, meaning that all sequence numbers in each L m are expected to map to image coordinates which are collinear. Hence a straightness constraint is required. As is known, the distance of a point u = (u, v) T to a line determined by two endpoints u end1 and u end2 is Appl. Sci. 2020, 10, 2503 9 of 16 is the unit normal vector of the line. |x| and x denote the operations that return the absolute value of a scalar and the L2-norm of a vector, respectively. For the mth selected scratch, assuming that its two endpoints correspond to the first and last sequence numbers in L m , the straightness constraint for L m can be defined by the maximum straightness error c l m as Second, scaling is not permitted in the reconstructed image, otherwise the relationship between the pixel size and the actual size will be changed, making the extracted geometric features of defects inaccurate. As described in Section 2.2, k 0 , the actual size of each pixel in the reconstructed image, is a fixed preset value. To maintain this characteristic, a scale constraint, for constraining the two sequence numbers in each K m to map to two image coordinates between which the distance is equivalent to the actual value D m , is constructed by the distance error c k m , whose expression is given by Finally, the total constraint function is defined as a weighted sum of the squares of straightness constraints and scale constraints: where λ is the weight factor used to adjust the relative importance between the two types of constraints.

Nonlinear Optimization
Since C(ψ) characterizes the distortion of the reconstructed image, the optimal estimate of the system parameter vector, called the calibrated system parameter vectorψ, can be obtained by minimizing it:ψ = arg min ψ (C(ψ)).
This is a nonlinear least-squares problem. As the number of variables increases, the problem becomes more complex. In the modeling of the practical scanning trace, it can be found that for the three variables, v,ω, and f , the mapping relationship is actually related only to v/ f and ω/ f . Therefore, the sampling frequency f can be fixed to the setting value with only v and ω to be optimized, thus reducing one variable. To address this issue, the Levenberg-Marquardt Algorithm [22] is employed after comparison to other optimization algorithms. It requires an initial guess of ψ which can be set as the ideal system parameter vector ψ 0 .

System Adjustment and Image Reconstruction Method
Once the calibrated system parameter vectorψ is obtained, the corresponding calibrated mapping relationship gψ can be established to reconstruct an image free of distortions. However, because of the position deviation between the initial illuminated spot and the origin, the undetected area is still present at the central part of the surface and the image. Thus, it is required to adjust the system to make them coincide. The adjustment method is to move the two-dimensional translation stage from its original position by distances of ∆x and ∆y along the X and the Y directions, respectively, and take this position as the starting point of scanning. The values of ∆x and ∆y are dependent on the thickness of the sample to be detected. Let ∆h be the thickness difference between the sample and the calibration plate. When ∆h 0, the origin O s , which is the intersection of the rotation axis and the surface, will shift, leading to the changes of the coordinate of the initial illuminated spot. Assuming that the sample' surface is always on the focal plane of the ellipsoidal mirror, we can derive the expression of ∆x and ∆y using simple geometric relations as ∆x =x i − ∆h tan θ i cos ϕ i ∆y =ŷ i − ∆h tan θ i sin ϕ i . (15) wherex i andŷ i are the parameters that represent the coordinate of the initial illuminated spot inψ. After adjustment, the SS-SDES can perform the scan for the whole optical surface in a normal way but without any missing area at the center. Letψ be the system parameter vector of the adjusted system. Apparently,ψ is the same asψ except that the values of parameters x i and y i are equal to zero. The adjusted mapping relationship gψ is then constructed to map the discrete intensity sequence acquired by the adjusted system to image coordinates. This is a mapping transformation from one dimension to two dimensions, and there still exist some problems to be addressed. First, the resulting coordinates are generally non-integral, failing to meet the regulation that requires the image coordinate of each pixel to be integral. Second, because the sampling frequency and the scanning velocity are fixed during scanning, the density of sampling points in the central area of the surface will be much higher than that in the edge. As a consequence, the pixel in the central part of the reconstructed image may correspond to more than one sequence number while some pixels in the edge correspond to zero.
Aiming at these problems, this paper proposes an image reconstruction method based on weighted average as follows: 1.
Initialize an image matrix Ig(u) and a weight matrix Wt(u) with the same size determined by the actual scanning range and k 0 ; initialize the sequence number n = 0; 2.
Calculate the image coordinate corresponding to the sequence number by u = gψ (n), and round it to the integer coordinate u int ; define a weight value according to the distance between them as Update the image matrix by Ig(u int ) = Ig(u int ) + wI n with I n , the corresponding intensity in the acquired discrete intensity sequence, and the weight matrix by Wt(u int ) = Wt(u int ) + w;

4.
Update the sequence number by n = n + 1; if the traversal has not been completed (i.e., n < N), go back to step 2; 5.
Find the positions at which the elements in Wt(u) have the value of zero and fill the elements at these positions in Ig(u) (no-value pixels) using the average of 8-neighborhood.
The output Ig(u) is the ultimate reconstructed image. This method can not only solve the problems of non-integral coordinates and no-value pixels, but also suppress the signal noise through the weighted average strategy. For any detection system based on spot scanning, this method can effectively improve the quality of the reconstructed image.

Test Environment
Experiments on the proposed system calibration method and image reconstruction method were carried out and are presented in this section. The test platform is the SS-SDES introduced in Section 2.1. A 406-nm laser is used to illuminate the optical surface at a particular angle with θ i0 = 135 • and ϕ i0 = 90 • . The setting value of the angular velocity of the rotation stage (ND110-65FS-S204, NIKKI DENSO) is ω 0 = 4 × 2π rad/s, and the translation velocity of the two-dimensional translation stage (custom made, positioning accuracy 3 µm) is v 0 = 20 µm/s. Therefore, the actual size of each pixel is k 0 = 5 µm/pixel. The sampling frequency is f 0 = 10 6 Hz.
A standard plate fabricated through electron beam exposure (EBE) [23] and ion beam etching (IBE) [24] was employed as the test sample. It is a 127 mm × 127 mm square fused silica plate with a thickness of 2.54 mm. A group of standard defects with different sizes, such as scratches and digs, are etched on its surface. The minimum scratch width is 0.5 µm, followed by 1, 2, 3, . . . , 40 µm. Thus, the scratches can be used for the establishment of straightness constraints, and the dig pairs with known distances can be used for scale constraints. The system calibration and image reconstruction methods are executed on Matlab (R2011b), Windows 7 64-bit operating system (Intel Xeon E3-1535M v5 processor, 16 Gb DDR4 2133 MHz memory).
It is worth mentioning that under these setting values, it takes nearly 70 min to scan the entire standard plate. The scanning speed depends on the translation velocity v 0 . In order to keep the pixel resolution k 0 unchanged, when one increases the translation velocity, the rotation velocity must be increased accordingly. However, in our experiment, the rotation stage we used cannot provide a higher rotation velocity on the premise of stability, thus limiting the scanning efficiency. Nevertheless, this will not affect the verification of the proposed system calibration and image reconstruction methods. In the practical application of defect detections, the rotation velocity can be increased by replacing the rotation stage with a faster one, so as to improve the scanning speed.

Experiments of System Calibration
The test sample is first scanned by the SS-SDES before adjustment. According to the setting values, the ideal system parameter vector is ψ 0 = 0 • , 0 • , 135 • , 90 • , 0, 0, 20, 8π, 10 6 . The corresponding mapping relationship g ψ 0 is then established using the practical scanning trace model as described in Section 3.1. Figure 6a shows the original image reconstructed using g ψ 0 . As can be seen, apparent distortions are present in the image, but most defects remain independent and distinguishable, allowing the original image to be used for the extraction of feature sequence number sets.
A standard plate fabricated through electron beam exposure (EBE) [23] and ion beam etching (IBE) [24] was employed as the test sample. It is a 127 mm × 127 mm square fused silica plate with a thickness of 2.54 mm. A group of standard defects with different sizes, such as scratches and digs, are etched on its surface. The minimum scratch width is 0.5 µm, followed by 1, 2, 3, …, 40 µm. Thus, the scratches can be used for the establishment of straightness constraints, and the dig pairs with known distances can be used for scale constraints. The system calibration and image reconstruction methods are executed on Matlab (R2011b), Windows 7 64-bit operating system (Intel Xeon E3-1535M v5 processor, 16 Gb DDR4 2133 MHz memory).
It is worth mentioning that under these setting values, it takes nearly 70 min to scan the entire standard plate. The scanning speed depends on the translation velocity 0 v . In order to keep the pixel resolution 0 k unchanged, when one increases the translation velocity, the rotation velocity must be increased accordingly. However, in our experiment, the rotation stage we used cannot provide a higher rotation velocity on the premise of stability, thus limiting the scanning efficiency. Nevertheless, this will not affect the verification of the proposed system calibration and image reconstruction methods. In the practical application of defect detections, the rotation velocity can be increased by replacing the rotation stage with a faster one, so as to improve the scanning speed.

Experiments of System Calibration
The test sample is first scanned by the SS-SDES before adjustment. According to the setting values, the ideal system parameter vector is ( )  Figure 6a shows the original image reconstructed using 0 ψ g . As can be seen, apparent distortions are present in the image, but most defects remain independent and distinguishable, allowing the original image to be used for the extraction of feature sequence number sets. The extraction process of feature points is illustrated in Figure 6. Image processing techniques including Gauss smoothing, top hat transformation, threshold segmentation, and region selection are performed on the original image successively, to find out the regions of the specific scratches and dig pairs that are used for constraints establishment. The feature points are then extracted through skeletonization for scratches and centroid calculation for digs. Figure 6b shows some of the selected defect regions, and Figure 6c,d shows the extracted feature points of a dig and a scratch, The extraction process of feature points is illustrated in Figure 6. Image processing techniques including Gauss smoothing, top hat transformation, threshold segmentation, and region selection are performed on the original image successively, to find out the regions of the specific scratches and dig pairs that are used for constraints establishment. The feature points are then extracted through skeletonization for scratches and centroid calculation for digs. Figure 6b shows some of the selected defect regions, and Figure 6c,d shows the extracted feature points of a dig and a scratch, respectively. In the calibration experiment, ten scratches and ten distance-marked dot pairs are selected. They are distributed in various parts of the image so that constraints are applied as much as possible to the entire image. With the feature points, the feature sequence number sets are obtained through the backtracking strategy, as described in Section 3.2, to subsequently construct the constraint function.
Taking ψ 0 as the initial guess, the Levenberg-Marquardt Algorithm is performed to obtain the calibrated system parameter vectorψ, completing the whole process of the proposed system calibration method. The nonlinear optimization takes about 46 s, and the weight factor λ = 2 is chosen through experimental comparison. Table 1 gives the system calibration results where the rotation velocity ω is in the unit of revolutions per second (RPS). It can be seen that the calibrated values of most parameters deviate from the setting values slightly, except the azimuthal angle of rotation axis ϕ r and the coordinate of the initial illuminated spot (x i , y i ). The former is due to the fact that the rotation axis may tilt towards any azimuth in space, and the latter is caused by the lack of registration during system assembly. What is more important, shown in Table 1, is that the value of the constraint function decreases significantly after calibration, indicating that the distortion of the image is well corrected.

Experiments of Image Reconstruction
To test the validity of the system calibration method, the calibrated mapping relationship gψ is established to reconstruct an image, called the calibrated image, for the acquired discrete intensity sequence again. Figure 7a presents the calibrated image with an enlarged image of its central area. Compared to the original image (see Figure 6a), the calibrated image shows almost no distortion but a missing area at the center, agreeing with the analysis in Section 3.3.
through the backtracking strategy, as described in Section 3.2, to subsequently construct the constraint function.
Taking 0 ψ as the initial guess, the Levenberg-Marquardt Algorithm is performed to obtain the calibrated system parameter vector ψ , completing the whole process of the proposed system calibration method. The nonlinear optimization takes about 46 s, and the weight factor 2 λ = is chosen through experimental comparison. Table 1 gives the system calibration results where the rotation velocity ω is in the unit of revolutions per second (RPS). It can be seen that the calibrated values of most parameters deviate from the setting values slightly, except the azimuthal angle of rotation axis r ϕ and the coordinate of the initial illuminated spot ( ) , i i x y . The former is due to the fact that the rotation axis may tilt towards any azimuth in space, and the latter is caused by the lack of registration during system assembly. What is more important, shown in Table 1, is that the value of the constraint function decreases significantly after calibration, indicating that the distortion of the image is well corrected.

Experiments of Image Reconstruction
To test the validity of the system calibration method, the calibrated mapping relationship ψ g is established to reconstruct an image, called the calibrated image, for the acquired discrete intensity sequence again. Figure 7a presents the calibrated image with an enlarged image of its central area. Compared to the original image (see Figure 6a), the calibrated image shows almost no distortion but a missing area at the center, agreeing with the analysis in Section 3.3. Then, the SS-SDES is adjusted as described in Section 3.3 to scan the standard plate once again and acquire the discrete intensity sequence for image reconstruction. Figure 7b presents the resulting image, called the adjusted image, which is reconstructed using the adjusted system parameter vector ˆ′ ψ . It can be observed that the missing area at the center does not exist while the adjusted image remains undistorted. Moreover, Figure 7c presents an enlarged image of the Then, the SS-SDES is adjusted as described in Section 3.3 to scan the standard plate once again and acquire the discrete intensity sequence for image reconstruction. Figure 7b presents the resulting image, called the adjusted image, which is reconstructed using the adjusted system parameter vector ψ . It can be observed that the missing area at the center does not exist while the adjusted image remains undistorted. Moreover, Figure 7c presents an enlarged image of the scratches with widths of 0.5-6 µm. All of them can be identified clearly with high contrasts. Therefore, it can be estimated that the minimum detectable size of the SS-SDES is less than 0.5 µm. For a quantitative evaluation of the image distortion, the maximum straightness errors and the distance errors introduced above are computed for the scratches and dig pairs in the image after extraction of feature points. Figure 8a shows the maximum straightness errors comparison for different scratches between the original image (marked by circles) and the adjusted image (marked by triangles). It can be observed that some of the errors in the original image are more than 50 pixels, while those in the adjusted image are all within 1.8 pixels. The reduction is significant. Figure 8b presents the distance errors of dig pairs in the adjusted image, plotted by the actual distance on the horizontal axis. As can be seen, the distance errors are within 0.7 pixels for all the dig-pairs with different actual distances that range from 0 to about 11 mm. It means that in a defect detection based on this image, the actual geometric features of defects, such as location and length, can be extracted with subpixel accuracy. Since there is a certain error in the extraction of feature points, the results about the distortion correction are acceptable.
Therefore, it can be estimated that the minimum detectable size of the SS-SDES is less than 0.5 µm. For a quantitative evaluation of the image distortion, the maximum straightness errors and the distance errors introduced above are computed for the scratches and dig pairs in the image after extraction of feature points. Figure 8a shows the maximum straightness errors comparison for different scratches between the original image (marked by circles) and the adjusted image (marked by triangles). It can be observed that some of the errors in the original image are more than 50 pixels, while those in the adjusted image are all within 1.8 pixels. The reduction is significant. Figure 8b presents the distance errors of dig pairs in the adjusted image, plotted by the actual distance on the horizontal axis. As can be seen, the distance errors are within 0.7 pixels for all the dig-pairs with different actual distances that range from 0 to about 11 mm. It means that in a defect detection based on this image, the actual geometric features of defects, such as location and length, can be extracted with subpixel accuracy. Since there is a certain error in the extraction of feature points, the results about the distortion correction are acceptable. Additionally, to verify the effectiveness of the proposed image reconstruction method based on weighted average, the nearest-neighbor interpolation method [25] is exploited to reconstruct another image as a comparison. Figure 9 presents the gray value distributions in particular background areas of the images reconstructed by the proposed method (on the left) and the nearest-neighbor interpolation method (on the right). Figure 9a,b corresponds to a same area near the image center, with the gray value standard deviation of 0.98 and 2.48, respectively. As can be seen, the proposed method can produce a more uniform background, which is important for the following image processing to extract defects. As for the background area far from the center, as shown in Figure  9c,d, our method can eliminate the no-value pixels effectively. However, the fluctuation of background gray values, mainly caused by the signal noise, increases compared to the area near the center, with an improved gray value standard deviation of 2.16. The reason is that the density of sampling points gradually decreases from the center to the outside. Since the PMT detection duration can be shorter than 1 microsecond, if a higher sampling frequency such as 0 10 f = MHz is employed, this problem will be mitigated, and a better noise level can be obtained. Apparently, in contrast to the nearest-neighbor interpolation method, our method has a better performance. In conclusion, the above experimental results show that with the proposed system calibration and image reconstruction methods, a complete defect image with low noise and low distortion can be obtained, thus improving the detection accuracy and reliability of the system. Additionally, to verify the effectiveness of the proposed image reconstruction method based on weighted average, the nearest-neighbor interpolation method [25] is exploited to reconstruct another image as a comparison. Figure 9 presents the gray value distributions in particular background areas of the images reconstructed by the proposed method (on the left) and the nearest-neighbor interpolation method (on the right). Figure 9a,b corresponds to a same area near the image center, with the gray value standard deviation of 0.98 and 2.48, respectively. As can be seen, the proposed method can produce a more uniform background, which is important for the following image processing to extract defects. As for the background area far from the center, as shown in Figure 9c,d, our method can eliminate the no-value pixels effectively. However, the fluctuation of background gray values, mainly caused by the signal noise, increases compared to the area near the center, with an improved gray value standard deviation of 2.16. The reason is that the density of sampling points gradually decreases from the center to the outside. Since the PMT detection duration can be shorter than 1 microsecond, if a higher sampling frequency such as f 0 = 10 MHz is employed, this problem will be mitigated, and a better noise level can be obtained. Apparently, in contrast to the nearest-neighbor interpolation method, our method has a better performance. In conclusion, the above experimental results show that with the proposed system calibration and image reconstruction methods, a complete defect image with low noise and low distortion can be obtained, thus improving the detection accuracy and reliability of the system.

Conclusions
A spot scanning surface defect evaluation system, which has better performances on the detection for small defects and defect classification than the traditional systems, is established. However, subject to the existing deviations, the system cannot directly provide a high-quality defect image. This paper develops research on these system deviations and then establishes the mathematical model of the practical scanning trace. On this basis, a system calibration method based on straightness and scale constraints is proposed. This method employs a calibration plate with specific defect patterns as the test sample, and places particular straightness constraints and scale constraints on the defects after being extracted. By minimizing the constraints, one can obtain the optimal estimate of the system deviations, which is used, on the one hand, to adjust the system for eliminating the position deviation of the initial illuminated spot, and on the other hand, to establish an accurate mapping relationship for reducing the distortion of the reconstructed image. The adjusted system can perform the detection for the whole optical surface in a normal way but without any missing area at the center. Additionally, an image reconstruction method based on weighted average, capable of eliminating no-value pixels and suppressing signal noise, is proposed, thus enhancing the quality of the reconstructed defect image. Finally, experiments demonstrate the effectiveness of the proposed methods, with the results that the maximum straightness error is within 1.8 pixels and the scale error is within 0.7 pixels. Our methods provide the defect image data with high quality and high precision for the following image processing to extract defects, and hence lay the foundation for improving the detection accuracy of the system. The research results of this paper can also be applied to similar problems of other detection systems based on spot scanning, such as those for wafers, films, and rough surfaces. In the future, more constraints will be considered to improve the accuracy of the system calibration method. Our system can be further improved in two ways: (1) The raw data acquired by the system contains higher-resolution information, which can be utilized to improve the detection accuracy. (2) Collecting and detecting the specular reflection light can provide additional potentials to system adjustment and defect detection.

Conclusions
A spot scanning surface defect evaluation system, which has better performances on the detection for small defects and defect classification than the traditional systems, is established. However, subject to the existing deviations, the system cannot directly provide a high-quality defect image. This paper develops research on these system deviations and then establishes the mathematical model of the practical scanning trace. On this basis, a system calibration method based on straightness and scale constraints is proposed. This method employs a calibration plate with specific defect patterns as the test sample, and places particular straightness constraints and scale constraints on the defects after being extracted. By minimizing the constraints, one can obtain the optimal estimate of the system deviations, which is used, on the one hand, to adjust the system for eliminating the position deviation of the initial illuminated spot, and on the other hand, to establish an accurate mapping relationship for reducing the distortion of the reconstructed image. The adjusted system can perform the detection for the whole optical surface in a normal way but without any missing area at the center. Additionally, an image reconstruction method based on weighted average, capable of eliminating no-value pixels and suppressing signal noise, is proposed, thus enhancing the quality of the reconstructed defect image. Finally, experiments demonstrate the effectiveness of the proposed methods, with the results that the maximum straightness error is within 1.8 pixels and the scale error is within 0.7 pixels. Our methods provide the defect image data with high quality and high precision for the following image processing to extract defects, and hence lay the foundation for improving the detection accuracy of the system. The research results of this paper can also be applied to similar problems of other detection systems based on spot scanning, such as those for wafers, films, and rough surfaces. In the future, more constraints will be considered to improve the accuracy of the system calibration method. Our system can be further improved in two ways: (1) The raw data acquired by the system contains higher-resolution information, which can be utilized to improve the detection accuracy. (2) Collecting and detecting the specular reflection light can provide additional potentials to system adjustment and defect detection.