Si3N4 Ceramic Ball Surface Defects’ Detection Based on SWT and Nonlinear Enhancement

In order to improve the detection accuracy and efficiency of silicon nitride ceramic ball surface defects, a defect detection algorithm based on SWTand nonlinear enhancement is proposed. In view of the small surface defect area and low contrast of the silicon nitride ceramic ball, a machine vision-based nondestructive inspection system for surface images is constructed. Sobel operation is used to eliminate the nonuniform background, and the silicon nitride ceramic ball surface image is decomposed by SWT. And frequency-domain index low-pass filtering is used to modify the decomposition coefficients, and an adaptive nonlinear model is proposed to enhance defects; finally, the image is reconstructed and segmented by the stationary wavelet inverse transform and the dynamic threshold method, respectively. .e enhanced algorithm can effectively identify surface defects and is superior to traditional defect detection algorithms.


Introduction
Si 3 N 4 ceramic balls have many excellent properties, for example, high hardness, low coefficient of thermal expansion, and good self-lubrication, and under high temperature, high speed, and other harsh conditions, they can still maintain good strength and hardness [1][2][3]. So, they can be widely applied in the vital component of military equipment, navigation equipment, and other fields [4,5]. Due to the brittleness of silicon nitride ceramic material and the limitation of processing technology, the ceramic ball is prone to pits, cracks, scratches, and other defects during the preparation process, which seriously reduce the service life and reliability of silicon nitride ceramic bearing [6,7]. In order to ensure the safety and reliability of the device, it is very important to detect the surface defects of silicon nitride ceramic bearing balls. e defect detection of Si 3 N 4 ceramic balls mainly relies on manual detection, which has the disadvantages of high cost, low accuracy, and large randomness [8][9][10].
us, efficient machine vision detection methods are becoming more and more popular.
In the machine vision detection technology, they have high detection accuracy and high stability and are widely used in the field of surface feature measurement and defect detection [11,12]. Zhang et al. [13], by analyzing the Si 3 N 4 ceramic balls' defect characteristics, found that some defects cannot be directly detected. So, they proposed a method based on fringe reflection. In their method, flat screens with fringes were drawn on ceramic balls based on specular characteristics. If the Si 3 N 4 ceramic ball is nondefective, the images formed by reflection on its surface present even fringes. Finally, the experimental results prove the effectiveness of this method. Yang et al. [14] developed an automatic inspection system based on NDT to detect Si 3 N 4 balls' defects. In their method, a microscope and CCD camera were used to shoot various surface defects, and then the top-hat transformation and logarithmic transformation were used to remove the uneven light interference. Finally, they proposed the defect automatic seed region growth algorithm to locate defects. e results showed the system was effective for the detection of surface and subsurface defects of Si 3 N 4 ceramic bearing balls. Due to the characteristics of multiscale analysis that can read defect information in depth and better identify image defect information, multiscale analysis techniques are widely used in surface defects. Wang et al. [15] used a multiscale feature correction method to refine features at the pixel level to avoid feature errors when the image is simplified at the regional level. e final fully connected layer not only integrates multiscale and multilevel features but also serves as the main target classifier. Experimental results show that this model achieves better results than other main target detection models.
In this paper, we propose an enhancement algorithm based on the stationary wavelet transform and nonlinear enhancement to detect the Si 3 N 4 ceramic balls' surface defects. A defect machine vision platform is built, and after collecting surface images, images should be preprocessed by the Sobel operator, and then defect images should be segmented by the enhancement algorithm. Finally, the enhancement algorithm is evaluated based on the multiscale evaluation method to verify its effectiveness. In general, the advantages of the proposed detection method are as follows: (1) e proposed method can effectively detect various types of defects on the surface of Si 3 N 4 ceramic balls, including pits, snowflakes, , scratches, and cracks, and can accurately locate the defect location (2) According to the image information, the parameters can be adjusted adaptively to realize the adaptive linear enhancement of defects (3) e proposed method can effectively detect lowcontrast defects and can be applied to defect detection in other fields

