A steel structure weld surface defect identification method based on image enhancement

CN123015394APending Publication Date: 2026-10-30SINOSTEEL MODULE MANUFACTURING (QUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611057884.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

现有的全局方向滤波器或固定尺度的纹理分析方法,难以自适应这种非线性弯曲形态,在提取特征时易将鱼鳞纹边缘的高频曲率变化误报为表面缺陷

Benefits of technology

[0081]1、通过计算原始焊缝图像的水平方向的一阶空间梯度值、垂直方向的一阶空间梯度值和局部空间梯度幅值,进而利用这些梯度值构建结构张量并计算拓扑结构稳定性指数,以此自适应调整投影向量获得各向异性纹理连续性度量值,最后结合多尺度梯度曲率投影值计算缺陷特征增强因子,并依据其全局均值和全局标准差统计表面缺陷总面积。在钢结构焊缝检测的特定环境中,焊缝表面常分布有非线性弯曲的鱼鳞纹等粗糙纹理,且在收弧坑等区域易出现纹理拓扑结构坍塌与方向紊乱的现象,导致常规识别方法难以剥离背景干扰且容易在奇点处计算失效。该方案利用结构张量和拓扑结构稳定性指数适应局部纹理的方向变化,在纹理无序区域维持了形态学数值分析的稳定;同时结合曲率投影与连续性度量,在特征层面区分了鱼鳞纹的连续起伏与真实缺陷的物理断裂。在面临复杂背景与多变焊缝表面形貌叠加的条件下,该方法能够降低由粗糙纹理带来的特征误报,减弱光照反射与背景干扰对识别过程的影响,客观地突显出缺陷特征,进而完成对表面缺陷总面积的输出。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015394A_ABST
    Figure CN123015394A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, and discloses a steel structure weld seam surface defect identification method based on image enhancement, which comprises the following steps: calculating the first-order spatial gradient value and the local spatial gradient amplitude value of an original weld seam image; calculating the horizontal, vertical autocorrelation components and the cross-correlation component of a structure tensor by using the obtained gradient value, and then calculating the determinant value and the topological structure stability index; adjusting the projection vector by using the index, calculating the anisotropic texture continuity measurement value, combining the multi-scale gradient curvature projection value, the continuity measurement value and the gradient amplitude value, calculating the defect feature enhancement factor, and finally calculating the total surface defect area by calculating the global mean value and the global standard deviation of the enhancement factor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, specifically to a method for identifying surface defects in steel structure welds based on image enhancement. Background Technology

[0002] In industrial applications of steel structure weld surface defect identification, visual inspection is a commonly used technique. Existing surface defect detection technologies mostly employ conventional image spatial domain filtering, edge detection, or feature thresholding algorithms to process the original weld image. However, under actual industrial lighting conditions, weld metal surfaces typically exhibit strong reflective backgrounds. Existing basic gradient extraction or morphological methods struggle to effectively separate minute real defect features from strong reflective interference, easily leading to missed detections. Furthermore, weld surfaces inherently possess rough textures such as fish-scale patterns, which often exhibit nonlinear bending along the weld direction. Existing global orientation filters or fixed-scale texture analysis methods struggle to adapt to this nonlinear bending morphology, easily misreporting high-frequency curvature changes at the edges of fish-scale patterns as surface defects during feature extraction. Moreover, in complex areas such as weld craters or intersections of multiple welds, the topological structure of local textures is prone to abrupt collapse, resulting in disordered local orientations. When processing these topologically collapsed regions, existing local orientation tensor algorithms often suffer from mathematical divergence or singular value problems due to the loss of a clear directional basis, leading to algorithm failure. Because existing technologies cannot simultaneously suppress strongly reflective backgrounds, adapt to curved fish-scale textures, and overcome topological singularities in complex regions, the feature separation is insufficient when combining features such as local spatial gradient magnitude for calculation, thus limiting the recognition results. Therefore, an image enhancement-based method for identifying surface defects in steel structure welds is needed. Summary of the Invention

[0003] This invention provides a method for identifying surface defects in steel structure welds based on image enhancement, which helps to solve the problems mentioned in the background art.

[0004] This invention provides the following technical solution: a method for identifying surface defects in steel structure welds based on image enhancement, comprising:

[0005] Calculate the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude of the original weld image;

[0006] Using the first-order spatial gradient values ​​in the horizontal and vertical directions, the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor are calculated.

[0007] The determinant and topological stability index of the structural tensor are calculated using the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structural tensor.

[0008] The adaptively adjusted horizontal projection vector and the adaptively adjusted vertical projection vector are calculated using the topological stability index, and then the anisotropic texture continuity metric is calculated.

[0009] The multi-scale gradient curvature projection value is calculated using the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude.

[0010] The defect feature enhancement factor is calculated by combining the multi-scale gradient curvature projection value, the anisotropic texture continuity metric value, and the local spatial gradient magnitude.

[0011] Calculate the global mean and global standard deviation of the defect feature enhancement factor;

[0012] The total area of ​​surface defects is calculated using the defect feature enhancement factor, the global mean of the defect feature enhancement factor, and the global standard deviation of the defect feature enhancement factor.

[0013] Optionally, calculating the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude of the original weld image includes:

[0014] The weld area of ​​the steel structure is illuminated by an orthogonal polarized coaxial light source, and a single exposure is performed by an industrial camera to acquire a single-channel original weld image, which is then stored in a memory matrix.

[0015] A two-dimensional Cartesian coordinate system is established with the top left pixel of the original weld image as the origin, the horizontal rightward direction of the image as the positive direction of the x-axis, and the vertical downward direction of the image as the positive direction of the y-axis.

[0016] Get the grayscale value of the rightmost adjacent pixel of the current pixel;

[0017] Obtain the grayscale value of the left adjacent pixel of the current pixel;

[0018] The first-order spatial gradient value of the current pixel in the horizontal direction is calculated by subtracting the gray value of the gray value of the adjacent pixel on the right from the gray value of the adjacent pixel on the left.

[0019] Obtain the grayscale value of the pixel immediately below the current pixel;

[0020] Obtain the grayscale value of the pixel adjacent to the current pixel above it;

[0021] The first-order spatial gradient value in the vertical direction of the current pixel is calculated by subtracting the gray value of the gray value of the adjacent pixel below from the gray value of the adjacent pixel above.

[0022] The first squared value is obtained by squaring the first-order spatial gradient value in the horizontal direction.

[0023] The second squared value is obtained by squaring the first-order spatial gradient value in the vertical direction.

[0024] The first squared value is added to the second squared value, and the square root of the addition result is calculated to obtain the local spatial gradient amplitude of the original weld image.

[0025] Optionally, the step of calculating the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor using the first-order spatial gradient value in the horizontal direction and the first-order spatial gradient value in the vertical direction includes:

[0026] Obtain the total pixel width of the original weld image corresponding to the camera's photosensitive array, and set the window scaling factor;

[0027] Multiply the total pixel width of the original weld image by the window scaling factor and round down. Use the rounded result as the calculation radius of the local summation window.

[0028] Within a local summation window determined by the computational radius, the first-order spatial gradient value in the horizontal direction at each offset position is obtained;

[0029] The first-order spatial gradient value in the horizontal direction at each offset position is squared, and all squared results within the local summation window are double-summed to obtain the horizontal autocorrelation component of the structure tensor.

[0030] Within a local summation window determined by the computational radius, the first-order spatial gradient value in the vertical direction of each offset position is obtained;

[0031] The first-order spatial gradient value in the vertical direction at each offset position is squared, and all squared results within the local summation window are double-summed to obtain the vertical autocorrelation component of the structure tensor.

[0032] Multiply the first-order spatial gradient value in the horizontal direction of each offset position within the local summation window with its corresponding first-order spatial gradient value in the vertical direction to obtain the local correlation product; perform double summation on all the local correlation products within the local summation window to calculate the cross-correlation components of the structure tensor.

[0033] Optionally, the step of calculating the determinant value and topological stability index of the structure tensor using the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor includes:

[0034] Multiply the horizontal autocorrelation component of the structure tensor with the vertical autocorrelation component of the structure tensor to obtain the first tensor product;

[0035] The cross-correlation components of the structure tensor are squared to obtain the second tensor product;

[0036] Subtract the product of the second tensor from the product of the first tensor to calculate the determinant value of the structure tensor;

[0037] The horizontal autocorrelation component of the structure tensor is squared to obtain the product of the third tensor.

[0038] The autocorrelation component in the vertical direction of the structure tensor is squared to obtain the fourth tensor product.

[0039] Add the product of the third tensor to the product of the fourth tensor, and add a constant 1 to the result of the addition to obtain the topologically stable denominator.

[0040] The topological stability index is calculated by dividing the determinant value of the structure tensor by the topological stability denominator.

[0041] Optionally, the step of calculating the adaptively adjusted horizontal projection vector and the adaptively adjusted vertical projection vector using the topological stability index, and then calculating the anisotropic texture continuity metric, includes:

[0042] Subtracting the vertical autocorrelation component of the structure tensor from the horizontal autocorrelation component of the structure tensor yields the autocorrelation tensor difference.

[0043] The autocorrelation tensor difference is multiplied by the topological stability index to calculate the adaptively adjusted horizontal projection vector.

[0044] Multiply the constant 2 by the cross-correlation component of the structure tensor to obtain the cross-correlation adjustment value;

[0045] The cross-correlation adjustment value is multiplied by the topological stability index to calculate the adaptively adjusted vertical projection vector of the orthogonal plane;

[0046] Multiply the first-order spatial gradient value in the horizontal direction with the adaptively adjusted horizontal projection vector to obtain the horizontal projection continuity product;

[0047] Multiply the first-order spatial gradient value in the vertical direction with the adaptively adjusted vertical projection vector to obtain the vertical projection continuity product;

[0048] The anisotropic texture continuity metric is calculated by adding the horizontal projection continuity product and the vertical projection continuity product.

[0049] Optionally, the step of calculating the multi-scale gradient curvature projection value using the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude includes:

[0050] Obtain the first-order spatial gradient value in the horizontal direction at the offset position to the right of the current pixel;

[0051] Obtain the first-order spatial gradient value in the horizontal direction at the left offset position of the current pixel;

[0052] Subtracting the first-order spatial gradient value in the horizontal direction from the first-order spatial gradient value in the horizontal direction at the right offset position yields the horizontal gradient difference value.

[0053] Obtain the first-order spatial gradient value in the vertical direction at the offset position below the current pixel;

[0054] Obtain the first-order spatial gradient value in the vertical direction at the offset position above the current pixel;

[0055] Subtract the first-order spatial gradient value in the vertical direction of the upper offset position from the first-order spatial gradient value in the vertical direction of the lower offset position to obtain the vertical gradient difference value.

[0056] Add the horizontal gradient difference value to the vertical gradient difference value to obtain the curvature numerator.

[0057] Adding a constant 1 to the magnitude of the local spatial gradient yields the curvature denominator.

[0058] Divide the numerator of curvature by the denominator of curvature to calculate the multi-scale gradient curvature projection value that characterizes the surface concavity and convexity.

[0059] Optionally, the step of calculating the defect feature enhancement factor by combining the multi-scale gradient curvature projection value, the anisotropic texture continuity metric value, and the local spatial gradient magnitude includes:

[0060] The local spatial gradient magnitude of the original weld image is cubically calculated to obtain the magnitude cube term;

[0061] Adding a constant 1 to the cubic term of the amplitude yields the enhanced normalized denominator term;

[0062] Divide the anisotropic texture continuity measure by the enhanced normalization denominator to obtain the dimensionless continuity measure.

[0063] The defect feature enhancement factor is calculated by subtracting the dimension reduction continuity metric from the multi-scale gradient curvature projection value.

[0064] Optionally, calculating the global mean and global standard deviation of the defect feature enhancement factor includes:

[0065] Obtain the total pixel width and total pixel height of the raw weld image determined by the camera hardware output array;

[0066] Multiply the total pixel width by the total pixel height to obtain the total number of pixels in the image.

[0067] The entire original weld image is traversed, and the defect feature enhancement factors of all pixels are summed to obtain the global enhancement factor sum.

[0068] The global mean of the defect feature enhancement factor is calculated by dividing the sum of the global enhancement factors by the total number of pixels in the image.

[0069] The entire original weld image is traversed again, and the global mean of the defect feature enhancement factor is subtracted from the defect feature enhancement factor of the current pixel to obtain the enhancement factor deviation of the current pixel.

[0070] The enhancement factor deviation of each pixel is squared, and the squared results of all pixels are globally summed to obtain the global variance.

[0071] The global variance is divided by the total number of pixels in the image, and the square root of the division result is taken to calculate the global standard deviation of the defect feature enhancement factor.

[0072] Optionally, calculating the total area of ​​surface defects using the defect feature enhancement factor, the global mean of the defect feature enhancement factor, and the global standard deviation of the defect feature enhancement factor includes:

[0073] Set an infinitesimal positive constant to prevent the denominator from being zero;

[0074] The global dynamic threshold is obtained by adding the global mean of the defect feature enhancement factor to the global standard deviation of the defect feature enhancement factor.

[0075] Traverse the entire original weld image, subtract the global dynamic threshold from the defect feature enhancement factor of the current pixel to obtain the step deviation value of the current pixel;

[0076] Calculate the absolute value of the step deviation; add the absolute value to the infinitesimal positive constant to obtain the approximate denominator term;

[0077] Divide the step deviation value by the approximation denominator term to obtain the step approximation result value;

[0078] Add a constant 1 to the step approximation result value, and divide the sum by a constant 2 to calculate the single defect statistics value of the current pixel.

[0079] The total area of ​​surface defects identified is calculated by summing the statistical values ​​of all pixels in the entire original weld image.

[0080] The present invention has the following beneficial effects:

[0081] 1. This method calculates the first-order spatial gradient values ​​in the horizontal and vertical directions, as well as the local spatial gradient magnitudes of the original weld image. These gradient values ​​are then used to construct a structural tensor and calculate the topological stability index. This allows for adaptive adjustment of the projection vector to obtain anisotropic texture continuity metrics. Finally, the defect feature enhancement factor is calculated by combining multi-scale gradient curvature projection values, and the total surface defect area is statistically analyzed based on its global mean and global standard deviation. In the specific environment of steel structure weld inspection, weld surfaces often exhibit nonlinearly curved, rough textures such as fish-scale patterns. Furthermore, texture topological collapse and directional disorder are prone to occur in areas such as arc-end craters, making it difficult for conventional recognition methods to remove background interference and easily leading to computational failure at singularities. This scheme utilizes the structural tensor and topological stability index to adapt to local texture directional changes, maintaining the stability of morphological numerical analysis in disordered texture regions. Simultaneously, by combining curvature projection and continuity metrics, it distinguishes the continuous undulations of fish-scale patterns from the physical fractures of real defects at the feature level. Under the conditions of complex background and varied weld surface morphology, this method can reduce feature false alarms caused by rough texture, weaken the influence of light reflection and background interference on the recognition process, objectively highlight defect features, and thus complete the output of the total area of ​​surface defects.

[0082] 2. By establishing a two-dimensional Cartesian coordinate system, the grayscale values ​​of the current pixel and its neighboring pixels are obtained. This allows for the calculation of the first-order spatial gradient values ​​in the horizontal and vertical directions of the original weld image. These two values ​​are then squared, added together, and their square roots are taken to obtain the local spatial gradient amplitude of the original weld image. This processing method transforms the discrete pixel grayscale information of the weld surface into fundamental features characterizing the intensity of spatial grayscale changes. In environments with uneven illumination or reflective areas on the weld surface, using spatial gradients and gradient amplitudes can reduce the interference of uniform illumination backgrounds on feature extraction. Simultaneously, based on the calculation logic of grayscale differences between adjacent pixels, the edge contours of abrupt changes in the weld surface morphology can be initially extracted, providing basic parameters for subsequent feature differentiation from background noise, thus giving the extraction process of spatial morphology changes a morphological basis.

[0083] 3. By obtaining the total pixel width of the original weld image and combining it with the set window scaling factor, the calculation radius of the local summation window is determined. Then, within the local summation window, the first-order spatial gradient values ​​in the horizontal and vertical directions are used for double summation and accumulation to calculate the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor. This process utilizes the gradient covariance characteristics within the local neighborhood to construct the structure tensor, which can reflect the anisotropic distribution law of the weld surface texture. When dealing with the inherent fish-scale pattern and other curved textures on the weld surface, the local summation window can smooth isolated noise pixels, and the obtained components adaptively express the local dominant direction with the texture trend, reducing the directional analysis bias of fixed feature extraction methods at curved textures.

[0084] 4. By multiplying the horizontal and vertical autocorrelation components of the structural tensor and subtracting the squares of the cross-correlation components, the determinant of the structural tensor is calculated. This determinant is then divided by the denominator, which consists of the sum of the squares of the two autocorrelation components and a constant, to calculate the topological stability index. This operation numerically quantifies the anisotropy of local spatial texture distribution. In complex regions with abrupt changes, such as weld craters, texture directions are disordered, and the tensor is prone to feature degradation. This index can be used to assess the objective reliability of direction vectors in regions of structural abrupt changes. The constant term in the denominator maintains mathematical stability when the components approach zero, avoiding computational divergence during feature extraction in complex regions and providing a numerical benchmark for adjusting the projected direction vector.

[0085] 5. By multiplying the intermediate values ​​obtained from the structural tensor components using the topological stability index, adaptively adjusted horizontal and vertical projection vectors are calculated. These vectors are then multiplied and added to the first-order spatial gradient value to obtain an anisotropic texture continuity metric. This calculation step fuses the spatial gradient onto the projection substrate constrained by the stability index. In normal fish-scale texture regions, the texture is continuous along the main direction, while in regions with surface defects, the gradient projection exhibits morphological breaks. By using this index to numerically modulate the projection vector, the projection weights of the feature divergence direction can be reduced in locally disordered texture regions, enabling the calculated continuity metric to objectively reflect the physical continuity of the surface morphology.

[0086] 6. By acquiring the first-order spatial gradient values ​​in the horizontal and vertical directions at different offset positions of the current pixel, the numerator of the gradient difference is calculated, and then divided by the denominator formed by the sum of the local spatial gradient magnitude and the constant, the multi-scale gradient curvature projection value characterizing the surface concavity and convexity is calculated. This process is equivalent to solving the divergence of the normalized gradient field, which can reflect the second-order curvature change characteristics of the weld surface morphology. In environments with light reflection interference, the simple first-order gradient is easily affected by high-frequency edges, while the multi-scale gradient curvature projection value enhances the ability to capture the subtle concavity and convexity of the surface, weakens the gray-scale step interference caused by large-area smooth reflection, and extracts objective curvature parameters that better fit the physical morphological abrupt change characteristics.

[0087] 7. By cubically calculating the local spatial gradient magnitude of the original weld image and adding a constant as the denominator for enhancement normalization, the anisotropic texture continuity measure is divided by this denominator to obtain the dimension-reduced continuity measure. This feature term is then subtracted from the multi-scale gradient curvature projection value to calculate the defect feature enhancement factor. This step achieves dimensional unification and numerical compensation for different features at the mathematical calculation level. In the weld fish scale pattern region, curvature and continuity measures have similar numerical responses, while they exhibit different distributions in the defect region. Subtracting and fusing the dimension-reduced and compensated continuity measure features with the curvature projection features can offset the feature peaks generated by rough textures such as fish scale patterns while highlighting the independent feature responses of surface defects, thus reducing the interference of complex morphology on the feature extraction process.

[0088] 8. By acquiring the total pixel width and total pixel height of the original weld image, the defect feature enhancement factor of the entire original weld image is calculated by iterative accumulation and division to obtain the global mean. Then, combined with this global mean, the sum of the squares of the enhancement factor deviation of each pixel is calculated and divided by the total number of pixels in the image, and the square root is taken to obtain the global standard deviation of the defect feature enhancement factor. This process statistically analyzes the feature distribution law and numerical fluctuation level of the enhanced image matrix from a macroscopic perspective. When facing images from different batches or with contrast fluctuations due to ambient light, the global mean and global standard deviation based on the image's own characteristics can objectively reflect the true distribution baseline of the current image background noise, providing an objective boundary for the subsequent setting of dynamic thresholds that fits the current specific image conditions.

[0089] 9. A global dynamic threshold is constructed by adding the global mean and global standard deviation of the defect feature enhancement factor. Based on this, a step approximation result value is constructed using the step deviation, absolute value, and set infinitesimal positive constant of the defect feature enhancement factor of the current pixel relative to this threshold. Finally, the total area of ​​the identified surface defects is obtained through constant adjustment and accumulation calculation. This step constructs an absolute value step feature function using the mathematical approximation idea, transforming the local condition judgment logic into a purely algebraic analytical continuous calculation. When processing the weld pixel matrix, this step statistical method reduces the logical divergence problem caused by pixel-level condition judgment in continuous calculation. The introduction of infinitesimal positive constant maintains the numerical stability of the division operation, making the statistical area result have analytical stability at the computational level. Attached Figure Description

[0090] Figure 1 This is a schematic diagram of the basic process of the present invention.

[0091] Figure 2 This is a schematic diagram illustrating the relationship between the structural tensor, topological stability, and projection vector of the present invention.

[0092] Figure 3 This is a schematic diagram illustrating the statistical relationship between curvature projection, feature enhancement, and defect area in this invention. Detailed Implementation

[0093] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0094] Example 1, refer to Figure 1 A method for identifying surface defects in steel structure welds based on image enhancement, comprising:

