A method for adaptive correction and defect feature enhancement of an EL image of a photovoltaic module

CN123015492APending Publication Date: 2026-10-30HOHAI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611232772.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-14
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0007]发明目的:本发明的目的在于提供一种光伏组件EL图像自适应校正与缺陷特征增强方法,以解决复杂背景下组件区域提取不稳定、透视畸变及残余旋转导致网格定位偏移、图像坐标与电池片结构坐标缺乏对应关系,以及隐裂、黑斑和黑片等低对比度缺陷不易辨识的问题

Benefits of technology

[0076](1)通过多阈值最大类间方差目标与AW-GNPSO阈值搜索相结合,利用动态惯性权重、广义正态优化和小波变异协同改善多峰阈值空间中的全局搜索与局部开发能力,有助于提高复杂背景下组件区域提取的稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015492A_ABST
    Figure CN123015492A_ABST
Patent Text Reader

Abstract

The application discloses a photovoltaic module EL image adaptive correction and defect feature enhancement method, which comprises the following steps: firstly, carrying out multi-threshold segmentation and morphological optimization based on an improved particle swarm optimization algorithm on an original photovoltaic module EL image to obtain a binary mask image; secondly, extracting a photovoltaic module region according to the binary mask, and carrying out perspective correction and residual rotation correction on trapezoidal deformation and inclination of the module image to obtain a standardized module EL image; thirdly, restoring a cell grid and dividing the region; and fourthly, carrying out contrast-limited adaptive histogram equalization processing on the weak defect texture gray difference and local brightness unevenness in each cell region, and reorganizing according to the original grid position to obtain a defect feature enhanced standardized module EL image. The application can maintain the spatial structure of the cell, enhance the local gray difference between the abnormal region and the normal region, improve the recognizability of the defect features of the photovoltaic module EL image, and provide a stable image basis for subsequent defect analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of photovoltaic module inspection and image processing technology, and particularly relates to an adaptive correction and defect feature enhancement method for electroluminescence (EL) images of photovoltaic modules. Background Technology

[0002] During manufacturing, transportation, installation, and operation, photovoltaic modules may develop internal anomalies such as microcracks, black spots, and black patches. Because these anomalies alter the carrier recombination state and electrical transport characteristics within the cells, they typically appear in electroluminescence (EL) images as fine linear dark lines, irregular dark areas, or entire low-brightness regions. Therefore, local grayscale and texture information in EL images are crucial for module quality analysis.

[0003] Under conditions of on-site acquisition using drones, tripod cameras, etc., raw photovoltaic module EL images are often affected by complex backgrounds, uneven local brightness, boundary grayscale transitions, and changes in shooting posture. Complex backgrounds reduce the grayscale separability of the module from the surrounding area, leading to region missing or false foreground in fixed threshold or single threshold segmentation; changes in shooting angle introduce perspective distortion, and even after correction, residual tilt may still exist, causing the main direction of the grid to deviate from the image coordinate axis, resulting in problems such as incomplete module extraction, grid line positioning offset, and unclear defect features.

[0004] Existing component region extraction methods have limited adaptability to grayscale variations in different acquisition scenarios; deep network-based segmentation methods also require a large number of labeled samples and computational resources. When traditional particle swarm optimization algorithms are used for multi-threshold combination searches, the decrease in population diversity may cause particles to prematurely aggregate in locally superior regions, affecting the integrity and stability of binary mask images against complex backgrounds.

[0005] Existing geometric correction and mesh positioning methods typically rely on local edges or preset row and column numbers in the original image. When hidden cracks, fine grid lines, missing edges, or local low-brightness areas coexist, local edges are easily confused with the main boundaries of components or mesh dividing lines; furthermore, without further establishing the mapping relationship between image coordinates, mesh row and column positions, and cell numbers, it is difficult to form a stable spatial reference structure for cells.

[0006] Furthermore, microcracks typically only form thin, weak grayscale variations, while dark spots appear as localized low-brightness textures, and black patches appear as large-scale low-brightness areas. Directly applying global histogram equalization to the entire module image is easily affected by differences in brightness distribution among different cells and may simultaneously amplify background, border, and grid line interference. Conversely, independently enhancing only local areas without addressing sub-block boundaries can easily lead to blocky grayscale abrupt changes. Therefore, a method is needed that combines adaptive extraction of module regions, geometric normalization, grid space establishment, and cell-level local contrast enhancement to improve the identifiability of defect areas while preserving defect morphology and spatial location. Summary of the Invention

[0007] Purpose of the invention: The purpose of this invention is to provide an adaptive correction and defect feature enhancement method for photovoltaic module EL images, in order to solve the problems of unstable module region extraction under complex backgrounds, perspective distortion and residual rotation causing grid positioning offset, lack of correspondence between image coordinates and cell structure coordinates, and difficulty in identifying low-contrast defects such as hidden cracks, black spots and black patches.

[0008] Technical solution: The present invention provides a method for adaptive correction and defect feature enhancement of photovoltaic module EL images, comprising the following steps:

[0009] Step 1: Acquire the original photovoltaic module EL image and perform multi-threshold segmentation based on the improved particle swarm optimization algorithm AW-GNPSO. Then, perform morphological optimization on the segmentation results to obtain a binary mask image used to mark the photovoltaic module region.

[0010] Step 2: Extract the photovoltaic module region from the original photovoltaic module EL image based on the binary mask image, perform perspective correction on the trapezoidal deformation of the photovoltaic module region, and perform residual rotation correction on the overall tilt of the perspective-corrected photovoltaic module EL image to obtain a standardized module EL image.

[0011] Step 3: Perform cell grid positioning on the standardized component EL image, determine each cell region and its cell number, establish the mapping relationship between image coordinates, grid row and column positions and cell numbers, and construct a cell spatial reference structure based on horizontal dividing lines, vertical dividing lines, each cell region and its grid row and column positions.

[0012] Step 4: For the thin, weak grayscale variations of the hidden cracks, the local low-brightness texture of the black spots, and the large low-brightness areas of the black patches, extract each cell region according to the cell spatial reference structure. Perform block-contrast-limited adaptive histogram equalization on each cell region, including grayscale histogram limiting, over-limit pixel redistribution, grayscale mapping, and interpolation of adjacent sub-blocks. Reorganize the enhanced cell regions according to the original grid positions to obtain a defect-enhanced normalized component EL image that strengthens the local grayscale differences between the defect area and the normal area while maintaining the spatial positional relationship of the cells.

[0013] Furthermore, in step 1, the multi-threshold segmentation specifically involves:

[0014] The EL images of photovoltaic modules are converted to grayscale, and the grayscale histogram is statistically analyzed.