Machine Vision System for Si 3 N 4 Ceramic Bearing Balls
In order to obtain the surface defects' images, a machine vision system is developed. e surface cleanliness and the environment of the sample will have a significant impact on the quality of the collected images, thus affecting the processing and analysis of the images. To obtain high-quality defect images, the surface of all Si 3 N 4 ceramic bearing ball samples are cleaned by using an ultrasonic machine to ensure no other impurities on the surface of the sample, and then image collection is carried out. e system includes three parts: (I) image acquisition, (II) image transmission, and (III) image processing. Figure 1 shows the diagram of the machine vision system. In this system, the Si 3 N 4 ceramic bearing balls first entered the device and are positioned by the locating device. en, the image acquisition is done under the cooperation of the locating device, the adjustable LED light sources, and the CCD camera. Finally, the defects' images are transferred to the PC and processed by the proposed algorithm. As a result, all Si 3 N 4 ceramic bearing balls' surface defects can be detected by the NDT system based on machine vision. e proposed NDT system employs a Daheng Imaging MER-2000-5GM/C camera with GigE Vision. To improve the efficiency of transmission, a target area as large as 384 × 120 pixels is intercepted in the experiment. e images are collected to the PC by using the TP-Link Gigabit Ethernet. e experiments are carried out on an Intel Quad-core 3.1 GHz PC with 16 GB RAM, and all the computations are performed with MATLAB R2014b.

Defects' Analysis of the Si 3 N 4 Ceramic Bearing Balls' Surface
3.1. Analysis of Surface Defects. Surface defects collected by the machine vision system are shown in Figure 2. First, the overall surface morphology is observed, and then after the defects are confirmed, the defects are further enlarged for observation and taking defects' images. Figure 2(a) shows a sample of Si 3 N 4 ceramic balls to be tested after ultrasonic cleaning. And then, its surface is observed through the machine vision system to determine the location of defects, which is shown in Figure 2(b). Finally, four typical defects are summarized by observing different positions of Si 3 N 4 ceramic balls, including pit defects, crack defects, scratch defects, and snowflake defects, as shown in Figures 2(a)-2(f ). It can be observed that the surface of Si 3 N 4 ceramic balls is small, and the contrast is low. In the pit defects' images, the local tissue peeling with obvious edge can be clearly identified. e crack defects are slender and linear with obvious sag. Scratch defects and snowflake defects are in the form of bands, clusters of pitting defects could be observed in the scratch defects' zone, and large areas of white spots appear in the snowflake defects. In the defect image, the contrast is low, and it has a small amount of noise; it is not conducive to the subsequent inspection work. In order to boost the effect of defect detection, we need to suppress noise and enhance defect information.

Preprocessing of Defects' Images.
As the surface of the Si 3 N 4 ceramic bearing ball is curved, it is difficult to achieve uniformity of illumination, so the gray value of different parts of the image is very different. erefore, we used the Sobel operator to eliminate uneven background. And the gray image is converted into a gradient image. e transformation relation is as follows: where where f(x, y) represents the original image. G(x, y) means the gradient image; d x (i, j) and d y (i, j) are the Sobel edge operators. And the gradient images of defects' images obtained after processing by Sobel edge operators are given in Figure 3.