[0095] Calculate the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude of the original weld image;

[0096] Using the first-order spatial gradient values ​​in the horizontal and vertical directions, the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor are calculated.

[0097] The determinant and topological stability index of the structural tensor are calculated using the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structural tensor.

[0098] The adaptively adjusted horizontal projection vector and the adaptively adjusted vertical projection vector are calculated using the topological stability index, and then the anisotropic texture continuity metric is calculated.

[0099] The multi-scale gradient curvature projection value is calculated using the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude.

[0100] The defect feature enhancement factor is calculated by combining the multi-scale gradient curvature projection value, the anisotropic texture continuity metric value, and the local spatial gradient magnitude.

[0101] Calculate the global mean and global standard deviation of the defect feature enhancement factor;

[0102] The total area of ​​surface defects is calculated using the defect feature enhancement factor, the global mean of the defect feature enhancement factor, and the global standard deviation of the defect feature enhancement factor.

[0103] The calculation of the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude of the original weld image includes:

[0104] The purpose of this step is to transform discrete image grayscale information into a gradient field that represents the rate of change of spatial grayscale.

[0105] The weld area of ​​the steel structure is illuminated by an orthogonal polarized coaxial light source. A single exposure is performed by an industrial camera to acquire a single-channel original weld image, which is then stored in a memory matrix. A two-dimensional Cartesian coordinate system is established with the top left pixel of the original weld image as the origin, the horizontal direction to the right of the image as the positive x-axis, and the vertical direction downward of the image as the positive y-axis.

