Polynomial fitting method of background correction for electron backscatter diffraction patterns

A raw electron backscatter diffraction (EBSD) signal can be empirically decomposed into a Kikuchi diffraction pattern and a smooth background. For pattern indexing, the latter is generally undesirable but can reveal topographical, compositional, or diffraction contrast. In this study, we proposed a new background correction method using polynomial fitting (PF) algorithm to obtain clear Kikuchi diffraction patterns for some applications in nonconductive materials due to coating problems, at low accelerated voltage and at rough sample surfaces and for the requirement of high pattern quality in HR-EBSD. To evaluate the quality metrics of the Kikuchi patterns, we initially used three indices, namely, pattern quality, Tenengrad variance, and spatial–spectral entropy-based quality to detect the clarity, contrast, and noise of Kikuchi patterns obtained at 5 and 15 kV. Then, we examined the performance of PF method by comparing it with pattern averaging and Fourier transform-based methods. Finally, this PF background correction is demonstrated to extract the background images from the blurred diffraction patterns of EBSD measurements at low kV accelerating voltage and with coating layer, and to provide clear Kikuchi patterns successfully.

www.nature.com/scientificreports/ EBSD patterns can be empirically divided into two partitions of Kikuchi diffraction (KD) and background (BG) [22][23][24][25] . Then, the background correction method is generally used for the post-processing of EBSD patterns to solve the problem of low signal-to-noise ratio in EBSD patterns. Here, the background division and subtraction for the background correction method are used for multiplicative and additive processing of images, respectively. However, the static background division is usually applied for the image post-processing of Kikuchi patterns, that is, to generate a background through averaging Kikuchi patterns obtained from many differently oriented grains 26 . In addition, Winkelmann 15 proposed a dynamic correction method, which generates a background for each individual pattern, and Britton et al. 27 reported a background construction method using a Gaussian model approach.
In the present study, we propose a new polynomial fitting (PF) background correction method for correcting the background in EBSD patterns and providing high-quality Kikuchi patterns. This method combines the concepts of the dynamic background correction and the static background correction. The potential applications can be found in nonconductive materials, at low accelerated voltage and at rough sample surfaces, and for the requirement of high pattern quality in HR-EBSD reported by Wilkinson 28 . Furthermore, we compare this method with two background correction methods using pattern averaging (PA) and Fourier transform-based (FT) approaches. In addition, to evaluate the quality metrics of the Kikuchi patterns prior to indexing, we use three techniques, namely, pattern quality (PQ), Tenengrad variance (TenV), and spatial-spectral entropy-based quality (SSEQ) to detect the clarity, contrast, and noise of processed images, respectively.

Results and discussion
Evaluation of quality metrics of Kikuchi patterns. In the nonconductive material applications, at low accelerated voltage and at rough sample surfaces, EBSD measurements show blurred patterns. The quality of Kikuchi patterns has a significant influence on the performance of the indexing processing. Thus, the quality metrics should be applied to evaluate the image quality. Three techniques, namely, PQ, TenV, and SSEQ are applied to quantify the quality of images with respect to contrast, blur, and noise. First, the definition of PQ is presented as follows 29,30 : where N is the number of diffraction bands being five, and H is the height of the Hough peak corresponding to a band at location (ρ i , θ i ) . Here, PQ is used to detect the sharpness of the observed bands, and TenV and SSEQ are used to the image quality.
Second, TenV 31 , which represents the gradient magnitude between pixels in an image, is given by the following: where S(m, n) represents a gradient magnitude of I(m, n) pixels, and S is the mean of the magnitudes given by the following: The larger deviation of the gray level indicates the higher the TenV value. Third, SSEQ is a type of no-reference image quality assessment (called NR-IQA) approach to evaluate the degree of distortion in a single image; it is based on the calculation of spectral and spatial entropy 32 . The SSEQ value from 0 to 100 indicates good to poor quality. The procedure of SSEQ approach can be roughly divided into four steps, as follows: down sampling process, partition image to M × M blocks, feature pooling, and prediction of the image quality score. The spatial entropy is given by the following: where x is the pixel value within a block, with empirical probability density p(x) , i.e., relative frequency here. The spectral entropy is given by the following: where P(i, j) is a spectral probability map.
After introduction to three image quality metrics of PQ, TenV, and SSEQ, modifications of contrast, sharpness, and noise were carried out on a raw image in Fig. 1j. For contrast modification, the low limit of the gray level is selected at 21, 42, and 63 to fix the gray level at 255. Figure 1a-c show that the low limit from 63 to 21 increases the image contrast because of the increasing range of the gray level 33 . When considering the increasing percentage with respect to the raw image, that of TenV is significantly larger than that of PQ, whereas SSEQ shows slightly decreasing percentage. Thus, TenV and PQ metrics are sensitive to the change in image contrast in Table 1. (4) www.nature.com/scientificreports/ In the case of sharpness modification, a 2D Gaussian blur filter (G 2D ) called a nonuniform low-pass filter that preserves the low spatial frequency and smooth images is expressed as follows 34 : where x and y are the location positions. The standard deviation σ 1 of the Gaussian blur filter changes the amount of blurring. When increasing the standard deviation σ 1 from 3 to 10, the images become more blurred, as shown in Fig. 1d-f. The increase in the standard deviation from 3 to 10 decreases the PQ value from 9923 to 7190, but increases TenV value from 4.02 × 10 4 to 6.43 × 10 3 and the SSEQ value from 32.11 to 67.51, as shown in Table 1. When considering the increasing percentage with respect to the raw image, the indexing of TenV is observed to be more sensitive than that of SSEQ due to the sharpness change, but that of PQ is insensitive.
When increasing noise in images, the probability density function called Gaussian noise 35 of a random Gaussian variable z is given by the following: where z represents the gray level, µ is the mean gray value, and σ 2 is the standard deviation. When increasing standard deviation σ 2 from 15 to 70, the PG value becomes larger, indicating the broader distribution of noise in Fig. 1g-i. The increase in the standard deviation from 15 to 70 decreases the PQ value from 9924 to 7191 and TenV value from 3.46 × 10 7 to 6.01 × 10 9 , but increases the SSEQ value from 41.01 to 61.09, as shown in Table 1.
Although the indexing of TenV shows a more increasing percentage here, the increasing TenV value indicates a sharp image, which is inappropriate. Here, the indexing of SSEQ is more sensitive than that of PQ to detect noise. Therefore, the TenV indexing is sensitive to change in contrast and blur and the SSEQ indexing to noise detection.