Image Decomposition Based on SWT.
Because of complicated defect information of the surface defect image of Si 3 N 4 ceramic balls, it is difficult for traditional methods to detect it. erefore, we proposed an enhancement algorithm based on SWT and nonlinear enhancement to increase the difference between the background and defect [16][17][18]. Assume picture f(x, y) with size m × n. SWT is as follows: where x � 1, 2, 3, . . . , m and y � 1, 2, 3, . . . , n. p * k , p * l , q * k , and q * l are SWT filters. s (j+1) (x,y) and s (j) (x+k,y+l) are the low-frequency coefficients. w To ensure the detection accuracy and efficiency and through a large number of experiments to prove, we choose the 4th Daubechies wavelet (db4) decomposing the gradient image. After many experiments, when the decomposition level is 3, the defects image can be enhanced. e decomposition results are shown in Figure 4. Comparing image defects with background information, it can be concluded that defects and noise information mainly exist in these high-frequency coefficients. In the horizontal detail coefficient and the diagonal detail coefficient, the background information of the defect image is weakened, and most of the defect information is retained. In the vertical detail coefficient, the defect information is weakened, and most of the background information is retained. Figure 4(d) shows the low-frequency coefficients, most of the information of the defect image is retained in the image, and the defect and background are weakened to a certain extent. In order to improve the contrast between the defect and the background, it is necessary to modify the decomposition coefficient to enhance the image area information and improve the detection accuracy of the image.

Defect Enhancement Based on SWT.
In order to effectively enhance the defect feature information and improve the contrast, an enhancement algorithm based on SWT and nonlinear enhancement is proposed. Since the defect information is weakened in the vertical detail coefficient, a small amount of noise information and most of the background information are retained. To further remove noise, improve the surface defect characteristics of the silicon nitride ceramic bearing ball, and improve the contrast between the background and defect detection, the vertical detail coefficient is set to 0. In the horizontal and diagonal detail coefficients, the background information is weakened, and most of the defect information is retained. In order to enhance defect characteristics, the decomposition coefficients of each layer in the horizontal detail coefficient and diagonal detail coefficient are Fourier transformed, and then the exponential low-pass filtering is carried out to retain the defect information, and finally, the inverse Fourier transform is carried out. e low-frequency coefficients of the third layer retain most of the information of the defect image, which is filtered with an exponential lowpass filter, and nonlinear enhancement is performed after filtering to further enhance the defect information and improve the contrast. After processing the decomposition coefficients, inverse SWT processing is performed on the improved decomposition coefficients to obtain a noisefree defect enhanced image. We use the adaptive threshold method to extract defects. Figure 5 shows the image processing procedure. en, we used the index low-pass filtering method to reduce noise. e noise mainly exists in high-frequency coefficients. In order to further enhance defects' areas, all where (u, v) represents the coordinate at the frequency domain. F(u, v) represents the Fourier transform value of (u, v). en, the index low-pass filter is used to eliminate noise.
where G(u, v) represents the modified Fourier spectrum. exp − [D(u, v)/D 0 ] n represents the index low-pass function. n is the order. D 0 is the cutoff frequency. D(u, v) is the distance from point (u, v) to the center of the spectrum. D(u, v) can be given by Finally, the processed frequency coefficients are obtained by the inverse Fourier transform. e equation is At the same time, horizontal and diagonal wavelet coefficients of each layer are filtered in the same way. To reinforce defect information, we proposed a nonlinear enhancement algorithm to enhance coefficients as follows: where S(x, y) represents the enhanced coefficient, α and β represent adjustment coefficients, with the value range of [0,+∞], and T represents the threshold, and it can be obtained by the Otsu method.

Inverse SWT and Defects' Extraction.
rough the inverse SWT, we can obtain a reconstructed image with no noise and strong contrast. For the inverse SWT, the equation is where p * k , p * l , q * k , and q * l are the reconstruction filters of the SWT decomposition transform, s After the surface defect image is reconstructed, the contrast between the background and the defect is enhanced. Finally, threshold T is used to extract defects.