[0106] To obtain the variation features of the image in the horizontal dimension, the first-order spatial gradient value of the current pixel in the horizontal direction is calculated through the following steps:

[0107] Obtain the grayscale value of the right neighboring pixel of the current pixel; obtain the grayscale value of the left neighboring pixel of the current pixel; subtract the grayscale value of the left neighboring pixel from the grayscale value of the right neighboring pixel to calculate the first-order spatial gradient value of the current pixel in the horizontal direction;

[0108] Next, in order to obtain the variation features in the vertical dimension, the first-order spatial gradient value in the vertical direction of the current pixel is calculated through the following steps:

[0109] Obtain the grayscale value of the pixel below the current pixel; obtain the grayscale value of the pixel above the current pixel; subtract the grayscale value of the pixel above the pixel from the grayscale value of the pixel below to calculate the first-order spatial gradient value in the vertical direction of the current pixel;

[0110] Subsequently, in order to comprehensively evaluate the degree of drastic change in the overall grayscale of the pixel, the local spatial gradient magnitude of the original weld image was calculated through the following steps:

[0111] The first-order spatial gradient value in the horizontal direction is squared to obtain a first squared value; the first-order spatial gradient value in the vertical direction is squared to obtain a second squared value; the first squared value and the second squared value are added together, and the square root of the addition result is calculated to obtain the local spatial gradient amplitude of the original weld image.