[0015] A multi-threshold segmentation fitness function is constructed based on the maximum inter-class variance criterion. The threshold combination, the class probability and average gray level of each gray-level region, and the global average gray level of the entire image are all represented by the corresponding variables in the following formula. The fitness function and the optimal threshold combination are as follows:

[0016]

[0017]

[0018] In the formula, t represents the segmentation threshold arranged in ascending order of gray levels, k represents the total number of gray-level regions after segmentation, and j represents the sequence number of the gray-level regions; ω j μ represents the class probability of the corresponding grayscale region. j σ represents the average gray level of the corresponding gray area, where μ without a region number represents the global average gray level of the entire image; B 2 This represents the inter-class variance, with the superscript * indicating the optimal value.

[0019] An improved particle swarm optimization algorithm is used to search for the optimal combination of thresholds that enable the fitness function.

[0020] The electroluminescent image of the photovoltaic module is divided into multiple grayscale regions based on the threshold combination;

[0021] The background region is designated as the background category, and the remaining target regions are merged into the foreground category to obtain the initial binary mask image.

[0022] Furthermore, in step 1, the improved particle swarm optimization algorithm AW-GNPSO is used to search for the optimal threshold combination for the multi-threshold segmentation fitness function, specifically as follows:

[0023] Candidate multi-threshold combinations are encoded as particle positions, initializing the position and velocity of the particle population, and updating the particle velocity and position according to dynamic inertia weights. The dynamic inertia weights are adjusted based on the ratio of the current function evaluation count to the maximum function evaluation count, and are superimposed with a stochastic adjustment amount generated by the Logistic chaotic mapping. The maximum inertia weight, minimum inertia weight, and other control parameters are limited by the following formula:

[0024]

[0025] In the formula, ω on the left side of the formula t The dynamic inertia weights represent the current iteration stage; FEs represent the current function evaluation count, and the denominator of the fraction represents the maximum function evaluation count; ω max and ω min These represent the maximum and minimum inertia weights, respectively; r L u represents the stochastic adjustment produced by the Logistic chaotic mapping. ω v ω This represents the control coefficient; max_nfe represents the maximum number of function evaluations.

[0026] After the particle position is updated, different particles are selected from the particle population. Based on the comparison results of the individual particles' historical best fitness, the first difference direction and the second difference direction are constructed. Combined with two sets of Gaussian random variables that follow a standard normal distribution and random weights with values ​​in the interval [0,1], the generalized normal optimization candidate positions are generated according to the following formula:

[0027]

[0028] In the formula, x i Let x represent the current position of the i-th particle. i gndo The subscript 'i' represents the particle candidate position generated by the generalized normal distribution optimization, the subscript 'i' represents the particle number, and the superscript 'gndo' indicates that it is generated by the generalized normal distribution optimization; β represents the random weight with a value in the interval [0,1]; l1 and l2 represent two sets of random variables that follow the standard normal distribution; d1 and d2 represent the first difference direction and the second difference direction, respectively.

[0029] Based on the decreasing mutation probability during iteration, wavelet mutation is performed on the particle to generate multi-scale local perturbations in the particle's neighborhood; a wavelet perturbation factor δ is constructed using the scale parameter a and the random variable ξ, and wavelet mutation candidate positions are generated according to the sign of δ. The wavelet perturbation factor and wavelet mutation candidate positions are as follows:

[0030]

[0031]

[0032] In the formula, δ represents the wavelet perturbation factor, a represents the scaling parameter that changes with the iteration process, and ξ represents the random variable; x i wave The subscript 'i' represents the particle position, the subscript 'i' represents the particle number, and the superscript 'wave' represents the wavelet mutation candidate position. When δ is greater than 0, the perturbation moves towards the normalization upper bound; when δ is less than or equal to 0, the perturbation is proportional to the current position.

[0033] The fitness of candidate positions obtained by particle position update, generalized normal optimization and wavelet mutation is compared. Positions with high fitness are retained and individual optimal positions and global optimal positions are updated until the iteration termination condition is met. The threshold combination corresponding to the global optimal position is used as a multi-threshold combination.

[0034] Furthermore, in step 1, the morphological optimization specifically includes:

[0035] Connectivity analysis is performed on the initial binary mask image obtained by multi-threshold segmentation to remove small connected regions with an area smaller than a preset minimum area threshold.

[0036] The initial binary mask image after removing small connected regions is sequentially subjected to opening and closing operations to remove protruding structures on the component outline, smooth component boundaries, fill edge depressions, and connect adjacent regions with gaps. Let the binary mask to be processed be B and the structuring element be S, then the opening operation is... The closing operation is ,in Indicates corrosion. Indicates expansion;

[0037] Hole filling is performed on the binary mask image obtained by the closing operation, and connected component analysis is performed on the binary mask image obtained by hole filling. The connected component with the largest area is retained to obtain the binary mask image used to mark the photovoltaic module area.

[0038] Furthermore, in step 2, the perspective correction specifically includes:

[0039] The outline of the photovoltaic module is extracted from the binary mask image. Straight lines are fitted to the four sides of the outline of the photovoltaic module. The intersection of adjacent fitted lines is calculated to recover the four corner points of the photovoltaic module. The four corner points of the photovoltaic module are arranged in the order of top left, top right, bottom right and bottom left.

[0040] Calculate the lengths of the top and bottom sides, as well as the left and right sides of the quadrilateral region of the photovoltaic module, respectively, and determine the width and height of the target rectangle based on the larger of the two relative sides;

[0041] A 3×3 homography matrix is ​​calculated based on the correspondence between the four corner points of the sorted photovoltaic module and the vertices of the target rectangle. This homography matrix is ​​then used to perform a perspective transformation on the original photovoltaic module EL image, mapping the quadrilateral region of the photovoltaic module to a regular rectangular module region. Both the source image points and the target plane points are represented using homogeneous coordinates and satisfy the following conditions:

[0042]

[0043] In the formula, H represents the 3×3 homography matrix obtained from four sets of corresponding points; x and y represent the coordinates of the source image points, u and v represent the coordinates of the target plane points; and λ represents the homogeneous scaling factor.

[0044] Furthermore, in step 2, the residual rotation correction specifically includes:

[0045] The perspective-corrected photovoltaic module EL image is subjected to local contrast enhancement, smoothing filtering and edge extraction in sequence. The resulting edge image is then subjected to Hough line detection to obtain candidate lines.

[0046] Assuming any candidate line is defined by two endpoints, calculate the direction angle and weight based on the line length of the candidate line according to the following formula; filter candidate lines that are close to the horizontal or vertical direction, and convert the filtered candidate lines into deviation angles relative to the corresponding ideal horizontal or vertical direction:

[0047]

