Defect identification method based on image processing, controller and storage medium
Through image processing technology, including grayscale processing, bilateral filtering, Hough transformation and dual-threshold iterative Otsu threshold segmentation algorithm, the efficiency and accuracy of defect recognition of photovoltaic modules are solved, and more efficient defect feature extraction and recognition effects are achieved.
Patent Information
- Application Number
- CN202411968609.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art is difficult to efficiently and accurately identify defects in photovoltaic modules, especially in images collected by drones, where defect extraction is poor due to uneven grayscale changes and noise.
The image processing-based method is adopted, including pre-processing steps such as grayscale processing, bilateral filtering and grayscale linear transformation, to remove noise and enhance image comparison; then eliminate gate line interference through Hough transformation, and finally use the double-threshold iterative Otsu threshold segmentation algorithm to extract defect feature values.
It improves the efficiency and accuracy of defect identification of photovoltaic modules, can more effectively extract defect characteristics in photovoltaic modules, and reduces the false alarm rate and missed alarm rate.
Smart Images

Figure CN119887700A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect recognition of photovoltaic modules, and in particular to a defect recognition method based on image processing, a controller and a computer-readable storage medium. Background Art
[0002] Traditionally, the operation and maintenance of photovoltaic power stations mainly rely on manual inspections. However, manual inspections are inefficient and costly, especially in photovoltaic power stations with complex terrain. Manual inspections are not only difficult to conduct, but may also bring safety risks. In contrast, drones can significantly improve inspection efficiency, reduce operation and maintenance costs, and enhance safety and reliability due to their small size, light weight, low cost, and flexibility. The uneven grayscale changes of photovoltaic module images collected by drones and their susceptibility to noise and other factors make it extremely difficult to extract defects from visible light images. Therefore, how to efficiently and accurately identify defects in images has become a technical problem that needs to be solved in this field. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a defect recognition method based on image processing, a controller and a computer-readable storage medium, so as to efficiently and accurately recognize defects existing in a target image of a photovoltaic module.
[0004] In order to solve the above technical problems, according to one aspect of the present invention, a defect recognition method based on image processing is provided for identifying defects of photovoltaic modules, the method comprising:
[0005] Preprocessing the acquired target image of the photovoltaic assembly to obtain a preprocessed image of the photovoltaic assembly;
[0006] Identify and delete the grid lines of the photovoltaic module in the pre-processed image based on Hough transform;
[0007] Extracting feature values of defects in the preprocessed image based on a dual-threshold iterative Otsu threshold segmentation algorithm;
[0008] The type of the defect is identified based on the feature value of the defect extracted from the pre-processed image.
[0009] In some embodiments, the step of preprocessing the acquired initial image of the photovoltaic assembly to obtain a preprocessed image of the photovoltaic assembly includes:
[0010] Performing grayscale processing on the acquired target image to obtain a grayscale image of the target image;
[0011] removing noise from the grayscale image based on bilateral filtering;
[0012] A grayscale linear transformation algorithm is used to perform image enhancement on the grayscale image from which noise has been removed, so as to obtain the preprocessed image.
[0013] In some implementations, a weighted value method is used to perform grayscale processing on the target image, and the formula of the weighted value method is as follows:
[0014] gray=0.299*R+0.578*G+0.114*B.
[0015] In some implementations, the bilateral filtering formula is as follows:
[0016]
[0017] In the above formula, g(i, j) is the output pixel value of the output grayscale image, and f(k, l) is the input point;
[0018] Where w(i, j, k, l) = w s (i, j, k, l)×w r (i, j, k, l), where w s (i, j, k, l) is used to calculate the spatial proximity between each pixel of the grayscale image and the central pixel, w r (i, j, k, l) is used to calculate the similarity of the pixel values of each pixel point of the grayscale image and the central pixel point;
[0019] in,
[0020] In some implementations, the grayscale linear transformation algorithm is formulated as follows:
[0021] T B =g(T A )=K*T A +b;
[0022] In the above formula, K represents the transformation slope, T represents the grayscale value of the input grayscale image, and b is the intercept of the transformation on the y-axis. Different K and b values will produce output images with different visual effects.
[0023] In some embodiments, the step of identifying and deleting grid lines of the photovoltaic module in the pre-processed image based on Hough transform includes:
[0024] In a polar coordinate system, plotting each point in the preprocessed image into a sine curve;
[0025] When the plurality of sinusoidal curves intersect at one point, it is determined that the plurality of points corresponding to the plurality of sinusoidal curves are located on the same straight line;
[0026] When the number of multiple points on the same straight line reaches a preset threshold, the points on the straight line are traversed and white pixels in the neighborhood of each point are removed to delete the grid line.
[0027] In some embodiments, the step of extracting the characteristic value of the defect in the preprocessed image based on the dual-threshold iterative Otsu threshold segmentation algorithm includes:
[0028] Setting two gray value thresholds to divide the gray value of the preprocessed image into three gray value intervals;
[0029] Calculating the area ratio and grayscale value of each grayscale interval in the preprocessed image;
[0030] Calculate the grayscale average value of each grayscale interval based on the area ratio and the grayscale value;
[0031] The two grayscale value thresholds are adjusted according to the size relationship of the grayscale average values until the grayscale average values are the same, and the characteristic value of the defect is extracted.
[0032] In some implementations, the formula for calculating the area ratio of each grayscale interval in the preprocessed image is as follows:
[0033]
[0034] Among them, P low Indicates that the gray value of pixel i is less than or equal to T low The probability, P mid Indicates that the gray value of pixel i is greater than T low and less than T high The probability between high Indicates that the gray value of pixel i is greater than T high The probability of
[0035] The formula for calculating the grayscale value of each grayscale interval in the preprocessed image is as follows:
[0036]
[0037] The formula for calculating the grayscale average value of each grayscale interval is as follows:
[0038]
[0039] According to another aspect of the present invention, a controller is provided, which includes a memory and a processor, wherein the memory stores a computer program, and when the program is executed by the processor, the steps of any one of the above-mentioned image processing-based defect recognition methods can be implemented.
[0040] According to another aspect of the present invention, a computer-readable storage medium is provided for storing a computer program, wherein the program, when executed by a computer or a processor, implements the steps of any one of the above-mentioned image processing-based defect recognition methods.
[0041] Compared with the prior art, the present invention has obvious advantages and beneficial effects. By means of the above technical solution, the image processing-based defect recognition method, controller and computer-readable storage medium of the present invention can achieve considerable technical advancement and practicality, and have wide industrial utilization value, and have at least the following advantages:
[0042] The present invention proposes an Otsu threshold segmentation algorithm based on dual threshold iteration for extracting characteristic values of photovoltaic module defects. The preprocessing method of bilateral filtering and grayscale transformation is used to eliminate image noise interference and enhance image contrast. The influence of photovoltaic module background grid lines on defect feature extraction is eliminated by Hough transformation. The extraction of photovoltaic module defect characteristic values is completed by the proposed dual threshold iteration Otsu threshold segmentation algorithm, thereby improving the defect recognition efficiency and recognition accuracy of photovoltaic modules.
[0043] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following specifically cites a preferred embodiment and describes it in detail with the accompanying drawings as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of a defect recognition method based on image processing according to an embodiment of the present invention;
[0045] Figure 2 A comparison diagram of defect extraction results of the present invention, Otsu algorithm, and adaptive threshold algorithm according to an embodiment;
[0046] Figure 3 It is a comparison diagram of defect extraction results of the present invention according to another embodiment, the Otsu algorithm, and the adaptive threshold algorithm. DETAILED DESCRIPTION
[0047] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the specific implementation methods and effects of a defect recognition method based on image processing, a controller and a computer-readable storage medium proposed by the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments.
[0048] The present invention proposes a defect recognition method based on image processing, such as Figure 1As shown, the defect recognition method based on image processing includes:
[0049] Step S10 , preprocessing the acquired target image of the photovoltaic assembly to obtain a preprocessed image of the photovoltaic assembly.
[0050] It should be noted that photovoltaic power stations are located in relatively open open-air environments. When collecting images of photovoltaic modules in photovoltaic power stations, due to the influence of light, environment, etc., the grayscale of the target images of the collected photovoltaic modules will vary unevenly and be easily affected by various factors such as noise.
[0051] Based on this, after acquiring the target image of the photovoltaic component taken by the drone, the present invention first preprocesses the target image to eliminate noise interference of the target image and improve the contrast of the image.
[0052] In one embodiment, step S10 includes:
[0053] Step 100: grayscale processing is performed on the acquired target image to obtain a grayscale image of the target image.
[0054] In the present invention, when grayscale processing is performed on an image, the following formula can be used to complete the grayscale conversion of the target image, so as to save the processing time of the target image.
[0055]
[0056] gray=max(R,G,B)
[0057] gray=0.299*R+0.578*G+0.114*B
[0058] Preferably, the present invention uses a weighted value method to perform grayscale processing on the target image to obtain a grayscale image of the target image. The formula of the weighted value method is as follows:
[0059] gray=0.299*R+0.578*G+0.114*B.
[0060] Step 102: removing noise from the grayscale image based on bilateral filtering.
[0061] It should be noted that when using drones to inspect photovoltaic power stations, noise will inevitably appear in the image because both the drone and the image acquisition equipment are exposed to a high electromagnetic radiation environment. Therefore, the noise interference in the image needs to be removed during the processing of the target image to ensure the accuracy of subsequent defect identification.
[0062] The present invention uses bilateral filtering to remove the noise of the grayscale image of the target image. Bilateral filtering is a nonlinear filtering technology, which can be regarded as an improvement of Gaussian filtering. It considers the similarity of pixel values between various pixels under the mask and the central pixel, and combines these two factors to derive the weight of the mask at each position.
[0063] Specifically, the formula for bilateral filtering is as follows:
[0064]
[0065] In the above formula, g(i, j) is the output pixel value of the output grayscale image, and f(k, l) is the input point;
[0066] Where w(i, j, k, l) = w s (i, j, k, l)×w r (i, j, k, l), where w s (i, j, k, l) is used to calculate the spatial proximity between each pixel of the grayscale image and the central pixel, w r (i, j, k, l) is used to calculate the similarity of the pixel values of each pixel point of the grayscale image and the central pixel point;
[0067] in,
[0068] Step 104: Use a grayscale linear transformation algorithm to perform image enhancement on the grayscale image from which noise has been removed to obtain a preprocessed image.
[0069] By processing the key parts of the image through image enhancement to highlight its important features and thus improve the clarity of the image, the present invention enhances the grayscale image of the target image using a grayscale linear transformation algorithm.
[0070] The grayscale linear transformation algorithm is a point operation algorithm that maps each pixel point. Its core purpose is to generate a target pixel with a new grayscale value. This process involves a variety of methods, such as logarithmic transformation, linear transformation, piecewise linear transformation, and power transformation. Among them, the grayscale linear transformation is used to adjust the grayscale value range of the image, which can be expanded or compressed. The following formula shows how to obtain a new grayscale value through calculation, thereby improving the overall visual effect of the image.
[0071] The formula of the grayscale linear transformation algorithm is as follows:
[0072] T B =g(T A )=K*T A +b;
[0073] In the above formula, K represents the transformation slope, T represents the grayscale value of the input grayscale image, and b is the intercept of the transformation on the y-axis. Different K and b values will produce output images with different visual effects.
[0074] Step S20: identifying and deleting grid lines of the photovoltaic modules in the pre-processed image based on Hough transform.
[0075] Hough transform identifies objects of various shapes by analyzing the peaks in the image, showing strong resistance to noise and deformation. Hough transform is used to detect horizontal lines in images (i.e. grid lines of photovoltaic modules), mainly because Hough transform uses the point-line duality principle, which is particularly effective in straight line detection and can accurately identify and locate straight line features in images.
[0076] In one embodiment, step S20 includes:
[0077] Step 200: plot each point in the preprocessed image into a sine curve in a polar coordinate system.
[0078] In a rectangular coordinate system, a straight line can be defined by its slope and intercept. Correspondingly, in a polar coordinate system, the same line can be represented by its polar diameter (distance from the origin) and polar angle (angle with the polar axis). This means that, in a polar coordinate system, any straight line defined in a rectangular coordinate system can be expressed by transforming its parameters.
[0079] r=x cosθ+y sinθ
[0080] In the above formula, (r, θ) represents all possible straight lines passing through the point (x, y). In the polar coordinate system, these straight lines are represented as a series of sine curves. Based on this, a sine curve is drawn for each point in the preprocessed image.
[0081] Step 202: When a plurality of sinusoidal curves intersect at one point, it is determined that a plurality of points corresponding to the plurality of sinusoidal curves are located on the same straight line.
[0082] In this step, if n sine curves intersect at a certain point, it means that the points corresponding to the n sine curves are located on the same straight line.
[0083] Step 204, when the number of multiple points on the same straight line reaches a preset threshold, traverse the points on the straight line and remove the white pixels in the neighborhood of each point to delete the grid line.
[0084] In this step, the preset threshold is pre-set based on the grid line of the photovoltaic module. The preset threshold is different for photovoltaic modules of different specifications, and the present invention is not limited to the specific preset threshold.
[0085] Step S30: extracting feature values of defects in the preprocessed image based on a dual-threshold iterative Otsu threshold segmentation algorithm.
[0086] In some embodiments, let the image pixel be N, T be the division threshold, and the grayscale value in the image be divided into two parts, C0 and C1. Assuming that the image grayscale value range is (0, M-1), the grayscale value range covered by C0 is (0, T), and the grayscale value range covered by C1 is (T+1, M-1).
[0087] Let n be the pixel with gray level i in the image. i , then the probability P of this gray level appearing in the preprocessed image i The following formula can be used for calculation.
[0088]
[0089] Arranged:
[0090]
[0091] The gray value of the preprocessed image is divided into two parts, C0 and C1. The gray value u of the preprocessed image is calculated as follows:
[0092]
[0093] The calculation formulas for the ratios w0 and w1 of the areas occupied by C0 and C1 in the preprocessed image are as follows:
[0094]
[0095] The grayscale values u0 and u1 of parts C0 and C1 are calculated as follows:
[0096]
[0097] The grayscale mean u of the image is derived from the above formula T for:
[0098] u T =w0u0+w1u1
[0099] The variance calculation formula of the preprocessed image is:
[0100]
[0101] The image segmentation threshold T takes values in sequence within the pixel range (0, M-1) of the image. The T value at the maximum value is the optimal threshold for binary division of the preprocessed image.
[0102] In one embodiment, step S30 includes:
[0103] Step 300, setting two gray value thresholds, and dividing the gray value of the pre-processed image into three gray value intervals.
[0104] In this step, two gray value thresholds are set, namely T low and T high The grayscale values of the preprocessed image are evenly divided into C0, C1 and C2, and C0 is the grayscale value interval of the low grayscale part (0, T low ), C1 is the gray value interval of the middle gray part (T low +1, T high ), C2 is the gray value interval of the high gray value part (T higt +1, M).
[0105] Step 302, respectively calculating the area ratio and grayscale value of each grayscale interval in the pre-processed image.
[0106] The calculation formulas for the ratios a0, a1 and a2 of the areas occupied by C0, C1 and C2 in the preprocessed image are as follows:
[0107]
[0108] Where: P low Indicates that the gray value of pixel i is less than T low The probability of P mid Indicates that the gray value of pixel i is at T low and T high The probability between hjgh Indicates that the gray value of pixel i is greater than T high probability.
[0109] The grayscale values u0, u1 and u2 of C0, C1 and C2 are calculated as follows:
[0110]
[0111] Step 304 , calculating the grayscale average value of each grayscale interval based on the area ratio and the grayscale value.
[0112] In this step, the formula for calculating the grayscale average value of each grayscale interval is as follows:
[0113]
[0114] Step 306, adjusting the two gray value thresholds according to the magnitude relationship of the gray average values until the gray average values are the same, thereby extracting the characteristics of the defect.
[0115] In this step, if u T_mid Close to u T_low , then increase Tlow , if u T_mid Close to u T_high , then reduce T high The gray value threshold update formula is as follows:
[0116] T new_low =u T_low +λ(u T_mid -u T_low )
[0117] T new_high =u T_high +λ(u T_high -u T_mid )
[0118] The iterative threshold method is based on the approximation principle. It divides the preprocessed image into three regions by setting two initial grayscale value thresholds, and then calculates the mean grayscale of these regions and averages them. This process is repeated until the mean is stable, so as to realize the characteristic value of the defects of the photovoltaic module in the target image.
[0119] Step S40 , identifying the type of defect based on the feature value of the defect extracted from the pre-processed image.
[0120] In this step, the correspondence between each defect of the photovoltaic module and the corresponding characteristic value is pre-selected and stored. After the characteristic value of the defect of the photovoltaic module in the target image is extracted through the above steps, it is compared with the pre-stored correspondence relationship to determine the specific defect corresponding to the characteristic value, thereby realizing the type identification of the defect of the photovoltaic module.
[0121] In the present invention, after preprocessing the target image of the photovoltaic module collected by the drone, the noise in the image can be removed to a certain extent, and the image contrast can be enhanced. At this time, the grid lines in the photovoltaic module are removed by Hough transform detection. Subsequently, the improved Otsu image segmentation algorithm is used to extract image defects. In order to verify the effectiveness of the present invention, the defect extraction results of the defect recognition method based on image processing of the present invention are compared with the Otsu algorithm and the adaptive threshold algorithm.
[0122] Figure 2 A comparison chart of the defect extraction results of the present invention, the Otsu algorithm, and the adaptive threshold algorithm is shown, wherein: Figure 2 The first column is the target image of the photovoltaic module collected by the drone, the second column is the effect of the defects extracted by the method of the present invention, the third column is the effect of the defects extracted by the adaptive threshold algorithm, and the fourth column is the effect of the defects extracted by the Otsu algorithm; Figure 2 In the figure, the first and second rows are occlusion-type defects, and the third and fourth rows are rupture-type defects.
[0123] like Figure 2 As shown in the first row, for occlusion-type defects, although the defects can be extracted, the Otsu algorithm and the adaptive threshold algorithm fail to completely extract the outline of the occluder. Figure 2 As shown in the second row, for small defects in the occluders, the defects can be completely extracted. Figure 2 As shown in the third and fourth rows, for large-area crack defects in photovoltaic modules, the method of the present invention can effectively extract the defect contours of the photovoltaic modules, while the adaptive threshold algorithm and Otsu algorithm fail to completely separate the background and foreground of the modules for defect extraction.
[0124] The above comparison results are quantitatively evaluated by F-measure, assuming that t p and t n For correctly reported positive and negative results, f p and f p are the incorrectly reported positive and negative results. The F-measure is calculated as follows:
[0125]
[0126] Where: p and r represent precision and recall respectively.
[0127]
[0128] Table 1 shows the F value of each method, among which the F value of the method of the present invention is the largest, indicating that the defect feature extraction of photovoltaic modules is more accurate, while maintaining a high sensitivity, and can accurately identify most defects with fewer false alarms; while a low F value indicates that the ability to identify defects is weak and the defect contour cannot be fully identified. Through the quantitative evaluation of the F value, it is further verified that the proposed improved Otsu algorithm has good applicability for the extraction of defect features of virtual photovoltaic modules.
[0129] Table 1
[0130]
[0131]
[0132] 100 visible light images of each type of defect were selected, and the virtual photovoltaic module defect images extracted by the method of the present invention, the adaptive threshold algorithm, and the Otsu algorithm were compared with the existing photovoltaic module defect database to realize the detection and identification of photovoltaic module defects in the virtual power station, as shown in Table 2. The results show that the method of the present invention can effectively extract the defect features of photovoltaic modules and compare them with the existing database with the highest accuracy.
[0133] Table 2
[0134]
[0135] In order to verify the practicality of the present invention, typical faults of photovoltaic modules were selected for image processing analysis, and the improved Otsu image segmentation algorithm was used to extract image defects. In order to verify the effectiveness of the proposed algorithm, its detection results were compared with those of the Otsu algorithm and the adaptive threshold algorithm.
[0136] Figure 3 A comparison diagram of defect extraction results of the present invention according to another embodiment and the Otsu algorithm and the adaptive threshold algorithm is shown, wherein: Figure 3 The first column is the target image of the photovoltaic module collected by the drone, the second column is the effect of the defects extracted by the method of the present invention, the third column is the effect of the defects extracted by the adaptive threshold algorithm, and the fourth column is the effect of the defects extracted by the Otsu algorithm; Figure 2 In the figure, the first and second rows are occlusion-type defects, and the third to fifth rows are rupture-type defects.
[0137] like Figure 3 As shown in the first row, for defects with small occlusion defect area, the three algorithms have good adaptability and can extract complete defect features. Figure 3 The second row blocks defects with larger defect areas. The method of the present invention can completely extract the defect contours, while the adaptive threshold algorithm and the Otsu algorithm cannot completely separate the background from the defect. Figure 3 As shown in the third to fifth rows, for the broken photovoltaic modules, the defect extraction is compared by using three algorithms. The method of the present invention can completely separate the foreground and the background, that is, it can completely identify and extract the outline of the defect, while the adaptive threshold algorithm and Otsu have poor extraction effects.
[0138] Table 3 shows the F value of each method. For the extraction of photovoltaic module defect features, the higher the F score, the more accurate the model is in identifying the defect features of photovoltaic modules, and the better the balance is in avoiding missed detection and false detection. The quantitative evaluation of the F value further verifies that the method of the present invention has good applicability for the extraction of photovoltaic module defect features collected by drones.
[0139] Table 3
[0140]
[0141] 100 visible light images of each of the two faults were selected, and the photovoltaic module defect images extracted by the method of the present invention, the adaptive threshold algorithm, and the Otsu algorithm were compared with the existing photovoltaic module defect database, realizing the detection and identification of photovoltaic module defects in photovoltaic power stations, as shown in Table 4. The results show that the method of the present invention can effectively extract the defect features of photovoltaic modules and compare them with the existing database with the highest accuracy.
[0142] Table 4
[0143]
[0144] A controller according to another embodiment of the present invention includes a memory and a processor, wherein the memory stores a computer program, and when the program is executed by the processor, the steps of the defect recognition method based on image processing described in any embodiment can be implemented.
[0145] A computer-readable storage medium according to another embodiment of the present invention is used to store a computer program, which, when executed by a computer or a processor, implements the steps of the image processing-based defect recognition method described in any embodiment.
[0146] The present invention proposes an Otsu threshold segmentation algorithm based on dual threshold iteration for extracting characteristic values of photovoltaic module defects. The preprocessing method of bilateral filtering and grayscale transformation is used to eliminate image noise interference and enhance image contrast. The influence of photovoltaic module background grid lines on defect feature extraction is eliminated by Hough transformation. The extraction of photovoltaic module defect characteristic values is completed by the proposed dual threshold iteration Otsu threshold segmentation algorithm, thereby improving the defect recognition efficiency and recognition accuracy of photovoltaic modules.
[0147] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A defect recognition method based on image processing, characterized in that: For identifying defects in a photovoltaic module, the method comprises: Preprocessing the acquired target image of the photovoltaic assembly to obtain a preprocessed image of the photovoltaic assembly; Identify and delete the grid lines of the photovoltaic module in the pre-processed image based on Hough transform; Extracting feature values of defects in the preprocessed image based on a dual-threshold iterative Otsu threshold segmentation algorithm; The type of the defect is identified based on the feature value of the defect extracted from the pre-processed image.
2. The defect recognition method based on image processing according to claim 1, characterized in that: The step of preprocessing the acquired initial image of the photovoltaic assembly to obtain a preprocessed image of the photovoltaic assembly includes: Performing grayscale processing on the acquired target image to obtain a grayscale image of the target image; removing noise from the grayscale image based on bilateral filtering; A grayscale linear transformation algorithm is used to perform image enhancement on the grayscale image from which noise has been removed, so as to obtain the preprocessed image.
3. The defect recognition method based on image processing according to claim 2, characterized in that: The weighted value method is used to perform grayscale processing on the target image. The formula of the weighted value method is as follows: gray=0.299*R+0.578*G+0.114*B.
4. The defect recognition method based on image processing according to claim 2, characterized in that: The formula for the bilateral filtering is as follows: In the above formula, g(i, j) is the output pixel value of the output grayscale image, and f(k, l) is the input point; Where w(i, j, k, l) = w s (i, j, k, l)×w r (i, j, k, l), where w s (i, j, k, l) is used to calculate the spatial proximity between each pixel of the grayscale image and the central pixel, w r (i, j, k, l) is used to calculate the similarity of the pixel values of each pixel point of the grayscale image and the central pixel point; in, 5. The defect recognition method based on image processing according to claim 2, characterized in that: The formula of the grayscale linear transformation algorithm is as follows: T B =g(T A )=K*T A +b; In the above formula, K represents the transformation slope, T represents the grayscale value of the input grayscale image, and b is the intercept of the transformation on the y-axis. Different K and b values will produce output images with different visual effects.
6. The defect recognition method based on image processing according to claim 1, characterized in that: The step of identifying and deleting the grid lines of the photovoltaic module in the pre-processed image based on Hough transform includes: In a polar coordinate system, plotting each point in the preprocessed image into a sine curve; When the plurality of sinusoidal curves intersect at one point, it is determined that the plurality of points corresponding to the plurality of sinusoidal curves are located on the same straight line; When the number of multiple points on the same straight line reaches a preset threshold, the points on the straight line are traversed and white pixels in the neighborhood of each point are removed to delete the grid line.
7. The defect recognition method based on image processing according to claim 1, characterized in that: The step of extracting the characteristic value of the defect in the preprocessed image based on the dual-threshold iterative Otsu threshold segmentation algorithm comprises: Setting two gray value thresholds to divide the gray value of the preprocessed image into three gray value intervals; Calculating the area ratio and grayscale value of each grayscale interval in the preprocessed image; Calculate the grayscale average value of each grayscale interval based on the area ratio and the grayscale value; The two grayscale value thresholds are adjusted according to the size relationship of the grayscale average values until the grayscale average values are the same, and the characteristic value of the defect is extracted.
8. The defect recognition method based on image processing according to claim 7, characterized in that: The formula for calculating the area ratio of each grayscale interval in the preprocessed image is as follows: Among them, P low Indicates that the gray value of pixel i is less than or equal to T low The probability, P mid Indicates that the gray value of pixel i is greater than T low and less than T high The probability between high Indicates that the gray value of pixel i is greater than T high probability; The formula for calculating the grayscale value of each grayscale interval in the preprocessed image is as follows: The formula for calculating the grayscale average value of each grayscale interval is as follows:
9. A controller comprising a memory and a processor, wherein the memory stores a computer program, and when the program is executed by the processor, the steps of the method described in any one of claims 1 to 8 can be implemented.
10. A computer-readable storage medium for storing a computer program, which, when executed by a computer or a processor, implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image binarization method based on deep learning semantic segmentation
CN112330705A
Photovoltaic cell defect online detection method and system based on machine vision
CN113834816A
PCB production process online detection method based on edge detection
CN115272346A
Surface crack detection method based on image processing
CN117974627A