[0112] By establishing a two-dimensional Cartesian coordinate system, the grayscale values ​​of the current pixel and its neighboring pixels are obtained. This allows for the calculation of the first-order spatial gradient values ​​in the horizontal and vertical directions of the original weld image. These two values ​​are then squared, added together, and their square roots are taken to obtain the local spatial gradient amplitude of the original weld image. This processing method transforms the discrete pixel grayscale information of the weld surface into fundamental features characterizing the intensity of spatial grayscale changes. In environments with uneven illumination or reflective areas on the weld surface, using spatial gradients and gradient amplitudes can reduce the interference of uniform illumination backgrounds on feature extraction. Simultaneously, based on the calculation logic of grayscale differences between adjacent pixels, the edge contours of abrupt changes in the weld surface morphology can be initially extracted, providing basic parameters for subsequent feature differentiation from background noise, thus giving the extraction process of spatial morphology changes a morphological basis.

[0113] Reference Figure 2 , Figure 2 The parametric relationships between the structural tensor components generated by the local summation window and the topological stability index, the adaptively adjusted projection vector, and the anisotropic texture continuity metric are shown.

[0114] The calculation of the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor using the first-order spatial gradient values ​​in the horizontal and vertical directions includes:

[0115] The purpose of this step is to solve the problem of nonlinear bending in the direction of the fish scale pattern;