[0048] In the formula, φ represents the direction angle of the candidate line; x1, y1 and x2, y2 represent the coordinates of the two endpoints, respectively; ω i This indicates the length weight of the candidate line, and the subscript i indicates the candidate line number.

[0049] The residual rotation angle is obtained by weighting the median of each deviation angle with length weight. The perspective-corrected photovoltaic module EL image is then rotated in the opposite direction to the residual rotation angle to obtain the standardized module EL image.

[0050] Furthermore, in step 3, performing cell grid positioning on the standardized component EL image to determine each cell region and its cell number specifically involves: performing lateral and longitudinal directional enhancement on the standardized component EL image; assuming the standardized component EL image is... Using lateral directional convolution kernels and vertical directional convolution kernel The standardized component EL images are convolved to obtain laterally enhanced images. and vertically enhanced images The formula for its calculation is:

[0051]

[0052]

[0053] The Sobel operator is used to calculate the vertically enhanced images respectively. The lateral gradient response and the lateral enhancement image The longitudinal gradient response, the horizontal convolution kernel of the Sobel operator. and vertical convolution kernel They are respectively:

[0054]

[0055]

[0056] Based on the horizontal convolution kernel and vertical convolution kernel Calculate the transverse gradient response respectively and longitudinal gradient response :

[0057]

[0058]

[0059] In the formula, Represents a standardized component EL image; and These represent the horizontal directional convolution kernel and the vertical directional convolution kernel, respectively. and These represent horizontally enhanced images and vertically enhanced images, respectively. and These represent the horizontal and vertical convolution kernels of the Sobel operator, respectively. and These represent the transverse gradient response and the longitudinal gradient response, respectively; symbols Represents a two-dimensional convolution operation; symbol This indicates taking the absolute value of the convolution result pixel by pixel;

[0060] Construct horizontal and vertical candidate line response maps based on gradient responses; perform closing operations and small-area connected component removal on the candidate line response maps; construct one-dimensional projection signals along the row and column directions respectively;

[0061] The one-dimensional projection signal is smoothed, the grid period is estimated by the autocorrelation result of the one-dimensional projection signal, the peak detection threshold is set based on the median absolute deviation, and the candidate grid line positions are extracted.

[0062] Based on the candidate grid line positions and the grid period, equal-spacing grid fitting is performed, and compensation is made for cases of missing boundaries, merging of adjacent peaks, or insufficient candidate lines to obtain the set of horizontal dividing lines, the set of vertical dividing lines, the number of module rows, and the number of module columns; the area enclosed by adjacent horizontal dividing lines and adjacent vertical dividing lines is determined as the cell area.

[0063] Furthermore, in step 3, establishing the mapping relationship between image coordinates, grid row and column positions, and battery cell numbers specifically involves: determining the grid row and column positions of each battery cell region based on the horizontal and vertical dividing lines obtained from the battery cell grid positioning; assigning battery cell numbers to each battery cell region according to the grid row and column positions; and establishing a mapping function M(x,y) between image coordinates and battery cell grid row and column positions. Let the set of vertical dividing lines be X and the set of horizontal dividing lines be Y. For any pixel coordinate (x,y) located between adjacent dividing lines, the mapping relationship is:

[0064]

[0065]

[0066] In the formula, X and Y represent the set of vertical dividing lines and the set of horizontal dividing lines, respectively; x c x c+1 Represents the coordinates of adjacent vertical dividing lines, y r y r+1 The coordinates of adjacent horizontal dividing lines are represented by C and R, which represent the number of columns and rows of the component, respectively; c and r represent the column number and row number of the cell where the pixel is located, respectively; M represents the mapping function from the pixel coordinates to the row and column positions of the cell grid.

[0067] Furthermore, step 4 specifically involves: Defect feature enhancement targeting the fine, weak grayscale variations of hidden cracks, the localized low-brightness texture of black spots, and the large-area low-brightness regions of black patches, including:

[0068] Based on the horizontal and vertical dividing lines in the cell spatial reference structure, each cell region is extracted from the standardized module EL image, and each cell region is divided into multiple local sub-blocks. The grayscale distribution of each local sub-block is then statistically analyzed.

[0069] Calculate the grayscale histogram of each local sub-block, and perform amplitude limiting processing on the grayscale histogram according to a preset amplitude limiting threshold. The number of pixels exceeding the amplitude limiting threshold is redistributed to each grayscale level, and a grayscale mapping relationship for each local sub-block is constructed based on the redistributed grayscale histogram to improve the contrast between weak grayscale defects and local normal areas. The criteria for determining the amplitude limiting threshold are as follows:

[0070]

[0071] Where α is the preset limiting coefficient, N b L represents the total number of pixels in the local sub-block, and L represents the number of gray levels.

[0072] For any pixel, bilinear interpolation is performed based on the grayscale mapping relationship of its adjacent local sub-blocks to obtain the battery cell area with enhanced local contrast, so as to continuously enhance the grayscale difference between the hidden crack dark line, the local dark area of ​​the black spot and the low brightness area of ​​the black film and its neighboring normal area.

[0073] After enhancing the local contrast of each cell region, they are reorganized according to the corresponding horizontal and vertical dividing lines, preserving the spatial arrangement, defect morphology, and defect location of each cell region. This results in a defect-feature-enhanced standardized module EL image with improved local contrast and identifiability of defect areas.

[0074] The present invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of the present invention.

[0075] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:

[0076] (1) By combining the multi-threshold maximum inter-class variance objective with AW-GNPSO threshold search, dynamic inertial weights, generalized normal optimization and wavelet mutation are used to improve the global search and local exploitation capabilities in the multi-peak threshold space, which helps to improve the stability of component region extraction in complex backgrounds.

[0077] (2) The overall quadrilateral structure and four corner points are recovered by using the binary mask image of the component, and the homography perspective transformation is combined with the residual rotation correction based on the weighted median of line length. This can reduce the influence of local texture, defect dark lines and short pseudo-line segments on the estimation of the main direction of the component, and form a standardized component EL image suitable for grid positioning.

[0078] (3) The complete grid is restored by directionality enhancement, gradient response, projection statistics, autocorrelation period estimation, median absolute deviation threshold and equal spacing fitting, and the mapping relationship between pixel coordinates, grid row and column positions and cell number is established to provide a unified cell spatial reference structure for defect enhancement and subsequent defect localization.

[0079] (4) The block contrast-limited adaptive histogram equalization is performed with a single cell area as the processing unit. It can adapt to the local gray distribution of each cell and suppress excessive noise amplification by histogram limiting and reduce block boundary abrupt changes by interpolation of adjacent sub-blocks, thereby continuously strengthening the gray difference between the hidden crack dark line, the local dark area of ​​black spot and the low brightness area of ​​black film and the normal area in its neighborhood.