Estimation of background image by PA, FT, and PF methods. At low accelerated voltage, Kikuchi
patterns reveal blurred edges with a low signal-to-noise ratio. Thus, adaptive histogram equalization (AHE) is initially used to improve contrast in images. After contrast enhancement with AHE, the comparison of the raw images in Fig. 2a,b shows an improved contrast, and the enhanced contrast broadens the range of gray level in Fig. 2c. The profile of gray level marked by the yellow line is plotted in Fig. 2a,b, and the profile is significantly increased after implantation of AHE.
Diffraction patterns contain a significant amount of background, which can be approximated by averaging patterns from various crystallites in a given polycrystalline sample or simulated patterns at low magnifications 5 . This process describes the first background generation method called PA, where an average pattern is revealed without crystallographic details that remove long-range intensity gradients.
In the second method called FT 36 , a low-pass filtering operation (also called a "blurring" or "smoothing" filter) is used to selectively smooth the image background without changing the bright areas. The 2D discrete Fourier transform of an M × N image is expressed by the following: where x and y are the spatial variables, and u and v are the frequency variables. The center region of the frequency domain represents the low frequency region, which corresponds to the background signal of Kikuchi patterns.  www.nature.com/scientificreports/ Hence, we use the Gaussian low-pass filter to remove the signal of the low frequency region. The Gaussian lowpass filter is given as follows 35 : where D(u, v) is the distance from the center of the frequency rectangle, and D 0 is the cutoff frequency. The generated background uses the FT method, where a cutoff frequency of 10 is selected for the Gaussian low-pass filter.
In the third method, which uses the PF approach, the electron backscatter diffraction patterns are composed of a Kikuchi diffraction pattern (signal) and a smooth background (noise). To obtain a 3D surface, the 2D Kikuchi pattern should be transformed into a 3D Kikuchi curve by converting the g i value of the gray scale at (X i , Y i ) to the Z i value corresponding to a point at (X i , Y i , Z i ) in 3D. The latter can be approximated by a smooth surface with polynomials 37 , which are used for curve fitting techniques and given by the following: where N is the order in the range between 1 and 5, and p i,k is the coefficient of the polynomial function. The order N is considered larger than 3, and the fitting background includes detailed diffraction information, that is, diffraction signals. Thus, the selected value of the order N is 3, which is called the poly33 model and given as follows: The least squares curve fitting technique is used for the solution of the best-fitting curve by minimizing the sum of the least square errors of the data points. Then, the maximum likelihood estimation for the parameter p ij can be obtained by minimizing the chi square. The optimized solution for the 3D fitting curve follows the least squares error of χ 2 given by the following: Poly33 = F x, y = p00 + p10 * x + p01 * y + p20 * x 2 + p11 * x * y+p02 * y 2 + p30 * x 3 + p21 * x 2 * y + p12 * x * y 2 +p03 * y 3 . where M is the data number, and z j is the input value at a position of x j , y j . The backgrounds were generated by PA, FT, and PF methods, as shown in Fig. 2d,f,h for 15 kV and in Fig. 2e,g,i for 5 kV, which are used for the subsequent background correction process. After the polynomial regression approach, the intensity of the generated background surface can be smaller than that of the raw pattern in 3D. This observation results in a negative value after background correction. To avoid the occurrence of negative values after background correction, a γ correction function should be used to compensate for the insufficient intensity of the generated background, and the γ correction function is given by the following 38 : where r is the gray level of the input, s is that of the output, and c is a constant. The parameters of γ = 0.65 and c = 1 are used in γ correction, where the γ value is used to compensate for the insufficient intensity of the raw image.
After γ correction and optimization processes, the generated background images in Fig. 3a,c,e reveal an improved contrast when compared with the images without γ correction and optimization processes in Fig. 2d,f,h for 15 kV. The 3D plots of the background are shown in Fig. 3b,d,f. Thus, the background generation procedures include contrast enhancement, surface fitting, γ correction, and background optimization, as shown in Fig. 4.
Background correction algorithm with PF, PA, and FT methods. After hitting the specimen surface, the primary beam electrons suffer random elastic and inelastic scattering due to energy lose. After a given penetration depth, the electrons scatter at various angles and some electrons diffract following the Bragg's law, resulting in Kikuchi bands. Thus, a relatively low-intensity signal is superimposed with a dominating background signal, as observed on the detector 39 . To solve the problem of low signal-to-noise ratio in EBSD patterns, the background correction algorithm is generally used for the post-processing of EBSD patterns. Thus, we propose a PF background correction algorithm, as shown in Fig. 4: AHE contrast enhancement, background estimation, background subtraction, and contrast-limited adaptive histogram equalization (CLAHE) contrast enhancement.
After background subtraction, CLAHE algorithm is proposed to solve the problem of contrast degradation and to enhance the image contrast in the preprocessing stages. The CLAHE contrast enhancement is applied for PA, FT, and PF methods to compare the image quality after background subtraction, as shown in Fig. 5. The PF method at 15 kV have the highest value of the PQ and TenV indices at 18,652 and 7.33 × 10 7 , respectively, whereas the SSEQ index has the lowest value of 34.69, as shown in Table 2. These results suggest that the pattern, after the PF background correction method, reveals clear and sharp images with decreasing noise.
In addition, in the case of 5 kV, PQ and TenV indices have the highest value of 24,062 and 3.41 × 10 7 , but no significant difference is observed in the SSEQ value for PF method. Here, the PF method provides a bright background image with a broad intensity distribution at 5 kV. Therefore, we successfully demonstrate that the PF background correction method in addition to PA and FT methods can effectively extract a background and Kikuchi pattern from raw diffraction patterns.
To evaluate the image quality after background correction, the profiles of {010} band width represented by black areas called A, B, and C are shown in Fig. 5a-c for PA, FT, and PF methods, respectively. The simulated edges of the {010} Kikuchi band in Fig. 5g are compared, and the {010} profile of the C area for the PF method indicates a significant difference between peaks and valleys, that is, a clear band pattern for pattern indexing.
Case study of PF background correction. The spatial resolution of EBSD can be improved at low accelerated voltage for nonconductive materials. However, lowering the beam energy of the electrons reduces the mean free paths of these elastic and inelastic processes rapidly 33 . Moreover, considering nonconductive samples, conductive coating should be required on the sample surface with a thin amorphous layer of gold or platinum to minimize charging effects 40 . Unfortunately, the effects of low accelerated voltage and conductive coating layer decrease the quality of Kikuchi patterns 12 .
We used Ag bicrystals of A and B and coated a Pt layer only on the left side of the white dotted line in Fig. 6g, considering the effects of low accelerated voltage and conductive coating layer. Then, the raw patterns without   where PQ max and PQ min are the maximum and the minimum values of PQ, respectively. High PQ values indicate good pattern quality and can be better indexed after Hough transform 42 . The profile in Fig. 6g shows that the normalized PQ value significantly decreases after coating for both background corrections. Thus, the amorphous coating layer degrades the pattern quality. The difference in the normalized PQ value between PA and PF corrections reveals no significant change in the case without coating, whereas the normalized PQ value of PF correction in the case with coating is approximately twice that of PA correction. Hence, the results indicate that the PF background correction can improve the image quality of the coating layer at low accelerated voltage.