[0116] Obtain the total pixel width of the original weld image corresponding to the camera's photosensitive array;

[0117] Set the window scaling factor to one percent;

[0118] The total pixel width of the original weld image is multiplied by the window scaling factor and rounded down. The result is used as the calculation radius of the local summation window.

[0119] To capture the dominant texture features in the horizontal direction, the horizontal autocorrelation component of the structure tensor is calculated using the following steps:

[0120] Within a local summation window determined by the computational radius, the first-order spatial gradient value in the horizontal direction at each offset position is obtained; the first-order spatial gradient value in the horizontal direction at each offset position is squared, and all squared calculation results within the local summation window are double-summed to calculate the horizontal autocorrelation component of the structure tensor.

[0121] Next, in order to capture the dominant texture features in the vertical direction, the vertical autocorrelation component of the structure tensor is calculated through the following steps:

[0122] Within a local summation window determined by the computational radius, the first-order spatial gradient value in the vertical direction of each offset position is obtained; the first-order spatial gradient value in the vertical direction of each offset position is squared, and all the squared calculation results within the local summation window are double-summed to calculate the vertical autocorrelation component of the structure tensor.

[0123] Then, to evaluate the skewness and correlation of the texture, the cross-correlation components of the structure tensor are calculated through the following steps:

[0124] Multiply the first-order spatial gradient value in the horizontal direction of each offset position within the local summation window with its corresponding first-order spatial gradient value in the vertical direction to obtain the local correlation product; perform double summation on all the local correlation products within the local summation window to calculate the cross-correlation components of the structure tensor.

[0125] By obtaining the total pixel width of the original weld image and combining it with a set window scaling factor, the computational radius of the local summation window is determined. Then, within the local summation window, the first-order spatial gradient values ​​in the horizontal and vertical directions are used for double summation and accumulation to calculate the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor. This process utilizes the gradient covariance characteristics within the local neighborhood to construct the structure tensor, which can reflect the anisotropic distribution law of the weld surface texture. When dealing with the inherent curved textures such as fish scale patterns on the weld surface, the local summation window can smooth isolated noise pixels, and the obtained components adaptively express the local dominant direction with the texture trend, reducing the directional analysis bias of fixed feature extraction methods at curved textures.

[0126] The calculation of the determinant and topological stability index of the structure tensor using the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor includes:

[0127] This step aims to address the singularity problem of tensor collapse in areas such as weld craters;

[0128] To assess the degree of anisotropy of local structural features, the determinant value of the structure tensor is calculated using the following steps:

[0129] Multiply the horizontal autocorrelation component of the structure tensor with the vertical autocorrelation component of the structure tensor to obtain the first tensor product; square the cross-correlation components of the structure tensor to obtain the second tensor product; subtract the second tensor product from the first tensor product to calculate the determinant value of the structure tensor.

[0130] To suppress unreliable direction vectors in singularity regions, the topological stability index is calculated using the following steps:

[0131] The horizontal autocorrelation component of the structure tensor is squared to obtain the third tensor product; the vertical autocorrelation component of the structure tensor is squared to obtain the fourth tensor product; the third tensor product and the fourth tensor product are added together, and a constant 1 is added to the result to obtain the topological stability denominator; the determinant of the structure tensor is divided by the topological stability denominator to calculate the topological stability index.

[0132] The determinant of the structural tensor is calculated by multiplying the horizontal and vertical autocorrelation components of the structural tensor and subtracting the squares of the cross-correlation components. This determinant is then divided by a denominator consisting of the sum of the squares of the two autocorrelation components and a constant, yielding the topological stability index. This operation numerically quantifies the anisotropy of local spatial texture distribution. In complex regions with abrupt changes, such as weld craters, texture directions are disordered, and the tensor is prone to feature degradation. This index can be used to assess the objective reliability of direction vectors in regions of structural abrupt changes. The constant term in the denominator maintains mathematical stability as the components approach zero, avoiding computational divergence during feature extraction in complex regions and providing a numerical benchmark for adjusting the projected direction vector.

[0133] The step of calculating the adaptively adjusted horizontal projection vector and the adaptively adjusted vertical projection vector using the topological stability index, and then calculating the anisotropic texture continuity metric, includes:

[0134] This step uses the orientation tensor and stability index to extract the gradient projection along the main direction of the texture; solid cracks will cause abrupt fracture in this direction, while fish scale patterns remain continuous.

[0135] To obtain a local projection basis adapted to the singularity, the adaptively adjusted horizontal projection vector is calculated using the following steps:

[0136] Subtract the vertical autocorrelation component of the structure tensor from the horizontal autocorrelation component of the structure tensor to obtain the autocorrelation tensor difference; multiply the autocorrelation tensor difference by the topological stability index to calculate the adaptively adjusted horizontal projection vector.

[0137] Subsequently, the adaptively adjusted vertical projection vector of the orthogonal plane is calculated through the following steps:

[0138] Multiply the constant 2 by the cross-correlation component of the structure tensor to obtain the cross-correlation adjustment value; multiply the cross-correlation adjustment value by the topological stability index to calculate the adaptively adjusted vertical projection vector of the orthogonal plane;