[0080] (5) The enhanced cell area is reorganized according to the original grid position, preserving the spatial arrangement of the cells, defect morphology and defect position, so that the output image has geometric normalization, spatial traceability and defect feature enhancement attributes, which facilitates subsequent manual review or defect detection processing. Attached Figure Description

[0081] Figure 1 This is a schematic diagram of the overall process of the photovoltaic module EL image adaptive correction and defect feature enhancement method in Embodiment 1 of the present invention;

[0082] Figure 2 This is a schematic diagram of the multi-threshold image segmentation process based on maximum inter-class variance in Embodiment 1 of the present invention;

[0083] Figure 3 This is a schematic diagram of the AW-GNPSO algorithm in Embodiment 1 of the present invention, wherein the AW-GNPSO algorithm includes particle swarm optimization, dynamic inertia weight, generalized normal optimization and mutation strategy based on wavelet basis function;

[0084] Figure 4 This is a schematic diagram of the morphological mask optimization process in Embodiment 1 of the present invention;

[0085] Figure 5 This is a schematic diagram of the process for restoring the four corner points, perspective correction, and residual rotation correction of the photovoltaic module EL image in Embodiment 1 of the present invention;

[0086] Figure 6 This is a schematic diagram of the battery cell grid positioning and compensation recovery process in Embodiment 1 of the present invention, wherein (a) is a standardized component image, (b) is the result of lateral and longitudinal directionality enhancement, (c) is the row and column projection signal, (d) is the result of autocorrelation estimation of grid period, (e) is the result of candidate grid line detection, and (f) is the result of missing line compensation and complete grid recovery.

[0087] Figure 7 This illustrates the mapping relationship between pixel coordinates and battery cell grid positions in Embodiment 1 of the present invention.

[0088] Figure 8 This is a schematic diagram showing the typical morphology and annotation of defects such as microcracks, black spots, and black sheets in photovoltaic modules in EL images according to Embodiment 1 of the present invention;

[0089] Figure 9This is a schematic diagram of the process for enhancing the defect features of the module's battery cells and reassembling them in situ in Embodiment 1 of the present invention. Detailed Implementation

[0090] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0091] In this invention, the EL image refers to the electroluminescent image of a photovoltaic module that generates near-infrared radiation under forward bias conditions and is recorded by an imaging device; the binary mask image is used to mark the photovoltaic module area with binary pixels; the standardized module EL image refers to the image in which the main body of the module is a regular rectangle and the main grid direction is basically consistent with the image coordinate axis after the module area extraction, perspective correction and residual rotation correction are completed; the cell spatial reference structure refers to the data structure composed of the set of horizontal dividing lines, the set of vertical dividing lines, the number of module rows and columns, the cell area bounding box and the mapping relationship from pixel coordinates to cell row and column positions.

[0092] Example 1

[0093] like Figure 1 As shown, this embodiment provides a method for adaptive correction and defect feature enhancement of photovoltaic module EL images. The input is an original EL image containing the photovoltaic module and its surrounding background, and the output is a normalized module EL image with enhanced defect features, specifically including steps S1 to S4.

[0094] Step S1: Component region segmentation and binary mask construction.

[0095] S11, Read the original photovoltaic module EL image; when the input is a color or multi-channel image, convert it to a grayscale image I, and count the number of pixels and the grayscale histogram within the grayscale range. Assuming the image has L grayscale levels, select k-1 increasing thresholds to divide the image into k grayscale regions. Figure 2 The principle of multi-threshold segmentation based on maximum inter-class variance is shown.

[0096] S12, for the j-th gray-level region, calculate the class probability and average gray-level of that region, and calculate the global average gray-level of the entire image. Using the weighted sum of squared deviations of each gray-level region relative to the global average gray-level as the inter-class variance, the multi-threshold segmentation fitness function is:

[0097] (1)

[0098] In equation (1), t represents the segmentation threshold arranged in ascending order of gray levels, k represents the total number of gray-level regions after segmentation, and j represents the gray-level region index; ω j μ represents the class probability of the j-th grayscale region. j Let μ represent the average gray level of the j-th gray-level region, μ represent the global average gray level of the entire image, and σ represent the average gray level of the j-th gray-level region.B 2 This represents the inter-class variance. The larger the inter-class variance, the more significant the statistical difference between adjacent gray-level regions.

[0099] S13, therefore, the threshold combination that maximizes the inter-class variance is determined as the optimal threshold combination:

[0100] (2)

[0101] In equation (2), t * represents the optimal value of the corresponding segmentation threshold, and arg max represents the threshold combination that maximizes the fitness function. The candidate threshold combination is encoded as the position vector of the particle, and the inter-class variance of equation (1) is used as the particle fitness. The optimal threshold combination shown in equation (2) is searched by the AW-GNPSO algorithm.

[0102] S14, the AW-GNPSO algorithm flow is as follows: Figure 3 As shown, first, the population size, maximum function evaluation count, threshold dimension, and threshold value boundaries are set. The position and velocity of each particle are initialized using a uniform random distribution. The thresholds in each particle are sorted in ascending order of gray level, and boundary constraints are applied to components that exceed the gray level range.

[0103] S15, update the particle velocity and position based on the particle's current position, its individual historical best position, and its global best position; where c1 and c2 are the individual learning factor and the social learning factor, respectively, and ρ1 and ρ2 are random vectors in the interval [0, 1]. A dynamic inertia weight is used to adjust the global search and local development; the dynamic inertia weight is:

[0104] (3)

[0105] In equation (3), ω on the left side of the equation t The dynamic inertia weights represent the current iteration stage; FEs represent the current function evaluation count, max nfe ω represents the maximum number of function evaluations; max and ω min represents the maximum and minimum inertia weights, respectively; r represents the stochastic adjustment generated by the Logistic chaotic mapping, and u and v represent the control coefficients. As the function evaluation progresses, the basic inertia term gradually changes, while the chaotic adjustment is used to reduce the rigidity of the search pattern.

[0106] S16, after completing the particle swarm position update, select different particles from the population, construct the first difference direction d1 and the second difference direction d2 based on the comparison results of the individual's historical best fitness, and generate generalized normal optimization candidate positions:

[0107] (4)

[0108] In equation (4), x i gndo The candidate particle position is represented by the subscript i, which indicates the particle index, and the superscript gndo indicates that it is generated by generalized normal optimization; β represents the random weights with values ​​in the interval [0,1]; l1 and l2 represent two sets of Gaussian random variables that follow a standard normal distribution; d1 and d2 represent the first and second difference directions, respectively. If the fitness of the candidate position is better than that of the current position, the current particle is updated with the candidate position.

[0109] S17, after generalized normal optimization, perform wavelet mutation on the particles according to the mutation probability that decreases with the iteration process. Construct the wavelet perturbation factor using the scale parameter a and the random variable ξ:

[0110] (5)

[0111] Candidate positions for wavelet mutations are generated based on the sign of the wavelet perturbation factor:

[0112] (6)

[0113] In equations (5) and (6), δ represents the wavelet perturbation factor, a represents the scaling parameter that changes with the iteration process, and ξ represents the random variable; i wave The value represents the particle position, with the subscript 'i' indicating the particle number and the superscript 'wave' indicating the candidate position for wavelet mutation. When δ is greater than 0, the particle is perturbed towards the normalized upper bound; when δ is less than or equal to 0, it is perturbed proportionally to its current position.

[0114] S18 compares the fitness of candidate positions obtained from particle position updates, generalized normal optimization, and wavelet mutation, retains the better positions, and updates the individual optimal position and the global optimal position until the maximum number of function evaluations or other termination conditions are met.

[0115] S19: The grayscale image is segmented according to the obtained optimal threshold combination. The background region with the lowest grayscale is recorded as the background category and assigned a value of 0. The remaining target regions are merged into the foreground category and assigned a value of 1, forming an initial binary mask. Connectivity analysis is performed on the initial binary mask to remove small connected regions with an area smaller than the preset minimum area threshold. Then, opening, closing, and hole filling operations are performed in sequence. The opening operation is used to remove contour burrs and smooth the boundaries, the closing operation is used to fill edge depressions and connect small gaps, and the hole filling operation is used to complete the internal area of ​​the component. Finally, the connected region with the largest area is retained to obtain the binary mask image used to mark the photovoltaic module area. Figure 4 The process of morphological optimization and its function are illustrated.

[0116] Step S2: Component region extraction and adaptive geometric correction.

[0117] S21, multiply the binary mask obtained in step S1 with the original EL image or crop the original EL image by the mask boundary to obtain the candidate region of the photovoltaic module. Extract the outer contour of the module based on the binary mask, perform straight line fitting on the top, right, bottom and left sides of the outer contour respectively, and calculate the intersection of adjacent fitted lines to recover the four corner points of the module.

[0118] S22: Sort the four corner points according to their coordinates and the difference between them, so that they correspond to the top left, top right, bottom right, and bottom left vertices in sequence. Calculate the lengths of the top and bottom sides of the quadrilateral, as well as the lengths of the left and right sides, respectively. Use the larger of the two relative lengths to determine the width and height of the target rectangle, thereby reducing the underestimation of the target size caused by perspective shrinkage.

[0119] S23, establish the correspondence between the four corner points of the sorted components and the four vertices of the target rectangle, and solve for the 3×3 homography matrix H from the source image plane to the target rectangle plane. The source image points and target plane points are represented using homogeneous coordinates and satisfy the following:

[0120] (7)

[0121] In equation (7), H represents the 3×3 homography matrix obtained from four sets of non-collinear corresponding points; x and y represent the coordinates of the source image points, u and v represent the coordinates of the target plane points; λ represents the non-zero homogeneous scale factor, and the superscript... T This represents the matrix transpose. The homography matrix is ​​used to perform perspective transformation and resampling on the original component region, mapping the quadrilateral component region to a regular rectangular component region.

[0122] S24. To eliminate the small-angle overall tilt remaining after perspective correction, contrast-limited adaptive histogram equalization is first used to improve local brightness unevenness, then Gaussian filtering is used to suppress high-frequency noise, Canny operator is used to extract edges, and Hough line detection is performed on the edge image to obtain candidate line segments.

[0123] Suppose the i-th candidate line is determined by its two endpoints. Calculate the direction angle of this candidate line and its weight based on the line length:

[0124] (8)

[0125] In equation (8), φ i ω represents the direction angle of the candidate line; x1, y1 and x2, y2 represent the coordinates of the two endpoints respectively; i This represents the length weight of the i-th candidate line. The direction angle is mapped to the range [-90°, 90°], retaining |φ. i|<20° near-horizontal line segment and ||φ i A near-vertical line segment |−90°|<20° is converted into a deviation angle relative to the corresponding horizontal or vertical ideal direction.

[0126] S25, arranged in ascending order of deviation angle, uses the deviation angle corresponding to the cumulative value of the candidate line length weights reaching half of the total weight as the weighted median, thus obtaining the residual rotation angle. The perspective-corrected component image is rotated in the opposite direction to the residual rotation angle; to avoid edge clipping during rotation, boundary padding can be applied around the image before rotation, and bicubic interpolation can be used to complete rotation resampling to obtain the standardized component EL image. Figure 5 The process of restoring the four corner points, perspective correction, and residual rotation correction of the EL image of a photovoltaic module is shown.

[0127] Step S3: Cell grid positioning and spatial reference structure establishment.

[0128] S31, the standardized component EL image is smoothed laterally and longitudinally to preserve the structural response consistent with the direction of the segmentation line to be detected, and to suppress fine grid lines, local defect textures, and noise interference; the Sobel operator is used to calculate the lateral gradient response G. x and longitudinal gradient response G y Based on the statistical quantiles of each gradient response, a response threshold is set, and a transverse candidate line response map B is constructed. x And vertical candidate line response map B y .

[0129] S32, using a linear structuring element aligned with the direction of the dividing line to be connected, performs a closing operation on the candidate line response map, connecting broken responses and removing small-area connected components; B x The projection p, representing the position of the longitudinal dividing line, is formed by accumulating along the row direction. x B y The projection p, representing the row position of the horizontal dividing line, is formed by accumulating along the column direction. y The projection signal is smoothed using a moving average.

[0130] S33: Calculate the autocorrelation sequence of the smoothed one-dimensional projection signal. After excluding zero-delay peaks, use the main peak position within a preset period range as the initial grid period. Calculate the median and median absolute deviation of the projection signal, construct a peak detection threshold based on these two values, and extract candidate grid line positions. Construct a fitting evaluation metric using the distance between the candidate line positions and the equally spaced model, the number of candidate lines, and the projection response intensity to determine the complete set of horizontal and vertical dividing lines, the number of component rows, and the number of component columns.

[0131] S34: When boundary dividing lines are missing, they are filled out by pushing outwards towards the component edge according to the initial grid period; when the distance between adjacent candidate peaks is less than the preset merging threshold, neighboring peaks are merged according to the projected response or weighted position; when the number of candidate lines is insufficient, equidistant compensation is performed using the fitted grid period. The rectangular area enclosed by adjacent horizontal dividing lines and adjacent vertical dividing lines determines the region of each cell, and the corresponding bounding box is generated. Figure 6 The process of cell grid positioning and compensation restoration for standardized component EL images is shown.

[0132] S35, Let the set of vertical dividing lines be X, and the set of horizontal dividing lines be Y:

[0133] (9)