Conclusions
The quality metrics of the diffraction patterns are evaluated using PQ, TenV, and SSEQ indices, which correspond to the clarity, high contrast, and high noise of the patterns, respectively. We propose a PF background correction method to extract background noise and diffraction pattern from raw diffraction patterns under low accelerated voltage or coated sample. After background correction, the PF method offers the best quality, with a PQ value of 24,062, a TenV value of 3.41 × 10 7 , and an SSEQ value of 18.92, for diffraction patterns obtained at 5 kV compared with the PA and PF methods. Thus, this proposed PF method can improve the quality of diffraction patterns in EBSD measurements at low accelerating voltages and with coating layer.

Methods
Acquisition of raw Kikuchi patterns. All the experimental Kikuchi patterns presented in this study were measured with a JEOL 7001 FE-SEM with a field emissions gun and an EDAX/TSL EBSD system equipped with a DigiView CCD camera and a phosphorescent screen with the diameter of 40 mm. The sample was tilted 70 degrees, and EBSD measurements were performed at a working distance of 15 mm. The parameter of Pt coating is 10 mA using sputter with 30 s. The raw Kikuchi patterns were captured using a 1 × 1 binning mode, and the gain value and exposure time were optimized to achieve high-quality patterns. In the line scan of EBSD experiment, the step size is 50 nm. Each raw Kikuchi pattern with a resolution of 1024 × 1024 pixels in 8-bit digitization was acquired, and the following image processing procedures were conducted using MATLAB.