{'fraction_non_alphanumeric': 0.029061371841155235, 'fraction_numerical': 0.007300441235459286, 'mean_word_length': 4.7629449838187705, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Crack Extraction for Polycrystalline Solar Panels

: Crack extraction of solar panels has become a research focus in recent years. The cracks are small and hidden. In addition, there are particles of irregular shape and size on the surface of the polycrystalline solar panel, whose reﬂection position and direction are random. Therefore, there is a complex and uneven texture background on the solar panel image, which makes the crack extraction more difﬁcult. In this paper, a crack extraction method combining image texture and morphological features is proposed. Firstly, the background texture and multi-scale details are suppressed by the linear ﬁlter and the Laplace pyramid decomposition method. Secondly, the edge can be extracted based on the modulus maximum method of the wavelet transform. Finally, cracks were extracted by using the improved Fuzzy C-means (FCM) clustering combining the morphological and texture features of the cracks. To make the extraction results more accurate and reasonable, an improved region growth algorithm is proposed to optimize the extraction results. All of the above research is closely centered on the accuracy and stability requirements of the solar cell crack detection, which is also the key point of this paper. The experimental results show that various improved or innovative algorithms proposed in this paper can accurately extract the position of cracks and obtain better extraction results. The detection results have good stability and can be faithful to the actual situation, which will promote the application of solar cells in more ﬁelds.


Introduction
With the continuous exploitation and consumption of traditional energy, the energy crisis has created huge global challenges. Lots of countries start to reinforce research on the development and utilization of renewable resources. Solar energy, as a clean and environmentally friendly renewable resource, has been favored by many countries in recent years. Due to the long-term outdoor exposure, solar panels are subject to the mutual impact of the temperature difference between daytime and night, wind, and snow erosion and other harsh environments, which will inevitably cause defects such as cracks, fragments, and grid breaks [1]. These defects will reduce the efficiency of photovoltaic conversion and the service life of solar panels [2,3]. Therefore, it is important to accurately extract these defects during the manufacture and use of solar panels. Among them, crack extraction is one of the most complex and difficult work.
The cracks are able to damage cells and cause power loss of the modules, and the mechanism can be described as follows: when the photovoltaic (PV) module is deformed, the crystalline silicon solar cell will produce stress. Within the elastic range, stress is proportional to deformation. Outside the elastic range, because silicon is very brittle, once the macroscopic stress of the cell is lower than the yield strength, the brittle fracture will start from the stress concentration, especially the cracks and deep notches. With the increase of external load, the yield area will gradually expand, and then extend to the whole section, resulting in the mechanical separation of part of the cell [4]. If such a part is not connected to any of the cell interconnect ribbons (CIRs), it will no longer supply power to the module, thus reducing the power consumption of the module [5]. The crack width can be divided into three stages during the deformation of the cell: in the first stage, the crack width is zero and the solar cell remains intact. The second stage begins with the sudden appearance of a crack, after which the crack spreads throughout the chip. Finally, in the third stage, the width of the crack increases proportionally, leading to more cracks. Käsewieter et al. measured the changing trend of cell crack resistance in multi-crystalline silicon solar cells and studied the effect of crack width [6]. The larger the crack width changes, the higher the deformation of the internal structure of the cell will be, which will lead to more easily broken cells and more serious power loss.
The existing methods of crack extraction could be divided into based on spatial domain, frequency domain and classification according to their principles. The spatial domain-based crack extraction method typically used the image brightness, grayscale, gradient and other spatial features to extract cracks. Samir et al. proposed an extraction algorithm based on particle swarm optimization (PSO) by analyzing the gradient of the crack in solar panels [7]. This method first extracts the edges of the image based on the PSO, then analyzes the features of crack and finger to extract their feature vectors, and finally completes the crack extraction by classification. This method has a good suppression effect on noise. Hopkins and Anwar et al. proposed an anisotropic diffusion algorithm for crack extraction [8,9]. This algorithm analyzes the grayscale and gradient of the image to adjust the diffusion coefficient to realize the diffusion reconstruction of the solar panel image. Then, the difference between the reconstructed image after diffusion and the original image is compared to realize the defect detection of the solar panel image. JinSeok et al. proposed using local means to detect defects [10]. In this method, the solar panel image is divided into many small pieces, and the binary mean value of each piece is calculated, respectively. Compared with other defect detection methods, this method has the advantages of detecting micro-cracks, fingerprints, pollution, and other low gray defects. The spatial domain-based crack extraction method is usually applied to the crack detection of bridges, tunnels, walls, concrete pavements, and metal surfaces. The disadvantage of this method is that it cannot accurately distinguish cracks and normal regions with obvious gradients in complex textures. The frequency domain-based crack extraction method usually filters the crack in the frequency domain and then obtains a reconstructed image by the inverse transformation. The differences between the reconstructed image and the original image were used to extract the cracks. Tsai and Mahdavipour et al. uses frequency domain Fourier image reconstruction technology to extract various defects in solar panel images [11,12]. This method first performs a Fourier transform on the original image, then uses the Hough transform to modify the frequency components of the line and stripe regions in the transformed image to zero, and finally performs an inverse Fourier transform on the modified spectral image to generate a reconstructed image. Therefore, the defects in the image can be extracted by the gray difference between the original image and the reconstructed image. The frequency domain-based crack extraction methods are widely used in thin-walled pipes, semiconductors, rocks, and textiles. The disadvantage of this type of method is that it is difficult to detect cracks directly in the frequency domain, but usually requires a series of forward and reverse operations. As for the classificationbased crack extraction methods, He et al. proposed a crack detection method based on independent component analysis (ICA) [13]. This method includes two stages: learning and testing. ICA is used to find a set of independent basic images from the images of the solar cell panels without defects in the learning phase. Each image to be detected is reconstructed into a linear combination of the basic images in the testing phase. The coefficients of a linear combination are used as a feature vector for classification. Finally, the defect is detected by the difference between the test image and the basic reconstructed  [14]. In this method, images are first divided into two categories: defective images and defect-free images. Then, the features are extracted from the two types of images respectively, which are trained by the SVM. Finally, the images are tested by using the training results. In general, the classification-based crack extraction method can only identify whether there are cracks in the image, but it cannot localize cracks. All in all, in the process of extracting cracks, the existing methods focus exclusively on the internal characteristics of the cracks, and so fail to engage with the relationship between the cracks and their neighboring pixels, which affects the result of the crack extraction to some extent. Therefore, this paper proposes a crack extraction method that considers both characteristics from cracks and their surrounding spatial information. Figure 1 shows the flow of crack extraction. As can be seen, the input images include crack-free image and the image to be tested. The output image is the crack extraction result. The algorithms consist of four parts: edge extraction based on multi-scale background suppression, feature definition, crack extraction and crack optimization. First, the feature vectors of the cracks are formed by combining morphological features based on Haar-like and texture features based on wavelet transform, and then a feature library is established from crack-free images by the Fuzzy C-means (FCM) clustering method. Second, inputting images to be tested, the complex texture background of the image is suppressed by a Hessian-based linear filter, then the multi-scale detail is suppressed by a Laplace pyramid, and edges are extracted by the wavelet transform modulus maximum (WTMM) method from the multi-scale detail suppressed image. Finally, the test images are compared with the FCM clustering results to judge whether it is a crack or not. In addition, to optimize the fracture problem of some cracks, this paper simulates the direction of the cracks according to the linear characteristics of the cracks and optimizes the cracks by using the directional region growing method, in order to obtain more accurate crack extraction results. This paper is organized as follows: Section 2 lists the specific flow of the solar cell crack extraction algorithm. Section 3 presents the crack extraction experiment of the solar cell image and analyzed the experimental data and results. Section 4 concludes the paper.  This paper is organized as follows: Section 2 lists the specific flow of the solar cell crack extraction algorithm. Section 3 presents the crack extraction experiment of the solar cell image and analyzed the experimental data and results. Section 4 concludes the paper.

Edge Extraction Based on Multi-Scale Background Suppression
After preprocessing such as distortion correction for the collected images, both cracks and noises in the images had edge characteristics. Therefore, we proposed to use the edge extraction method based on multi-scale background suppression to suppress the noises and extract the edges of the preprocessed images, so as to realize the preliminary extraction of cracks and provide a basis for subsequent detection. For crack extraction task in this paper, the texture suppression and the multi-scale detail suppression are the premise and foundation of edge extraction. In this section, firstly, the Hessian-based linear filter is used to suppress the complex texture background and highlight the linear crack area. Secondly, the multi-scale image information is extracted by the Laplacian pyramid to achieve a balance between noise suppression and crack location accuracy. Finally, edges are extracted.

Background Suppression
Due to the randomly distributed crystal particles in the polycrystalline silicon wafer, there are texture backgrounds with different shapes and random sizes on the surface of a solar cell panel. The presence of these textures seriously affects the extraction of cracks. Therefore, it is necessary to suppress the complex texture background before extracting the edge. In this paper, the Hessian-based linear filter is used to suppress the texture and enhance the linear crack area [15]. The linear enhancement filter proposed for the crack extraction in the solar panel is as follows: To detect cracks with different width, Gaussian functions with different scales are utilized for convolution. The parameters α and β are thresholds, which are used to control the sensitivity of the linear filter to R α and R β . λ 1 and λ 2 represent the intensity change of the linear structure in the main direction and the vertical direction, respectively.
Due to the diversity of cracks, the linear filter needs to be extended to adapt itself to different scales. The filter generates maximum response when the scale is close to the width of the linear structure to be extracted. Combined with the response results of the filter at different scales, the final result is as follows: in which σ min and σ max are the maximum and minimum values of scales, respectively, through which the range of the crack width can be clarified.

Multi-Scale Detail Suppression
When edges are extracted from an image, the edge signals are more sensitive to lowscale spatial information, so it is easy to be affected by noise. On the contrary, high-scale images are relatively insensitive to noise, but, due to their low resolution property, it may not be accurately obtain edge location. Thus, it is necessary to jointly utilize spatial information of multiple scales for edge extraction. In this paper, the Laplace pyramid decomposition technique is used to extract the effective information from each scaled image for noise reduction, in order to enhance the performance of later edge detection. The construction process of the Laplace pyramid is as follows [16]: where G l is the l-layer of the Gaussian pyramid image. G * l is the interpolated and upsampled image of G l . N is the number of layers of the Gaussian pyramid image decomposed. R l and C l are the length and width of the l-layer Gaussian pyramid image, respectively. ω(m, n) = h(m)·h(n) is a two-dimensional separable window function with a size of 5 × 5, and the Gaussian density distribution function ω is expressed as follows: After the image is decomposed by the Laplace pyramid, each layer of the decomposed image will lose part of the high-frequency information. Therefore, the Laplacian pyramid image generated by the difference of Gaussian pyramid image in the adjacent scale is needed to describe this information.
Suppose that where LP l represents the Laplace pyramid image of the l layer decomposed from the solar cell image. The effective information from pyramid images at different scales is fused by using a fusion algorithm as follows:

Edge Extraction
The edge detection algorithm extracts edges based on the pixel value change of the crack and its adjacent area. The commonly used edge detection algorithms include Canny, Laplacian of Gaussian (LoG), Soble and other operators, as well as WTMM with modulus maximized via searching. Because of the high continuity, this paper uses the WTMM method to extract the edge. When the scale is s, the wavelet transforms formula obtained by convolving the image with ϕ 1 (x, y) and ϕ 2 (x, y) are as follows: in which ϕ 1 (x, y) and ϕ 2 (x, y) are partial derivatives of 2D Gaussian functions with respect to x and y, and the formulas are as follows: Energies 2021, 14, 374 6 of 18 ϕ 2 (x, y) = ∂g(x, y) ∂y (12) In wavelet transform, the maxima of wavelet modulus maxima at different scales have different propagation characteristics between signal and noise [17]. It can accurately obtain the singularity information of the signal at a specific point and describe the singularity in the image.

Definition of Crack Features
To accurately extract cracks from the complex texture background, the features of cracks must be effectively defined. According to the definition, multiple features of an edge pixel are extracted to form a feature vector, which can be utilized to determine whether the edge pixel belongs to a crack. When features are being defined, not only are internal characteristics of cracks included, but also external characteristics among cracks and their surrounding spatial neighborhood background should be considered. Therefore, the defined crack features in this paper consists of morphological features and texture features.

Morphological Features
The gradient changing of the gray value along with the crack is obvious. According to the change trend of gray value, cracks can be divided into ridge cracks and step cracks. There is a large gradient difference between each ridge crack and its adjacent pixels on both sides, and the gray value of the neighbors on both sides is higher than the crack itself.
The gray values of ridge cracks show a trend from high to low and then to high. There is a large gradient difference between the step crack and its adjacent pixels on one side, and the gray value of the neighbors is higher than the crack itself. The gray values of step cracks show a trend from high to low.
The panel images and 3D images of the grayscale distribution of the ridge crack and step crack are shown in Figure 2. The resolution of the images is 50 × 107 and the zoom is 2.5:1. fore, the defined crack features in this paper consists of morphological features and texture features.

Morphological Features
The gradient changing of the gray value along with the crack is obvious. According to the change trend of gray value, cracks can be divided into ridge cracks and step cracks. There is a large gradient difference between each ridge crack and its adjacent pixels on both sides, and the gray value of the neighbors on both sides is higher than the crack itself. The gray values of ridge cracks show a trend from high to low and then to high. There is a large gradient difference between the step crack and its adjacent pixels on one side, and the gray value of the neighbors is higher than the crack itself. The gray values of step cracks show a trend from high to low.
The panel images and 3D images of the grayscale distribution of the ridge crack and step crack are shown in Figure 2. The resolution of the images is 50 × 107 and the zoom is 2.5:1.  [18,19]. Figure 3 shows 12 feature templates corresponding to ridge crack and step crack distribution extracted from horizontal, vertical, and diagonal directions by Haar-like features. Each window is divided into a black and white rectangular area, and the feature value of each template is the difference between the sum of gray values of the black and white areas. The template in Figure 3a-f is a linear feature template for extracting ridge cracks; the template in Figure 3g-i is an edge feature template for extract-  [18,19]. Figure 3 shows 12 feature templates corresponding to ridge crack and step crack distribution extracted from horizontal, vertical, and diagonal directions by Haar-like features. Each window is divided into a black and white rectangular area, and the feature value of each template is the difference between the sum of gray values of the black and white areas. The template in Figure 3a-f is a linear feature template for extracting ridge cracks; the template in Figure 3g-i is an edge feature template for extracting step cracks.

Texture Features
Wavelet decomposition can reflect the frequency change in multiple directions, so it is suitable to describe texture features of the panel image [20]. The energy increase rate within adjacent scales of the non-crack area is lower than that of the crack area, so that the energy difference inside the sub-image from wavelet transform can be extracted as the feature of the crack. Figure 4 shows the process of the wavelet decomposition. To extract the texture features, a one-dimensional wavelet transform is firstly applied to the input digital image. The one-dimensional low-pass filter l and the high-pass filter h are used to filter and down-sample the image f( , ) along the x-axis direction, to generate the coefficient matrix of f ( , ) and f ( , ) . Then, the same filters l and h are used to filter and down-sample f ( , ) and f ( , ) along the y-axis direction to generate four sub-images f , f , f , and f , to complete a two-dimensional wavelet transform, where f is the low-frequency part of the input image, and f , f , and f represent the detail sub-images in the horizontal, vertical, and diagonal directions, respectively. The image f can be used as the input image to continue the decomposition of the next scale. As for specific implementation,

Texture Features
Wavelet decomposition can reflect the frequency change in multiple directions, so it is suitable to describe texture features of the panel image [20]. The energy increase rate within adjacent scales of the non-crack area is lower than that of the crack area, so that the energy difference inside the sub-image from wavelet transform can be extracted as the feature of the crack. Figure 4 shows the process of the wavelet decomposition. To extract the texture features, a one-dimensional wavelet transform is firstly applied to the input digital image. The one-dimensional low-pass filter l and the high-pass filter h are used to filter and downsample the image f(x, y) along the x-axis direction, to generate the coefficient matrix of f L (x, y) and f H (x, y). Then, the same filters l and h are used to filter and down-sample f L (x, y) and f H (x, y) along the y-axis direction to generate four sub-images f LL , f LH , f HL , and f HH , to complete a two-dimensional wavelet transform, where f LL is the low-frequency part of the input image, and f LH , f HL , and f HH represent the detail sub-images in the horizontal,  firstly, the input image is decomposed by one-dimensional wavelet, as follows: in which f( , ) is the input image. M and N are the length and width of the image. L l and L h indicate the vector length of low-pass filter l and high-pass filter h, respectively. The two-dimensional wavelet decomposition algorithm is as follows: In order to extract features more accurately, f LH ( , ), f HL ( , ), and f HH ( , ) at different scales s can be normalized as follows: E LH ( , ) , E HL ( , ), and E HH ( , ) denote the normalized energy of the detail sub-image with scale s in horizontal, vertical, and diagonal directions after decomposition, respectively. Figure 5 shows the energy variation in the horizontal, vertical, and diagonal directions of crack point and normal point. The columns marked in blue represent the energy of crack point, the columns marked in red represent the energy of normal point. The data labels above columns are the corresponding energy value. As shown in Figure 5a, when the scale s is 0, the energy of the crack points is usually greater than that of the normal point due to the sharp edge of the crack. In the vertical and diagonal directions, the energy of the crack point is about twice that of the normal point. However, in the horizontal direction, the energy difference is small, which is not very obvious. In order to obtain Firstly, the input image is decomposed by one-dimensional wavelet, as follows: in which f(x, y) is the input image. M and N are the length and width of the image. L l and L h indicate the vector length of low-pass filter l and high-pass filter h, respectively. The two-dimensional wavelet decomposition algorithm is as follows: In order to extract features more accurately, f LH (x, y), f HL (x, y), and f HH (x, y) at different scales s can be normalized as follows: , and E s HH (x, y) denote the normalized energy of the detail sub-image with scale s in horizontal, vertical, and diagonal directions after decomposition, respectively. Figure 5 shows the energy variation in the horizontal, vertical, and diagonal directions of crack point and normal point. The columns marked in blue represent the energy of crack point, the columns marked in red represent the energy of normal point. The data labels above columns are the corresponding energy value. As shown in Figure 5a, when the scale s is 0, the energy of the crack points is usually greater than that of the normal point due to the sharp edge of the crack. In the vertical and diagonal directions, the energy of the crack point is about twice that of the normal point. However, in the horizontal direction, the energy difference is small, which is not very obvious. In order to obtain more distinct and stable features, we continue to decompose the image with a higher scale. Figure 5b-d shows the energy variation in three directions of the crack point and normal point at different scales s. As can be seen, the energy of crack point and normal point both increase with the decomposition scale s increase, but their trends are quite different. The energy difference of the crack point in the three directions is 0.41 (1.17-0.76), 0.41 (1.55-1.14), and 0.54 (1.67-1.13), respectively, and the increase is significant. The energy of the normal point is 0.04 (0.58-0.54), 0.03 (0.62-0.59) and 0.01 (0.65-0.64), which remain basically unchanged. Therefore, the energy difference between adjacent decomposition scales can be used to detect cracks. The two crack images are decomposed by wavelet at the adjacent scale, respectively, and the energy differences in three directions are calculated. Figure 6a and Figure 6e are two images with cracks, and Figure 6b-d,f-h show the energy difference map of them in horizontal, vertical, and diagonal directions. As can be seen, compared with normal points, the energy of crack point on the adjacent wavelet transform varies greatly, so its difference is large. Therefore, the energy differences between two adjacent decomposition scales in the horizontal, vertical, and diagonal direction can be taken as three texture features for detecting cracks.  The two crack images are decomposed by wavelet at the adjacent scale, respectively, and the energy differences in three directions are calculated. Figures 6a and 6e are two images with cracks, and Figure 6b-d,f-h show the energy difference map of them in horizontal, vertical, and diagonal directions. As can be seen, compared with normal points, the energy of crack point on the adjacent wavelet transform varies greatly, so its difference is large. Therefore, the energy differences between two adjacent decomposition scales in the horizontal, vertical, and diagonal direction can be taken as three texture features for detecting cracks.  Figure 6. Energy difference map: (a) crack image; (b) horizontal direction of (a); (c) vertical direction of (a); (d) diagonal direction of (a); (e) crack-free image; (f) horizontal direction of (e); (g) vertical direction of (e); (h) diagonal direction of (e).

Crack Extraction
This section firstly uses the extracted features to generate a crack-free feature library by clustering. Then, the distance between the edge point and the cluster centroid is calculated, and it is compared with a threshold to determine whether the edge point belongs to a crack.
The distance measurement method proposed by Akbarinia is combined with the FCM for clustering [21]. This method normalizes the Euclidean distance between each data point, and the cluster centroid by using the distance variation between the data points in the same cluster, which is called FCM-. This method considers both the distance between classes and the variation of the distance within the class. Therefore, the clustering effect will not decrease as the number of clustering increases. To better apply FCM-to PV images which will form a large number of clusters and the test data are suffering from poor uniformity, an FCM-clustering algorithm combined with dichotomy (DFCM-) is proposed to extract cracks. Firstly, the data sets are divided into two classes by the clustering. Then, we measure the uniformity of data in each class and further cluster the classes with poor uniformity. Repeat clustering until the number of classes meets the set value, and the generation of crack-free feature library is completed.
Suppose B = {B , = 1,2 ⋯ C} is the clustering result of all edge points, and B = { ,1 , ,2 , ⋯ ,n } is a class c containing n edge points. Calculate the Euclidean distance from each data point , in cluster B to the cluster centroed v : Since the clustering density and sample spacing of each class are different, it is necessary to set different adaptive distance thresholds for each class. Assuming that and σ c * are the mean value and standard deviation of distance , between all data in cluster B and the center, the threshold of cluster B is defined as follows: where t is a constant.

Crack Extraction
This section firstly uses the extracted features to generate a crack-free feature library by clustering. Then, the distance between the edge point and the cluster centroid is calculated, and it is compared with a threshold to determine whether the edge point belongs to a crack.
The distance measurement method proposed by Akbarinia is combined with the FCM for clustering [21]. This method normalizes the Euclidean distance between each data point, and the cluster centroid by using the distance variation between the data points in the same cluster, which is called FCM-σ. This method considers both the distance between classes and the variation of the distance within the class. Therefore, the clustering effect will not decrease as the number of clustering increases. To better apply FCM-σ to PV images which will form a large number of clusters and the test data are suffering from poor uniformity, an FCM-σ clustering algorithm combined with dichotomy (DFCM-σ) is proposed to extract cracks. Firstly, the data sets are divided into two classes by the clustering. Then, we measure the uniformity of data in each class and further cluster the classes with poor uniformity. Repeat clustering until the number of classes meets the set value, and the generation of crack-free feature library is completed.
Suppose B = {B c , c = 1, 2 · · · C} is the clustering result of all edge points, and B c = {x c,1 , x c,2 , · · · x c,n c } is a class c containing n c edge points. Calculate the Euclidean distance from each data point x c,i in cluster B c to the cluster centroed v c : Since the clustering density and sample spacing of each class are different, it is necessary to set different adaptive distance thresholds for each class. Assuming that µ c and σ * c Energies 2021, 14, 374 11 of 18 are the mean value and standard deviation of distance d c,i between all data in cluster B c and the center, the threshold of cluster B c is defined as follows: where t is a constant. In the detection, the distance between the feature vector x of edge points and each cluster centroid is calculated, respectively, and then compared with the threshold of each cluster. If the distance is less than the threshold of one of the categories, the edge points are classified as non-crack points; otherwise, the edge points are marked as crack points, and this procedure can be formulated as follows:

Optimization of Results Using Directional Region Growing Algorithm
To address the issue that the detected crack incompleteness and the misdetection are caused by noise, the small break of cracks is firstly complemented by the closed operation of expansion and refinement in morphology. Then, by analyzing the linear characteristics and simulating the direction of the cracks, a directional region growing method was designed to complement the large break.
As shown in Figure 7, a 3 × 3 window is designed in this paper, where O represents the seed point of the region growth, that is, the endpoint of the connected component.  In the detection, the distance between the feature vector x ′ of edge points and each cluster centroid is calculated, respectively, and then compared with the threshold of each cluster. If the distance is less than the threshold of one of the categories, the edge points are classified as non-crack points; otherwise, the edge points are marked as crack points, and this procedure can be formulated as follows:

Optimization of Results Using Directional Region Growing Algorithm
To address the issue that the detected crack incompleteness and the misdetection are caused by noise, the small break of cracks is firstly complemented by the closed operation of expansion and refinement in morphology. Then, by analyzing the linear characteristics and simulating the direction of the cracks, a directional region growing method was designed to complement the large break.
As shown in Figure 7, a 3 × 3 window is designed in this paper, where O represents the seed point of the region growth, that is, the endpoint of the connected component.

Image Preprocessing
At present, the photoluminescence (PL) and the electroluminescence (EL) methods are widely utilized for capturing solar panel images. The cracks in the EL image appear clearer than those in the PL image, so this paper mainly studies the acquisition of EL images. Direct current is used to provide voltage to the photovoltaic module, and a large number of unbalanced carriers are injected to make the photovoltaic module emit infrared light. At the same time, a near-infrared charge-coupled device (CCD) camera is used to capture these infrared lights. To reduce noise and improve the signal/noise ratio, we use a cooling-type CCD camera to obtain EL images in a darkroom environment [22]. Figure 8a shows a group of solar cells images obtained. Due to the large size of the solar panels, the camera cannot completely obtain a solar panel image horizontally; therefore, the camera needs to be tilted at an angle to the solar panel. However, the image captured from this angle is distorted, so, in this paper, a perspective transformation is firstly utilized to correct the distorted image, and the corrected image is shown in Figure 8b [23,24].

Image Preprocessing
At present, the photoluminescence (PL) and the electroluminescence (EL) methods are widely utilized for capturing solar panel images. The cracks in the EL image appear clearer than those in the PL image, so this paper mainly studies the acquisition of EL images. Direct current is used to provide voltage to the photovoltaic module, and a large number of unbalanced carriers are injected to make the photovoltaic module emit infrared light. At the same time, a near-infrared charge-coupled device (CCD) camera is used to capture these infrared lights. To reduce noise and improve the signal/ noise ratio, we use a cooling-type CCD camera to obtain EL images in a darkroom environment [22]. Figure 8a shows a group of solar cells images obtained. Due to the large size of the solar panels, the camera cannot completely obtain a solar panel image horizontally; therefore, the camera needs to be tilted at an angle to the solar panel. However, the image captured from this angle is distorted, so, in this paper, a perspective transformation is firstly utilized to correct the distorted image, and the corrected image is shown in Figure  8b [23,24].  Figure 8 is 0.96 m × 1.6 m. To improve the extraction accuracy, the corrected image needs to be segmented into multiple solar cell images. First, a median filter was used to smooth the corrected image, then the difference between the original image and the smoothed image was calculated, and the difference image was projected horizontally and vertically [25]. Because the pixel value at the junction of two adjacent solar cells is low, the segmented position was determined by finding the local minimum position of the pixel value. The result after segmentation is shown in Figure 9.  Figure 8 is 0.96 m × 1.6 m. To improve the extraction accuracy, the corrected image needs to be segmented into multiple solar cell images. First, a median filter was used to smooth the corrected image, then the difference between the original image and the smoothed image was calculated, and the difference image was projected horizontally and vertically [25]. Because the pixel value at the junction of two adjacent solar cells is low, the segmented position was determined by finding the local minimum position of the pixel value. The result after segmentation is shown in Figure 9.

Edge Extraction Based on Multi-Scale Background Suppression
The edge was extracted from the pre-processed image as the basis for subsequent crack extraction. First, the complex texture background is suppressed by the Hessian-based linear filter to highlight the linear cracks. Then, the multi-scale image information was extracted by the Laplacian pyramid algorithm. Finally, edges were extracted.

Edge Extraction Based on Multi-Scale Background Suppression
The edge was extracted from the pre-processed image as the basis for subsequent crack extraction. First, the complex texture background is suppressed by the Hessian-based linear filter to highlight the linear cracks. Then, the multi-scale image information was extracted by the Laplacian pyramid algorithm. Finally, edges were extracted.
To demonstrate the effect of background suppression on the extracted edge, 60 solar cell images were tested, including 42 crack-free images and 18 crack images with 26 cracks. Tables 1 and 2 tabulate the results of crack extraction without background suppression and with background suppression, respectively. As shown in Tables 1 and 2, the background suppression helped to retain more crack information and reduced false extraction of crack-free images. Figure 10 shows the results of edge extraction with the WTMM method, Canny, and Sobel operators, respectively. To demonstrate the effect of background suppression on the extracted edge, 60 solar cell images were tested, including 42 crack-free images and 18 crack images with 26 cracks. Tables 1 and 2 tabulate the results of crack extraction without background suppression and with background suppression, respectively. As shown in Tables 1 and 2, the background suppression helped to retain more crack information and reduced false extraction of crack-free images. Figure 10 shows the results of edge extraction with the WTMM method, Canny, and Sobel operators, respectively.
The edge extraction results of the WTMM are shown in Figure 10, from which can be seen that edge extraction with WTMM method can not only retain a lot of crack information but also reduce false detection. This provides a good basis for the subsequent crack extraction.

Crack Extraction Based on Crack Features and Fuzzy Clustering
In this section, multiple features of the edge points were extracted to form a feature vector, according to the definition of the crack feature, and then the extracted features from the defect-free image are utilized for clustering, and finally the crack was extracted from the clustering result.  The edge extraction results of the WTMM are shown in Figure 10, from which can be seen that edge extraction with WTMM method can not only retain a lot of crack information but also reduce false detection. This provides a good basis for the subsequent crack extraction.

Crack Extraction Based on Crack Features and Fuzzy Clustering
In this section, multiple features of the edge points were extracted to form a feature vector, according to the definition of the crack feature, and then the extracted features from the defect-free image are utilized for clustering, and finally the crack was extracted from the clustering result.

Definition of Crack Feature
The cracks that exist on the solar cell scenes have different sizes; therefore, to extract cracks from the scene, different parameters have to be previously setup. Suppose that the size of the Haar-like feature is h × w, in which h and w are the height and width of the Haar-like feature, respectively. In this paper, the height of Haar-like feature is fixed to 18, but the widths are set differently, and texture features are also appended. In this paper, two different types of feature descriptors are defined, and the first one is obtained by setting the width value to 6, 12, and 18. Because there are 12 Haar-like feature templates as shown in Figure 3, and each Haar-like feature template is formed using three different widths, 36 morphological features can be extracted. The second type of feature descriptor is defined to take advantage of textural information to enhance the extraction performance; therefore, three types of texture features are extracted from the horizontal, vertical, and diagonal components of the first and second wavelet decomposition. These three texture features are appended to the first type of feature descriptor, which has 36 morphological features, to produce a descriptor containing 39 features which includes those that can extract both morphological features and texture features. These two feature descriptors were utilized to extract cracks and compare their feature extraction effects. Figure 11, Tables 3 and 4 show the effect of texture features on the crack definition. As

Definition of Crack Feature
The cracks that exist on the solar cell scenes have different sizes; therefore, to extract cracks from the scene, different parameters have to be previously setup. Suppose that the size of the Haar-like feature is h × w, in which h and w are the height and width of the Haar-like feature, respectively. In this paper, the height of Haar-like feature is fixed to 18, but the widths are set differently, and texture features are also appended. In this paper, two different types of feature descriptors are defined, and the first one is obtained by setting the width value to 6, 12, and 18. Because there are 12 Haar-like feature templates as shown in Figure 3, and each Haar-like feature template is formed using three different widths, 36 morphological features can be extracted. The second type of feature descriptor is defined to take advantage of textural information to enhance the extraction performance; therefore, three types of texture features are extracted from the horizontal, vertical, and diagonal components of the first and second wavelet decomposition. These three texture features are appended to the first type of feature descriptor, which has 36 morphological features, to produce a descriptor containing 39 features which includes those that can extract both morphological features and texture features. These two feature descriptors were utilized to extract cracks and compare their feature extraction effects. Figure 11, Tables 3 and 4 show the effect of texture features on the crack definition. As can be seen, in the detection results, comparing the 39 feature descriptors who contained texture features to the 36 feature descriptors, the noise suppression effect is relatively weak, and the false extraction rate is high.  can be seen, in the detection results, comparing the 39 feature descriptors who contained texture features to the 36 feature descriptors, the noise suppression effect is relatively weak, and the false extraction rate is high.  In this paper, different clustering algorithms are used to generate a crack-free feature library for crack extraction. Figure 12 lists the crack extraction results of four solar cell images, which are respectively obtained by FCM, FCM-, DFCM, and DFCM-. As can be seen from Figure 12, when DFCM-is utilized to extract cracks, the least loss of crack information is obtained and the false detection can be significantly reduced. In this paper, different clustering algorithms are used to generate a crack-free feature library for crack extraction. Figure 12 lists the crack extraction results of four solar cell images, which are respectively obtained by FCM, FCM-σ, DFCM, and DFCM-σ. As can be seen from Figure 12, when DFCM-σ is utilized to extract cracks, the least loss of crack information is obtained and the false detection can be significantly reduced.

Optimization of Results Using Directional Region Growing Algorithm
It can be seen that, although DFCM-σ can get good results in crack extraction, there are still incomplete crack extraction and false detection caused by noise and other factors. In this section, the results were optimized by the directional region growth algorithm. Figure 13 specifically shows the optimization effect of one of the cracks. can be seen, in the detection results, comparing the 39 feature descriptors who contained texture features to the 36 feature descriptors, the noise suppression effect is relatively weak, and the false extraction rate is high.  In this paper, different clustering algorithms are used to generate a crack-free feature library for crack extraction. Figure 12 lists the crack extraction results of four solar cell images, which are respectively obtained by FCM, FCM-, DFCM, and DFCM-. As can be seen from Figure 12, when DFCM-is utilized to extract cracks, the least loss of crack information is obtained and the false detection can be significantly reduced.   extraction result of (f) using FCM; (h) extraction result of (f) using FCM-σ; (i) extraction result of (f) using DFCM; (j) extraction result of (f) using DFCM-σ; (k) crack image 3; (l) extraction result of (k) using FCM; (m) extract ion result of (k) using FCM-σ; (n) extraction result of (k) using DFCM; (o) extraction result of (k) using DFCM-σ; (p) crack-free image; (q) extraction result of (p) using FCM; (r) extraction result of (p) using FCM-σ; (s) extraction result of (p) using DFCM; (t) extraction result of (p) using DFCM-σ.

Optimization of Results Using Directional Region Growing Algorithm
It can be seen that, although DFCM-can get good results in crack extraction, there are still incomplete crack extraction and false detection caused by noise and other factors. In this section, the results were optimized by the directional region growth algorithm. Figure 13 specifically shows the optimization effect of one of the cracks. To quantify the optimized performance of the directional area growth algorithm, 26 cracks from 60 solar cells were counted, and the total number of cracked pixels is 7953. As shown in Table 5, the pixel number of cracks increased significantly after optimization, and the false detection rate decreased. It shows that the directional region growing algorithm can effectively compensate the crack and solve the problem of the detected crack incompleteness and the false detection caused by noise.  result of (f) using FCM; (h) extraction result of (f) using FCM-σ; (i) extraction result of (f) using DFCM; (j) extraction result of (f) using DFCM-σ; (k) crack image 3; (l) extraction result of (k) using FCM; (m) extract ion result of (k) using FCM-σ; (n) extraction result of (k) using DFCM; (o) extraction result of (k) using DFCM-σ; (p) crack-free image; (q) extraction result of (p) using FCM; (r) extraction result of (p) using FCM-σ; (s) extraction result of (p) using DFCM; (t) extraction result of (p) using DFCM-σ.

Optimization of Results Using Directional Region Growing Algorithm
It can be seen that, although DFCM-can get good results in crack extraction, there are still incomplete crack extraction and false detection caused by noise and other factors. In this section, the results were optimized by the directional region growth algorithm. Figure 13 specifically shows the optimization effect of one of the cracks. To quantify the optimized performance of the directional area growth algorithm, 26 cracks from 60 solar cells were counted, and the total number of cracked pixels is 7953. As shown in Table 5, the pixel number of cracks increased significantly after optimization, and the false detection rate decreased. It shows that the directional region growing algorithm can effectively compensate the crack and solve the problem of the detected crack incompleteness and the false detection caused by noise.  To quantify the optimized performance of the directional area growth algorithm, 26 cracks from 60 solar cells were counted, and the total number of cracked pixels is 7953. As shown in Table 5, the pixel number of cracks increased significantly after optimization, and the false detection rate decreased. It shows that the directional region growing algorithm can effectively compensate the crack and solve the problem of the detected crack incompleteness and the false detection caused by noise.

Conclusions
This paper combines the morphological and texture features of solar cell images to extract features from crack-free images for clustering. To make the clustering algorithm suitable for solar cell images with more clustering numbers, and ensure the uniformity of data in each category, the distance variation and dichotomy of data points in the same clus-tering are added to the traditional fuzzy c-means clustering algorithm. The experimental results show that the extraction results of adding texture features and the new clustering algorithm are able to obtain better performance. Textural background suppression and multi-scale information extraction are added to the edge extraction of the test image. It can be seen from the extraction results that the non-crack areas in edge extraction are significantly reduced. For the problem in which fractures still exist in the initial extraction results, the directional region growing algorithm proposed in this paper can complement the crack well and achieve the ideal crack extraction effect. The method proposed in this paper will bring great convenience to the crack detection of solar cells and provide quality assurance in the production and use of solar cells. This will promote the wider use of solar cells in the field of industrial testing and control. It has positive significance in improving the work efficiency of crack detection, energy conservation, and emission reduction.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to the data has been used in engineering applications.

Conflicts of Interest:
The authors declare no conflict of interest.