[0134] For any pixel coordinate located between adjacent vertical dividing lines and adjacent horizontal dividing lines, the mapping relationship to the row and column positions of the battery cell grid is as follows:

[0135] (10)

[0136] In equations (9) and (10), X and Y represent the set of vertical dividing lines and the set of horizontal dividing lines, respectively; x and y represent the horizontal and vertical coordinates of pixels, respectively. c x c+1 Represents the coordinates of adjacent vertical dividing lines, y r y r+1 The coordinates of adjacent horizontal dividing lines are represented; C and R represent the number of columns and rows of the component, respectively; c and r represent the column number and row number of the cell where the pixel is located, respectively; M represents the mapping function from the pixel coordinates to the cell grid row and column positions. In specific implementation, each interval can be set as a left-closed and right-open interval, and the last row and last column can include the lower and right boundaries of the component to determine the pixel belonging to the grid line; according to row priority, the cell number in the r-th row and c-th column can be set to (r-1)C+c, or other unique numbering order can be preset according to the component wiring direction. The above set of dividing lines, number of rows and columns, bounding box, mapping function and cell number together form the cell spatial reference structure. Figure 7 The mapping relationship between pixel coordinates and cell grid positions is shown.

[0137] Step S4: Enhancement of cell-level defect features and spatial reorganization.

[0138] In S41 and EL images, hidden cracks often appear as thin, elongated dark lines or irregular linear shadows; black spots often appear as dot-like, clustered, or patchy localized irregular dark areas; and black patches often appear as the entire battery cell or a large area of ​​it becoming noticeably black. Figure 8The typical morphology of various defects in photovoltaic modules in EL images is shown. Since the reference brightness and grayscale range of different cells may be different, this step uses the individual cell region determined in step S3 as an independent enhancement unit, instead of directly performing a uniform global histogram equalization on the entire module image.

[0139] S42, based on the horizontal and vertical dividing lines in the cell spatial reference structure, cell regions are extracted one by one from the standardized component EL image. Each cell region is divided into m×n local sub-blocks; m and n can be determined according to the size of the cell region, ensuring that each sub-block contains enough pixels to reflect the local grayscale distribution, while allowing variations in brightness of hidden cracks, dark spots, or black patches to span one or more adjacent sub-blocks. In one implementation, the cell region can be divided into an 8×8 sub-block grid; when the cell region size is not divisible by the number of sub-blocks, the margin is allocated to boundary sub-blocks or boundary extension is used to ensure complete coverage.

[0140] S43: For each local sub-block, the number of pixels at each gray level is counted to obtain a local gray-level histogram. A histogram limiting threshold is determined based on the total number of pixels in the sub-block, the number of gray levels, and a preset limiting coefficient. Histograms exceeding the limiting threshold are then limited, and the total number of pixels exceeding the limit is accumulated. The number of pixels exceeding the limit is evenly distributed to each gray level in integer proportions. The remaining pixels are then distributed to a subset of gray levels according to a fixed step size or cyclical order, thus ensuring that the total number of pixels remains unchanged before and after limiting. This limiting process suppresses excessive stretching of a few high-frequency gray levels to avoid amplifying sensor noise, grid lines, or local pseudo-textures during the equalization process.

[0141] S44, calculate the cumulative distribution of the redistributed local histogram, normalize the cumulative distribution to the target grayscale range, and establish a grayscale mapping lookup table for the local sub-block. In the sub-block containing hidden cracks, the cumulative grayscale difference between fine-line dark lines and their neighboring normal areas is expanded; in the sub-block containing black spots, the grayscale levels of local dark areas and surrounding textures are expanded; in the sub-block containing black patches, identifiable levels can still be formed within large low-brightness areas based on local grayscale distribution. To prevent the black patch area from being boosted to a brightness level similar to that of a normal solar cell after local equalization, a brightness baseline constraint can be applied to the entire enhancement result after sub-block interpolation: record the average or median grayscale of the solar cell area before enhancement, and use this statistic to perform overall translation, scaling, or weighted fusion with the original area to preserve the overall low brightness relationship of the black patch relative to the normal solar cell; the brightness baseline constraint is an optional processing that does not change the spatial location and shape of the defect.

[0142] S45, to avoid the formation of block boundaries due to independent mapping of adjacent sub-blocks, for any pixel within the battery cell region, its position relative to the centers of the four adjacent local sub-blocks is determined. The mapping results of the original grayscale of the pixel are read from the grayscale mapping lookup tables of the four sub-blocks, and then bilinear interpolation is performed according to the horizontal and vertical distances. When the pixel is located at the edge or corner of the battery cell region, linear interpolation or direct mapping is performed using the mapping results of the actual adjacent sub-blocks. This results in a locally contrast-enhanced battery cell region with continuous grayscale transitions.

[0143] S46, based on the original bounding box positions of each cell region in the cell space reference structure, write the enhanced cell regions back to an output image of the same size as the standardized module EL image; the grid boundaries between adjacent cells can retain the original standardized image grayscale, or be merged according to the boundary pixels of adjacent regions. During the reconstruction process, the row and column order, region size, and numbering of each cell region are not changed, and no geometric movement or morphological reconstruction is performed on defects, thus obtaining a defect-feature-enhanced standardized module EL image that maintains the spatial arrangement of cells, defect morphology, and defect location. Figure 9 The process flow is shown, including cell region extraction, sub-block division, histogram limiting and redistribution, grayscale mapping, interpolation of adjacent sub-blocks, and reorganization at the original position.

[0144] Example 2

[0145] This embodiment describes an image processing apparatus or software processing flow for performing the above-described method. The apparatus includes an image input unit, a component segmentation unit, a geometric correction unit, a mesh establishment unit, a defect feature enhancement unit, and an image output unit. The image input unit receives the original photovoltaic module EL image; the component segmentation unit performs AW-GNPSO multi-threshold segmentation and morphological optimization; the geometric correction unit performs perspective correction and residual rotation correction; the mesh establishment unit outputs horizontal and vertical segmentation lines, cell bounding boxes, and cell number mappings; the defect feature enhancement unit performs block-based contrast-limited adaptive histogram equalization on a cell-by-cell basis and completes in-situ reconstruction; the image output unit outputs a defect feature-enhanced normalized module EL image.

[0146] Each of the above units can be implemented by program instructions running on a general-purpose computer, industrial control computer, edge computing device, or embedded processor, or by hardware circuits with corresponding image processing functions. During program execution, the threshold combinations, component corner points, homography matrix, residual rotation angle, set of horizontal and vertical dividing lines, cell bounding box, mapping function, and grayscale mapping lookup table of each local sub-block can be stored in memory and called according to cell number in subsequent processing stages.