[0139] Finally, the anisotropic texture continuity metric is calculated using the following steps:

[0140] Multiply the first-order spatial gradient value in the horizontal direction with the adaptively adjusted horizontal projection vector to obtain the horizontal projection continuity product; multiply the first-order spatial gradient value in the vertical direction with the adaptively adjusted vertical projection vector to obtain the vertical projection continuity product; add the horizontal projection continuity product and the vertical projection continuity product to calculate the anisotropic texture continuity metric.

[0141] By multiplying the intermediate values ​​obtained from the structural tensor components using the topological stability index, adaptively adjusted horizontal and vertical projection vectors are calculated. These vectors are then multiplied and added to the first-order spatial gradient value to obtain an anisotropic texture continuity metric. This calculation step fuses the spatial gradient onto the projection substrate constrained by the stability index. In normal fish-scale texture regions, the texture is continuous along the main direction, while in regions with surface defects, the gradient projection exhibits morphological breaks. By using this index to numerically modulate the projection vector, the projection weights of the feature divergence direction can be reduced in locally disordered texture regions, enabling the calculated continuity metric to objectively reflect the physical continuity of the surface morphology.

[0142] Reference Figure 3 , Figure 3 The statistical relationships between the horizontal gradient difference value, the vertical gradient difference value, the local spatial gradient magnitude projected onto the multi-scale gradient curvature value, the defect feature enhancement factor, and the total area of ​​surface defects are shown.

[0143] The calculation of multi-scale gradient curvature projection values ​​using the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude includes:

[0144] This step aims to initially separate structural abrupt changes in the image caused by reflections or edges;

[0145] To obtain the gradient change rate at the offset position, the gradient curvature projection value, which characterizes the concavity and convexity response of the image grayscale topography, is calculated through the following steps:

[0146] Obtain the first-order spatial gradient value in the horizontal direction at the right offset position of the current pixel; obtain the first-order spatial gradient value in the horizontal direction at the left offset position of the current pixel; subtract the first-order spatial gradient value in the horizontal direction at the left offset position from the first-order spatial gradient value in the horizontal direction at the right offset position to obtain the horizontal gradient difference value; obtain the first-order spatial gradient value in the vertical direction at the lower offset position of the current pixel; obtain the first-order spatial gradient value in the vertical direction at the upper offset position of the current pixel; subtract the first-order spatial gradient value in the vertical direction at the lower offset position from the first-order spatial gradient value in the vertical direction at the upper offset position to obtain the vertical gradient difference value; add the horizontal gradient difference value and the vertical gradient difference value to obtain the curvature numerator; add a constant 1 to the local spatial gradient magnitude to obtain the curvature denominator; divide the curvature numerator by the curvature denominator to calculate the multi-scale gradient curvature projection value characterizing the surface concavity and convexity characteristics.

[0147] By acquiring the first-order spatial gradient values ​​in the horizontal and vertical directions at different offset positions of the current pixel, the numerator of the gradient difference is calculated, and then divided by the denominator formed by the sum of the local spatial gradient magnitude and a constant, multi-scale gradient curvature projection values ​​characterizing the surface concavity and convexity are calculated. This process is equivalent to solving the divergence of the normalized gradient field, which can reflect the second-order curvature variation characteristics of the weld surface morphology. In environments with light reflection interference, the simple first-order gradient is easily affected by high-frequency edges, while the multi-scale gradient curvature projection values ​​enhance the ability to capture the subtle concavity and convexity structures of the surface, weaken the gray-scale step interference caused by large-area smooth reflection, and extract objective curvature parameters that better fit the physical morphological abrupt change characteristics.

[0148] The calculation of the defect feature enhancement factor by combining the multi-scale gradient curvature projection value, the anisotropic texture continuity metric value, and the local spatial gradient magnitude includes:

[0149] This step couples curvature features with a continuity metric to suppress highly reflective backgrounds and fish-scale noise.

[0150] The defect feature enhancement factor is calculated by subtracting the continuity metric obtained after dimensionality reduction using gradient magnitude from the curvature projection value through the following steps:

[0151] The local spatial gradient magnitude of the original weld image is cubically calculated to obtain a cubic magnitude term; a constant 1 is added to the cubic magnitude term to obtain an enhanced normalized denominator term; the anisotropic texture continuity metric is divided by the enhanced normalized denominator term to obtain a dimension-reduced continuity metric term; the multi-scale gradient curvature projection value is subtracted from the dimension-reduced continuity metric term to calculate the defect feature enhancement factor.

[0152] By cubically calculating the local spatial gradient magnitude of the original weld image and adding a constant as the denominator for enhancement normalization, and then dividing the anisotropic texture continuity measure by this denominator to obtain the dimension-reduced continuity measure, the defect feature enhancement factor is calculated by subtracting this feature term from the multi-scale gradient curvature projection value. This step achieves dimensional unification and numerical compensation for different features at the mathematical computation level. In the weld fish-scale texture region, curvature and continuity measures have similar numerical responses, while they exhibit different distributions in the defect region. Subtracting and fusing the dimension-reduced and compensated continuity measure features with the curvature projection features can offset the feature peaks generated by rough textures such as fish-scale textures while highlighting the independent feature responses of surface defects, thus reducing the interference of complex morphology on the feature extraction process.

[0153] The calculation of the global mean and global standard deviation of the defect feature enhancement factor includes:

[0154] This step utilizes the global statistical properties of the enhancement factor to generate an automated segmentation threshold;

[0155] Obtain the total pixel width and total pixel height of the raw weld image determined by the camera hardware output array;

[0156] First, based on the obtained global size, the entire image matrix is ​​traversed, and the global mean of the defect feature enhancement factor is calculated through the following steps:

[0157] Multiply the total pixel width by the total pixel height to obtain the total number of global pixels in the image; traverse all pixels in the entire original weld image and sum the defect feature enhancement factors of all pixels to obtain the global enhancement factor sum; divide the global enhancement factor sum by the total number of global pixels in the image to calculate the global mean of the defect feature enhancement factor.

[0158] Subsequently, based on the second-order central moment, the global standard deviation of the defect feature enhancement factor, which characterizes the overall noise fluctuation level of the enhanced image, is calculated through the following steps:

[0159] The entire original weld image is traversed again. The global mean of the defect feature enhancement factor is subtracted from the current pixel's defect feature enhancement factor to obtain the current pixel's enhancement factor deviation. The enhancement factor deviation of each pixel is squared, and the squared results of all pixels are globally summed to obtain the global variance sum. The global variance sum is divided by the total number of pixels in the image, and the square root of the division result is calculated to obtain the global standard deviation of the defect feature enhancement factor.

[0160] By acquiring the total pixel width and total pixel height of the original weld image, the defect feature enhancement factor of the entire original weld image is calculated by iterative summation and division to obtain the global mean. Furthermore, this global mean is combined with the sum of the squares of the enhancement factor deviations of each pixel, divided by the total number of pixels in the image, and then the square root is taken to obtain the global standard deviation of the defect feature enhancement factor. This process statistically analyzes the feature distribution pattern and numerical fluctuation level of the enhanced image matrix from a macroscopic perspective. When dealing with images from different batches or with contrast fluctuations due to ambient light, the global mean and global standard deviation based on the image's own characteristics can objectively reflect the true distribution baseline of the current image background noise, providing an objective boundary for setting the subsequent dynamic threshold that fits the specific image condition.

[0161] The step of calculating the total area of ​​surface defects using the defect feature enhancement factor, the global mean of the defect feature enhancement factor, and the global standard deviation of the defect feature enhancement factor includes:

[0162] This step uses an absolute value sign function constructed by mathematical approximation to directly calculate the total area of ​​the finally identified surface defects;

[0163] Set an infinitesimal positive constant to prevent the denominator from being zero;

[0164] The total area of ​​the finally identified surface defects is calculated using the following steps:

[0165] The global dynamic threshold is obtained by adding the global mean of the defect feature enhancement factor to the global standard deviation of the defect feature enhancement factor. The entire original weld image is traversed, and the global dynamic threshold is subtracted from the defect feature enhancement factor of the current pixel to obtain the step deviation value of the current pixel. The absolute value of the step deviation value is calculated. The absolute value is added to the infinitesimal positive constant to obtain the approximation denominator. The step deviation value is divided by the approximation denominator to obtain the step approximation result value. The step approximation result value is added to a constant 1, and the sum is divided by a constant 2 to calculate the single defect statistical value of the current pixel. The single defect statistical values ​​of all pixels in the entire original weld image are summed to calculate the total area of ​​the finally identified surface defects.

[0166] A global dynamic threshold is constructed by adding the global mean and global standard deviation of the defect feature enhancement factor. Based on this, a step approximation result value is constructed using the step deviation, absolute value, and a set infinitesimal positive constant of the defect feature enhancement factor of the current pixel relative to this threshold. Finally, the total area of ​​the identified surface defects is obtained through constant adjustment and accumulation calculation. This step constructs an absolute value step feature function using the idea of ​​mathematical approximation, transforming the local condition judgment logic into a purely algebraic analytical continuous calculation. When processing the weld pixel matrix, this step statistical method reduces the logical divergence problem caused by pixel-level condition judgment in continuous calculation. The introduction of the infinitesimal positive constant maintains the numerical stability of the division operation, making the statistical area result have analytical stability at the computational level.

[0167] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0168] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for identifying surface defects in steel structure welds based on image enhancement, characterized in that, include: Calculate the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude of the original weld image; Using the first-order spatial gradient values ​​in the horizontal and vertical directions, the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor are calculated. The determinant and topological stability index of the structural tensor are calculated using the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structural tensor. The adaptively adjusted horizontal projection vector and the adaptively adjusted vertical projection vector are calculated using the topological stability index, and then the anisotropic texture continuity metric is calculated. The multi-scale gradient curvature projection value is calculated using the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude. The defect feature enhancement factor is calculated by combining the multi-scale gradient curvature projection value, the anisotropic texture continuity metric value, and the local spatial gradient magnitude. Calculate the global mean and global standard deviation of the defect feature enhancement factor; The total area of ​​surface defects is calculated using the defect feature enhancement factor, the global mean of the defect feature enhancement factor, and the global standard deviation of the defect feature enhancement factor.

2. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 1, characterized in that, The calculation of the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude of the original weld image includes: The weld area of ​​the steel structure is illuminated by an orthogonal polarized coaxial light source, and a single exposure is performed by an industrial camera to acquire a single-channel original weld image, which is then stored in a memory matrix. A two-dimensional Cartesian coordinate system is established with the top left pixel of the original weld image as the origin, the horizontal rightward direction of the image as the positive direction of the x-axis, and the vertical downward direction of the image as the positive direction of the y-axis. Get the grayscale value of the rightmost adjacent pixel of the current pixel; Obtain the grayscale value of the left adjacent pixel of the current pixel; The first-order spatial gradient value of the current pixel in the horizontal direction is calculated by subtracting the gray value of the gray value of the adjacent pixel on the right from the gray value of the adjacent pixel on the left. Obtain the grayscale value of the pixel immediately below the current pixel; Obtain the grayscale value of the pixel adjacent to the current pixel above it; The first-order spatial gradient value in the vertical direction of the current pixel is calculated by subtracting the gray value of the gray value of the adjacent pixel below from the gray value of the adjacent pixel above. The first squared value is obtained by squaring the first-order spatial gradient value in the horizontal direction. The second squared value is obtained by squaring the first-order spatial gradient value in the vertical direction. The first squared value is added to the second squared value, and the square root of the addition result is calculated to obtain the local spatial gradient amplitude of the original weld image.

3. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 2, characterized in that, The calculation of the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor using the first-order spatial gradient values ​​in the horizontal and vertical directions includes: Obtain the total pixel width of the original weld image corresponding to the camera's photosensitive array, and set the window scaling factor; Multiply the total pixel width of the original weld image by the window scaling factor and round down. Use the rounded result as the calculation radius of the local summation window. Within a local summation window determined by the computational radius, the first-order spatial gradient value in the horizontal direction at each offset position is obtained; The first-order spatial gradient value in the horizontal direction at each offset position is squared, and all squared results within the local summation window are double-summed to obtain the horizontal autocorrelation component of the structure tensor. Within a local summation window determined by the computational radius, the first-order spatial gradient value in the vertical direction of each offset position is obtained; The first-order spatial gradient value in the vertical direction at each offset position is squared, and all squared results within the local summation window are double-summed to obtain the vertical autocorrelation component of the structure tensor. Multiply the first-order spatial gradient value in the horizontal direction of each offset position within the local summation window with its corresponding first-order spatial gradient value in the vertical direction to obtain the local correlation product; perform double summation on all the local correlation products within the local summation window to calculate the cross-correlation components of the structure tensor.

4. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 3, characterized in that, The calculation of the determinant and topological stability index of the structure tensor using the horizontal autocorrelation component, the vertical autocorrelation component, and the cross-correlation component of the structure tensor includes: Multiply the horizontal autocorrelation component of the structure tensor with the vertical autocorrelation component of the structure tensor to obtain the first tensor product; The cross-correlation components of the structure tensor are squared to obtain the second tensor product; Subtract the product of the second tensor from the product of the first tensor to calculate the determinant value of the structure tensor; The horizontal autocorrelation component of the structure tensor is squared to obtain the product of the third tensor. The autocorrelation component in the vertical direction of the structure tensor is squared to obtain the fourth tensor product. Add the product of the third tensor to the product of the fourth tensor, and add a constant 1 to the result of the addition to obtain the topologically stable denominator. The topological stability index is calculated by dividing the determinant value of the structure tensor by the topological stability denominator.

5. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 4, characterized in that, The step of calculating the adaptively adjusted horizontal projection vector and the adaptively adjusted vertical projection vector using the topological stability index, and then calculating the anisotropic texture continuity metric, includes: Subtracting the vertical autocorrelation component of the structure tensor from the horizontal autocorrelation component of the structure tensor yields the autocorrelation tensor difference. The autocorrelation tensor difference is multiplied by the topological stability index to calculate the adaptively adjusted horizontal projection vector. Multiply the constant 2 by the cross-correlation component of the structure tensor to obtain the cross-correlation adjustment value; The cross-correlation adjustment value is multiplied by the topological stability index to calculate the adaptively adjusted vertical projection vector of the orthogonal plane; Multiply the first-order spatial gradient value in the horizontal direction with the adaptively adjusted horizontal projection vector to obtain the horizontal projection continuity product; Multiply the first-order spatial gradient value in the vertical direction with the adaptively adjusted vertical projection vector to obtain the vertical projection continuity product; The anisotropic texture continuity metric is calculated by adding the horizontal projection continuity product and the vertical projection continuity product.

6. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 5, characterized in that, The calculation of multi-scale gradient curvature projection values ​​using the first-order spatial gradient value in the horizontal direction, the first-order spatial gradient value in the vertical direction, and the local spatial gradient magnitude includes: Obtain the first-order spatial gradient value in the horizontal direction at the offset position to the right of the current pixel; Obtain the first-order spatial gradient value in the horizontal direction at the left offset position of the current pixel; Subtracting the first-order spatial gradient value in the horizontal direction from the first-order spatial gradient value in the horizontal direction at the right offset position yields the horizontal gradient difference value. Obtain the first-order spatial gradient value in the vertical direction at the offset position below the current pixel; Obtain the first-order spatial gradient value in the vertical direction at the offset position above the current pixel; Subtract the first-order spatial gradient value in the vertical direction of the upper offset position from the first-order spatial gradient value in the vertical direction of the lower offset position to obtain the vertical gradient difference value. Add the horizontal gradient difference value to the vertical gradient difference value to obtain the curvature numerator. Adding a constant 1 to the magnitude of the local spatial gradient yields the curvature denominator. Divide the numerator of curvature by the denominator of curvature to calculate the multi-scale gradient curvature projection value that characterizes the surface concavity and convexity.

7. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 6, characterized in that, The calculation of the defect feature enhancement factor by combining the multi-scale gradient curvature projection value, the anisotropic texture continuity metric value, and the local spatial gradient magnitude includes: The local spatial gradient magnitude of the original weld image is cubically calculated to obtain the magnitude cube term; Adding a constant 1 to the cubic term of the amplitude yields the enhanced normalized denominator term; Divide the anisotropic texture continuity measure by the enhanced normalization denominator to obtain the dimensionless continuity measure. The defect feature enhancement factor is calculated by subtracting the dimension reduction continuity metric from the multi-scale gradient curvature projection value.

8. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 7, characterized in that, The calculation of the global mean and global standard deviation of the defect feature enhancement factor includes: Obtain the total pixel width and total pixel height of the raw weld image determined by the camera hardware output array; Multiply the total pixel width by the total pixel height to obtain the total number of pixels in the image. The entire original weld image is traversed, and the defect feature enhancement factors of all pixels are summed to obtain the global enhancement factor sum. The global mean of the defect feature enhancement factor is calculated by dividing the sum of the global enhancement factors by the total number of pixels in the image. The entire original weld image is traversed again, and the global mean of the defect feature enhancement factor is subtracted from the defect feature enhancement factor of the current pixel to obtain the enhancement factor deviation of the current pixel. The enhancement factor deviation of each pixel is squared, and the squared results of all pixels are globally summed to obtain the global variance. The global variance is divided by the total number of pixels in the image, and the square root of the division result is taken to calculate the global standard deviation of the defect feature enhancement factor.

9. The method for identifying surface defects in steel structure welds based on image enhancement according to claim 8, characterized in that, The step of calculating the total area of ​​surface defects using the defect feature enhancement factor, the global mean of the defect feature enhancement factor, and the global standard deviation of the defect feature enhancement factor includes: Set an infinitesimal positive constant to prevent the denominator from being zero; The global dynamic threshold is obtained by adding the global mean of the defect feature enhancement factor to the global standard deviation of the defect feature enhancement factor. Traverse the entire original weld image, subtract the global dynamic threshold from the defect feature enhancement factor of the current pixel to obtain the step deviation value of the current pixel; Calculate the absolute value of the step deviation; add the absolute value to the infinitesimal positive constant to obtain the approximate denominator term; Divide the step deviation value by the approximation denominator term to obtain the step approximation result value; Add a constant 1 to the step approximation result value, and divide the sum by a constant 2 to calculate the single defect statistics value of the current pixel. The total area of ​​surface defects identified is calculated by summing the statistical values ​​of all pixels in the entire original weld image.