e Enhancement Process 5.1.1. Index Low-Pass Filtering.
According to the proposed coupling enhancement algorithm, each decomposition detail coefficient needs to be enhanced separately. e vertical detail coefficient is set to 0, and Fourier transform and exponential low-pass filtering are used to filter the horizontal detail coefficient and the diagonal detail coefficient. en, the same method is used to filter the third-level low-frequency coefficient.
As shown in Figure 6, compared with Figure 4, in the horizontal detail coefficient, diagonal detail coefficient, and low-frequency coefficient, the characteristic information of the defect area of the image is effectively enhanced. And the contrast is also improved accordingly. In the horizontal detail coefficient, through filtering operation, the defect information is retained, the noise and background information are weakened, and the defect and noise information can be better distinguished. After index low-pass filtering, the background of low-frequency coefficients is significantly improved, and the contrast between the background and the defect is enhanced. After filtering, it can effectively distinguish the background from the defect area, laying a foundation for further complete extraction of defect features.

Nonlinear Enhancement.
After the image is decomposed by SWT, most of the information of the image remains in the low-frequency coefficients. In order to improve the contrast, enhance defect information, and eliminate the influence of noise on defect segmentation, nonlinear enhancement methods are used to enhance the low-frequency coefficients. And α � 3 and T-value was obtained by the Otsu method. e results are shown in Figure 7. Compared with the unenhanced low-frequency decomposition coefficient, the background and noise of the nonlinear enhanced image are obviously suppressed, and the defect area is obviously enhanced, forming a strong contrast with the flat background. In inverse image transformation, the enhanced low-frequency coefficients can combine the significant defect features with other decomposition coefficients to obtain the defect images with enhanced defects and facilitate the accurate and complete segmentation of the defects.

Image Reconstruction and Defects' Extraction.
Finally, inverse SWT is used to obtain enhanced images. And threshold T is used to extract defects. e final enhanced images and binary image are shown in Figure 8. Figure 8 shows the image after nonlinear enhancement and binary image. By analyzing Figure 8(  enhancement, the background area of the image becomes flat and noiseless, and the defect information is significantly different from the background information, which is effectively enhanced. en, the adaptive threshold is used to segment the enhanced image, and the binary image is obtained, as shown in Figure 8(b). e defect is segmented completely, and the defect is accurately located.

Comparison between Other Detection Methods and Our
Method. Finally, we used the enhancement algorithm to process pit defects, crack defects, scratch defects, and snowflake defects. And it is compared with other methods, i.e., the defect automatic seed region growth algorithm based on histogram concavity analyses and Otsu method (RGA) proposed by Yang et al. [14], the approach using wavelet transform for automatically detecting low-contrast defects (WTL) proposed by Wang et al. [15], and the multiscale decomposition (MSD) detection method proposed by Yang et al. [16]. e detection results of defects under the same lighting conditions are shown in Figure 9.
Analyzing the defect segmentation results of each method, it can be seen that the RGA method is not sensitive   to discontinuous defects in the image, resulting in inaccurate detection results. In the detection of pit defects and crack defects, discontinuous defects are mistakenly segmented. e MSD method uses a multiscale feature method to refine features at the pixel level to obtain a simplified image, and they use multiscale regional assimilation based on superpixels.
e analysis results of pit defects and snowflake defects show that the defects are discontinuous. e coupling enhancement method we proposed effectively removes noise and texture features by enhancing and filtering the decomposition coefficients, enhancing defect information, and accurately extracting defects under the same lighting conditions. In general, our enhancement algorithm is effective.

Conclusions
(1) In this paper, we proposed an enhancement algorithm based on SWT and nonlinear enhancement to obtain enhanced defect images. According to the signal properties of defects' images, the coupling enhancement algorithm is designed based on nonlinear enhancement and SWT. Finally, defects' images are reconstructed by the inverse stationary wavelet transform and segmented by the threshold method. Experiments verify our algorithm effectiveness. (2) We use the enhancement algorithm to detect the Si 3 N 4 ceramic bearing balls' surface defects. Most noises are eliminated, and the contrast is improved, so defects can be accurately extracted. In the process of detection, the defect information of snowflake defects and scratch defects is lost. In the future, our main work is to further improve the accuracy of detection algorithm.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.