[0147] The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the specific embodiments described above. For those skilled in the art, equivalent substitutions or conventional adjustments made to the threshold search termination condition, morphological structural elements, edge extraction operators, grid peak detection parameters, number of local sub-blocks, histogram limiting coefficients, or boundary interpolation methods without departing from the concept of the present invention should all fall within the protection scope of the present invention.

Claims

1. A method for adaptive correction and defect feature enhancement of photovoltaic module EL images, characterized in that, Includes the following steps: Step 1: Acquire the original photovoltaic module EL image and perform multi-threshold segmentation based on the improved particle swarm optimization algorithm AW-GNPSO. Then, perform morphological optimization on the segmentation results to obtain a binary mask image used to mark the photovoltaic module region. Step 2: Extract the photovoltaic module region from the original photovoltaic module EL image based on the binary mask image, perform perspective correction on the trapezoidal deformation of the photovoltaic module region, and perform residual rotation correction on the overall tilt of the perspective-corrected photovoltaic module EL image to obtain a standardized module EL image. Step 3: Perform cell grid positioning on the standardized component EL image, determine each cell region and its cell number, establish the mapping relationship between image coordinates, grid row and column positions and cell numbers, and construct a cell spatial reference structure based on horizontal dividing lines, vertical dividing lines, each cell region and its grid row and column positions. Step 4: For the thin, weak grayscale variations of the hidden cracks, the local low-brightness texture of the black spots, and the large low-brightness areas of the black patches, extract each cell region according to the cell spatial reference structure. Perform block-contrast-limited adaptive histogram equalization on each cell region, including grayscale histogram limiting, over-limit pixel redistribution, grayscale mapping, and interpolation of adjacent sub-blocks. Reorganize the enhanced cell regions according to the original grid positions to obtain a defect-enhanced normalized component EL image that strengthens the local grayscale differences between the defect area and the normal area while maintaining the spatial positional relationship of the cells.

2. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 1, the multi-threshold segmentation specifically involves: The EL images of photovoltaic modules are converted to grayscale, and the grayscale histogram is statistically analyzed. A multi-threshold segmentation fitness function is constructed based on the maximum inter-class variance criterion. The threshold combination, the class probability and average gray level of each gray-level region, and the global average gray level of the entire image are all represented by the corresponding variables in the following formula. The fitness function and the optimal threshold combination are as follows: ; ; In the formula, t represents the segmentation threshold arranged in ascending order of gray levels, k represents the total number of gray-level regions after segmentation, and j represents the sequence number of the gray-level regions; ω j μ represents the class probability of the corresponding grayscale region. j μ represents the average gray level of the corresponding gray area, where μ without the area number represents the global average gray level of the entire image; σ B 2 This represents the inter-class variance, with the superscript * indicating the optimal value. An improved particle swarm optimization algorithm is used to search for the optimal combination of thresholds that enable the fitness function; the electroluminescent image of the photovoltaic module is then divided into multiple grayscale regions based on the threshold combination. The background region is designated as the background category, and the remaining target regions are merged into the foreground category to obtain the initial binary mask image.

3. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 1, the improved particle swarm optimization algorithm AW-GNPSO is used to search for the optimal threshold combination for the multi-threshold segmentation fitness function, specifically as follows: Candidate multi-threshold combinations are encoded as particle positions, initializing the position and velocity of the particle population, and updating the particle velocity and position according to dynamic inertia weights. The dynamic inertia weights are adjusted based on the ratio of the current function evaluation count to the maximum function evaluation count, and are superimposed with a stochastic adjustment amount generated by the Logistic chaotic mapping. The maximum inertia weight, minimum inertia weight, and other control parameters are limited by the following formula: ; In the formula, ω on the left side of the formula t The dynamic inertia weights represent the current iteration stage; FEs represent the current function evaluation count, and the denominator of the fraction represents the maximum function evaluation count; ω max and ω min These represent the maximum and minimum inertia weights, respectively; r L u represents the stochastic adjustment produced by the Logistic chaotic mapping. ω v ω This represents the control coefficient; max_nfe represents the maximum number of function evaluations. After the particle position is updated, different particles are selected from the particle population. Based on the comparison results of the individual particles' historical best fitness, the first difference direction and the second difference direction are constructed. Combined with two sets of Gaussian random variables that follow a standard normal distribution and random weights with values ​​in the interval [0,1], the generalized normal optimization candidate positions are generated according to the following formula: ; In the formula, x i Let x represent the current position of the i-th particle. i gndo The subscript 'i' represents the particle candidate position generated by the generalized normal distribution optimization, the subscript 'i' represents the particle number, and the superscript 'gndo' indicates that it is generated by the generalized normal distribution optimization; β represents the random weight with a value in the interval [0,1]; l1 and l2 represent two sets of random variables that follow the standard normal distribution; d1 and d2 represent the first difference direction and the second difference direction, respectively. Based on the mutation probability that decreases with the iteration process, wavelet mutation is performed on the particle to generate multi-scale local perturbations in the particle's neighborhood. A wavelet perturbation factor δ is constructed using the scale parameter a and the random variable ξ, and wavelet mutation candidate positions are generated according to the sign of δ. The wavelet perturbation factor and the wavelet mutation candidate positions are as follows: ; ; In the formula, δ represents the wavelet perturbation factor, a represents the scaling parameter that changes with the iteration process, and ξ represents the random variable; x i wave The subscript 'i' represents the particle position, the subscript 'i' represents the particle number, and the superscript 'wave' represents the wavelet mutation candidate position. When δ is greater than 0, the perturbation moves towards the normalization upper bound; when δ is less than or equal to 0, the perturbation is proportional to the current position. The fitness of candidate positions obtained by particle position update, generalized normal optimization and wavelet mutation is compared. Positions with high fitness are retained and individual optimal positions and global optimal positions are updated until the iteration termination condition is met. The threshold combination corresponding to the global optimal position is used as a multi-threshold combination.

4. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 1, the morphological optimization specifically includes: Connectivity analysis is performed on the initial binary mask image obtained by multi-threshold segmentation to remove small connected regions with an area smaller than a preset minimum area threshold. The initial binary mask image after removing small connected regions is sequentially subjected to opening and closing operations to remove protruding structures on the component outline, smooth component boundaries, fill edge depressions, and connect adjacent regions with gaps. Let the binary mask to be processed be B and the structuring element be S, then the opening operation is... The closing operation is ,in Indicates corrosion. Indicates expansion; Hole filling is performed on the binary mask image obtained by the closing operation, and connected component analysis is performed on the binary mask image obtained by hole filling. The connected component with the largest area is retained to obtain the binary mask image used to mark the photovoltaic module area.

5. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 2, the perspective correction specifically includes: The outline of the photovoltaic module is extracted from the binary mask image. Straight lines are fitted to the four sides of the outline of the photovoltaic module. The intersection of adjacent fitted lines is calculated to recover the four corner points of the photovoltaic module. The four corner points of the photovoltaic module are arranged in the order of top left, top right, bottom right and bottom left. Calculate the lengths of the top and bottom sides, as well as the left and right sides of the quadrilateral region of the photovoltaic module, respectively, and determine the width and height of the target rectangle based on the larger of the two relative sides; A 3×3 homography matrix is ​​calculated based on the correspondence between the four corner points of the sorted photovoltaic module and the vertices of the target rectangle. This homography matrix is ​​then used to perform a perspective transformation on the original photovoltaic module EL image, mapping the quadrilateral region of the photovoltaic module to a regular rectangular module region. Both the source image points and the target plane points are represented using homogeneous coordinates and satisfy the following conditions: ; In the formula, H represents the 3×3 homography matrix obtained from four sets of corresponding points; x and y represent the coordinates of the source image points, u and v represent the coordinates of the target plane points; and λ represents the homogeneous scaling factor.

6. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 2, the residual rotation correction specifically includes: The perspective-corrected photovoltaic module EL image is subjected to local contrast enhancement, smoothing filtering and edge extraction in sequence. The resulting edge image is then subjected to Hough line detection to obtain candidate lines. Assuming any candidate line is defined by two endpoints, calculate the direction angle and weight based on the line length of the candidate line according to the following formula; filter candidate lines that are close to the horizontal or vertical direction, and convert the filtered candidate lines into deviation angles relative to the corresponding ideal horizontal or vertical direction: ; In the formula, φ represents the direction angle of the candidate line; x1, y1 and x2, y2 represent the coordinates of the two endpoints, respectively; ω i This indicates the length weight of the candidate line, and the subscript i indicates the candidate line number. The residual rotation angle is obtained by weighting the median of each deviation angle with length weight. The perspective-corrected photovoltaic module EL image is then rotated in the opposite direction to the residual rotation angle to obtain the standardized module EL image.

7. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 3, the cell grid positioning of the standardized component EL image and the determination of each cell region and its cell number specifically involve: performing lateral and longitudinal directional enhancement on the standardized component EL image; let the standardized component EL image be... Using lateral directional convolution kernels and vertical directional convolution kernel The standardized component EL images are convolved to obtain laterally enhanced images. and vertically enhanced images The formula for its calculation is: ; ; The Sobel operator is used to calculate the vertically enhanced images respectively. The lateral gradient response and the lateral enhancement image The longitudinal gradient response, the horizontal convolution kernel of the Sobel operator. and vertical convolution kernel They are respectively: ; ; Based on the horizontal convolution kernel and vertical convolution kernel Calculate the transverse gradient response respectively and longitudinal gradient response : ; ; In the formula, Represents a standardized component EL image; and These represent the horizontal directional convolution kernel and the vertical directional convolution kernel, respectively. and These represent horizontally enhanced images and vertically enhanced images, respectively. and These represent the horizontal and vertical convolution kernels of the Sobel operator, respectively. and These represent the transverse gradient response and the longitudinal gradient response, respectively; symbols Represents a two-dimensional convolution operation; symbol This indicates taking the absolute value of the convolution result pixel by pixel; Construct horizontal and vertical candidate line response maps based on gradient responses; perform closing operations and small-area connected component removal on the candidate line response maps; construct one-dimensional projection signals along the row and column directions respectively; The one-dimensional projection signal is smoothed, the grid period is estimated by the autocorrelation result of the one-dimensional projection signal, the peak detection threshold is set based on the median absolute deviation, and the candidate grid line positions are extracted. Based on the candidate grid line positions and the grid period, equal-spacing grid fitting is performed, and compensation is made for cases of missing boundaries, merging of adjacent peaks, or insufficient candidate lines to obtain the set of horizontal dividing lines, the set of vertical dividing lines, the number of module rows, and the number of module columns; the area enclosed by adjacent horizontal dividing lines and adjacent vertical dividing lines is determined as the cell area.

8. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, In step 3, establishing the mapping relationship between image coordinates, grid row and column positions, and battery cell numbers specifically involves: determining the grid row and column positions of each battery cell region based on the horizontal and vertical dividing lines obtained from the battery cell grid positioning; assigning battery cell numbers to each battery cell region according to the grid row and column positions; and establishing a mapping function M(x,y) between image coordinates and battery cell grid row and column positions. Let the set of vertical dividing lines be X and the set of horizontal dividing lines be Y. For any pixel coordinate (x,y) located between adjacent dividing lines, the mapping relationship is: ; ; In the formula, X and Y represent the set of vertical dividing lines and the set of horizontal dividing lines, respectively; x c x c+1 Represents the coordinates of adjacent vertical dividing lines, y r y r+1 The coordinates of adjacent horizontal dividing lines are represented by C and R, which represent the number of columns and rows of the component, respectively; c and r represent the column number and row number of the cell where the pixel is located, respectively; M represents the mapping function from the pixel coordinates to the row and column positions of the cell grid.

9. The method for adaptive correction and defect feature enhancement of photovoltaic module EL images according to claim 1, characterized in that, Step 4 is as follows: Defect feature enhancement targets include fine, weak grayscale variations in hidden cracks, localized low-brightness textures in black spots, and large areas of low-brightness in black patches, including: Based on the horizontal and vertical dividing lines in the cell spatial reference structure, each cell region is extracted from the standardized module EL image, and each cell region is divided into multiple local sub-blocks. The grayscale distribution of each local sub-block is then statistically analyzed. Calculate the grayscale histogram of each local sub-block, and perform amplitude limiting processing on the grayscale histogram according to a preset amplitude limiting threshold. The number of pixels exceeding the amplitude limiting threshold is redistributed to each grayscale level, and a grayscale mapping relationship for each local sub-block is constructed based on the redistributed grayscale histogram to improve the contrast between weak grayscale defects and local normal areas. The criteria for determining the amplitude limiting threshold are as follows: ; Where α is the preset limiting coefficient, N b L represents the total number of pixels in the local sub-block, and L represents the number of gray levels. For any pixel, bilinear interpolation is performed based on the grayscale mapping relationship of its adjacent local sub-blocks to obtain the battery cell area with enhanced local contrast, so as to continuously enhance the grayscale difference between the hidden crack dark line, the local dark area of ​​the black spot and the low brightness area of ​​the black film and its neighboring normal area. After enhancing the local contrast, each cell region is reorganized according to the corresponding horizontal and vertical dividing lines, maintaining the spatial arrangement, defect morphology, and defect location of each cell region, resulting in a standardized EL image of the defect feature enhancement module with improved local contrast and recognizability of the defect region.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method of claim 1.