A method for evaluating laser welding quality

By dynamically adjusting the local area size and multi-dimensional feature descriptor of the welding image, combining clustering and weight calculation, the problem of insufficient consideration of parameter sensitivity and overall information in welding quality evaluation by traditional adaptive threshold segmentation algorithm is solved, and a higher precision welding quality evaluation is achieved.

CN119313697BActive Publication Date: 2025-05-09WUXI CHAOQIANGWEIYE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411857489.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-05-09
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

The traditional adaptive threshold segmentation algorithm has problems such as parameter sensitivity and poor consideration of overall image information in welding quality evaluation, resulting in insufficient accuracy and accuracy of segmentation results.

Method used

By setting the initial area and adaptive segmentation threshold for pixel points in the welding image, dynamically adjusting the size of the local area, combining the feature values of multiple dimensions to form a feature descriptor, using clustering and weight calculation to calculate the adjustment threshold, and performing adaptive threshold segmentation to evaluate welding quality.

Benefits of technology

It improves the accuracy and reliability of welding quality evaluation, and can more accurately capture the overall characteristics of the weld edge and smooth area, reduce noise sensitivity, and improve the accuracy of segmentation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313697B_ABST
    Figure CN119313697B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and in particular to a laser welding quality assessment method, comprising: obtaining a grayscale image of a welding image, dynamically adjusting the size of an initial area of ​​each pixel to determine a local area of ​​each pixel, forming a feature descriptor of each pixel with feature values ​​of multiple dimensions of the local area, calculating the similarity of all pixels based on the feature descriptors of all pixels, clustering based on the similarity, calculating the weight of each category after clustering, adjusting the initial adaptive segmentation threshold of each pixel according to the weight of each category and the average feature value of the feature descriptors of the pixels included in the category in each dimension, performing adaptive threshold segmentation, and assessing welding quality based on the result of the adaptive threshold segmentation, thereby improving the accuracy of the adaptive threshold segmentation and the accuracy of the welding quality assessment result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for evaluating the quality of laser welding. Background Art

[0002] Laser welding is a common welding technology. In many industrial fields, such as buildings, bridges, ships, pressure vessels and pipelines, a large number of welded structures are usually used, and these structures often bear huge static or dynamic loads. As a connection part, the quality of the welded joint is directly related to the safety of the entire structure. Therefore, it is of great significance to evaluate the quality of laser welding. The evaluation of welding quality involves many aspects, such as the continuity of the weld, the presence or absence of cracks, pores, slag inclusions and other defects. Traditional methods rely on manual operation, such as inspectors directly observing the surface shape, size and appearance quality of the weld with the naked eye. For example, check whether the weld is continuous and uniform, and whether there are defects such as undercuts, weld bumps, and surface pores. This method is highly subjective and inefficient, and it is easy to miss some minor defects.

[0003] With the development of technology, the existing image processing introduces welding quality assessment, which is mainly to collect welding surface images and then segment and extract weld areas, and evaluate the welding quality based on the characteristics of the weld areas. Adaptive threshold segmentation is a common image processing method, which divides the image into multiple small areas (such as rectangular or circular neighborhoods), and then calculates the threshold in each area to achieve image segmentation. For example, the existing Chinese patent document with the authorization announcement number CN117058144B discloses a defect recognition method and system for weld images, which includes: obtaining X-ray weld images and preprocessing the weld images; performing image enhancement processing on the preprocessed weld images based on an adaptive histogram to obtain a weld image to be identified; binarizing the weld image to be identified, and obtaining multiple defect areas based on adaptive threshold segmentation.

[0004] The traditional adaptive threshold segmentation algorithm adopted in the above scheme has parameter sensitivity and poor consideration of the overall information of the image. Among them, the parameter sensitivity is mainly reflected in the selection of the size of the local area. The selection of the local area size of each pixel in the adaptive threshold segmentation algorithm is often a preset fixed size. If the area selection is too large, for the local area with drastic grayscale changes in the welding image (such as the transition zone between the weld and the base material), the detail information cannot be accurately captured, resulting in blurred edges and inability to accurately detect tiny defects at the edge of the weld. On the contrary, if the area selection is too small, although the local details can be better preserved, the amount of calculation will increase, and it will be more sensitive to noise, because there are fewer data points in each small area, and the impact of noise on the threshold calculation is relatively greater. Among them, the poor consideration of the overall information of the image is mainly reflected in the fact that the traditional adaptive threshold segmentation often ignores the overall characteristics of the image, which leads to a decrease in the accuracy of the segmentation result when processing the overall structure or large-scale defects. In short, these two defects will affect the accuracy of the segmentation result, and then affect the accuracy of the welding quality assessment. Summary of the invention

[0005] In order to solve the problem that when using a traditional adaptive threshold segmentation algorithm to process welding images for welding quality assessment, the traditional adaptive threshold segmentation algorithm has parameter sensitivity and poor consideration of the overall image information, which easily affects the accuracy of the segmentation result and the accuracy of the welding quality assessment result, the present invention proposes a laser welding quality assessment method, comprising:

[0006] An initial region and an initial adaptive segmentation threshold are set for the pixels in the welding image, and the size of the initial region of the pixels is dynamically adjusted according to the mean of the gradient amplitude of all pixels in the initial region of the pixels and the mean of the spatial frequency of all pixels to obtain the local region of the pixels;

[0007] The gradient amplitude, gradient direction, grayscale change intensity, skewness and kurtosis of the grayscale value distribution of all pixels in the local area of ​​the pixel are used as feature values ​​of multiple dimensions to form a feature descriptor of the pixel. The similarity between every two pixels is calculated based on the feature descriptor, and all pixels are clustered based on the similarity to obtain multiple categories.

[0008] Calculate the weight of each category , For the The weight of each category, For the The area ratio of pixels in each category in the grayscale image. For the The feature descriptors of the pixels in the category are The mean of the normalized values ​​of the eigenvalues ​​in the dimensions, is the feature descriptor of the pixels contained in all categories in the The mean of the normalized values ​​of the eigenvalues ​​in the dimensions, is the feature descriptor of the pixels contained in all categories in the The standard deviation of the eigenvalues ​​in the dimension, is the total number of categories, is the total number of dimensions, For the The mean of the initial adaptive segmentation thresholds for the pixels in each category;

[0009] According to the weight of the category to which the pixel belongs and the average feature value of the feature descriptors of the pixels in the category in each dimension, the initial adaptive segmentation threshold of the pixel is adjusted according to the following relationship:

[0010] , yes The initial adaptive segmentation threshold of the pixel at yes The adaptive segmentation threshold after the pixel point is adjusted, is the total number of categories, is the total number of dimensions, For the The pixels in the category are The coefficients of the eigenvalues ​​of the dimensions, For the The feature descriptors of the pixels in the category are The mean of the normalized values ​​of the eigenvalues ​​in the dimensions, is the mean of the initial adaptive segmentation thresholds of all pixels in all categories;

[0011] The welding image is adaptively segmented according to the adaptive segmentation threshold adjusted for all pixels, and the welding quality is evaluated based on the result of the adaptive threshold segmentation.

[0012] The above scheme can simplify image information by obtaining grayscale images, which is convenient for subsequent processing. Setting the initial area and adaptive segmentation threshold for each pixel point lays the foundation for subsequent dynamic adjustment and precise segmentation; considering the gradient amplitude and spatial frequency of the pixel point, it can more accurately reflect the local features of the image, and dynamically adjusting the size of the local area can adapt to different image areas and improve the accuracy of segmentation; using the eigenvalues ​​of multiple dimensions can more comprehensively describe the features of the pixel points and improve the accuracy of similarity calculation. Clustering can classify pixels with similar features into one category, providing more targeted processing for subsequent threshold adjustment and segmentation. By calculating the weight size, the threshold can be adjusted according to the importance of different categories, so that the segmentation is more in line with the actual situation of the image. Considering the average eigenvalue can make the threshold adjustment more accurately reflect the characteristics of each category. The adaptive segmentation threshold can be adjusted according to different parts of the image, making the segmentation more accurate. Evaluating the welding quality based on the segmentation results can more intuitively understand the quality of welding, thereby improving the reliability of welding quality evaluation.

[0013] Preferably, the method for calculating the similarity between every two pixels based on the feature descriptor is:

[0014] Counting pixels Feature descriptors and pixels The Euclidean distance of the feature descriptor in high-dimensional space , and then use the Gaussian kernel function to obtain The mapping value of ,Will As a pixel and pixels similarity.

[0015] Preferably, the method for dynamically adjusting the size of the initial area is:

[0016] Preset gradient amplitude threshold and spatial frequency threshold ; Take the grayscale values ​​of all pixels in the initial area of ​​each pixel as a two-dimensional signal, perform a two-dimensional Fourier transform, and obtain a complex matrix. Each complex number in the complex matrix corresponds to an amplitude, and the corresponding amplitude matrix is ​​obtained. The mean of the amplitude matrix is ​​taken as the mean of the spatial frequency of all pixels. ; and obtain the mean value of the gradient amplitude of all pixels in the initial area ; Setting condition 1: Greater than and Greater than ; Condition 2: Less than and Less than ; Condition 3: Other cases except conditions 1 and 2; If condition 1 is met, the size of the initial area is reduced to half of the original size; If condition 2 is met, the size of the initial area is expanded to twice the original size; If condition 3 is met, the size of the initial area remains unchanged.

[0017] The above technical solution takes into account that at the edge of the welding image, such as the edge of the weld, the gradient amplitude and spatial frequency are relatively high. Shrinking the local area can focus on the details of the edge and more accurately describe the edge features, which helps to more accurately divide the weld boundary in subsequent segmentation and quality assessment. For the relatively smooth parts inside the welding area, expanding the local area can avoid misjudgment due to small local fluctuations, and better consider the overall grayscale changes in the internal area, thereby more accurately assessing the welding quality. This method of dynamically adjusting the size of the local area can adaptively optimize the local area of ​​each pixel according to the actual characteristics of the image, thereby improving the accuracy and adaptability of the entire welding quality assessment method.

[0018] Preferably, the method for obtaining the grayscale change intensity of all pixels in the local area of ​​each pixel is:

[0019] set up The local area of ​​the pixel The grayscale change intensity of all pixels in the horizontal direction And the grayscale change intensity in the vertical direction They are:

[0020] ;

[0021] ;

[0022] In the formula, yes The coordinates of the pixels in for The gray value of the pixel at is the number of pixels in the local area;

[0023] calculate The grayscale change intensity of all pixels in the local area of ​​the pixel at .

[0024] The above technical solution is achieved by The local area of ​​the pixel The grayscale change intensity of all pixels in the horizontal direction And the grayscale change intensity in the vertical direction Synthesis can fully reflect the grayscale changes in the local area. In welding images, the shape and direction of welds or welding defects are complex and diverse, and contain grayscale changes in both horizontal and vertical directions. By calculating the total grayscale change intensity, these complex grayscale change features can be captured more accurately.

[0025] Preferably, the method for obtaining the coefficient of the eigenvalue is:

[0026] First calculate the All pixels in the category The intra-class variance of the feature values ​​of the dimensions, and All pixels in the category The feature values ​​of the dimension and all the pixels contained in each other category are in the The inter-class variance value of the feature value of the dimension is obtained, and a total of 1 intra-class variance value and The between-class variance values ​​are The ratio of the mean of the inter-class variance values ​​to the intra-class variance value is taken as the The pixels in the category are The coefficients of the eigenvalues ​​of the dimensions .

[0027] The above technical solution uses the ratio of the mean of multiple inter-class variance values ​​to one intra-class variance value as the coefficient , taking into account the consistency within the class and the difference between classes, this coefficient can accurately adjust the contribution of feature values ​​of different dimensions in the threshold calculation.

[0028] Preferably, the method for evaluating welding quality based on the result of adaptive threshold segmentation is:

[0029] Determine the standard ranges of the texture features and shape features of the welding area based on a plurality of welding images that meet the standards collected in advance;

[0030] For any area after the adaptive threshold segmentation of the current grayscale image, the area is judged as a normal welding area only when the texture features and shape features of the area are within their respective standard ranges. The remaining areas in the current grayscale image except all normal welding areas are regarded as defective areas, and the welding quality is evaluated based on the proportion of the number of all defective areas and the proportion of the area of ​​all defective areas.

[0031] Preferably, the method for evaluating welding quality based on the number ratio of all defective areas and the area ratio of all defective areas is:

[0032] Calculate the ratio of all defect areas to the number of all areas , and the ratio of the area of ​​all defective regions to the area of ​​all regions ;

[0033] set up , are the first and second thresholds of the quantity ratio, , are the first threshold and the second threshold of the area ratio respectively;

[0034] Setting condition 1: and ; Condition 2: and ; Condition 3: Other situations except conditions 1 and 2; If condition 1 is met, the welding quality is superior, if condition 2 is met, the welding quality is medium, and if condition 3 is met, the welding quality is inferior.

[0035] Preferably, the method for determining the standard ranges of the texture features and shape features of the welding area based on the pre-collection of a plurality of welding images that meet the standards is:

[0036] The standard range of texture features of the welding area includes: the standard range of contrast of the grayscale co-occurrence matrix of the welding area, the standard range of grayscale entropy of the welding area; the standard range of shape features of the welding area includes: the standard range of aspect ratio of the welding area and the standard range of circularity;

[0037] A plurality of welding images meeting the standards are collected in advance, and all welding areas are segmented out according to the adaptive segmentation threshold after each pixel is adjusted in the plurality of welding images meeting the standards, and the contrast, grayscale entropy, aspect ratio and circularity of the grayscale co-occurrence matrix of each welding area are calculated; and a standard range of contrast, a standard range of grayscale entropy, a standard range of aspect ratio and a standard range of circularity of the grayscale co-occurrence matrix of the welding area are obtained according to all welding areas meeting the standards.

[0038] The present invention has the following effects: the laser welding quality assessment method proposed in the present invention dynamically adjusts the size of the local area of ​​each pixel by considering the gradient amplitude and the mean value of the spatial frequency of the pixel point. In the welding image, for local areas with drastic grayscale changes such as the transition zone between the weld and the base material, the local area can be automatically reduced to focus on details, accurately capture the tiny defects at the edge of the weld, and avoid edge blur; for relatively smooth areas, the local area can be expanded to reduce the sensitivity to noise, while avoiding the problem of excessive calculation amount in small local areas, and the feature descriptor of the pixel point is formed by using eigenvalues ​​of multiple dimensions to comprehensively describe the pixel point features. Based on the feature descriptors of all pixel points, similarities are calculated and clustered, and pixels with similar features are classified into one category. The overall features and local features of the image are fully considered. When processing overall structures or large-scale defects, segmentation can be performed more accurately, the accuracy of the segmentation results is improved, and the accuracy of welding quality assessment is thereby improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0040] Figure 1 It is a schematic flow chart of the method of the present invention;

[0041] Figure 2 It is a schematic diagram of the method flow of step S3 of the present invention. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0043] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0044] Reference Figure 1 The laser welding quality assessment method provided by the present invention comprises steps S1 to S7:

[0045] S1: Obtain the grayscale image of the welding image, set the initial area of ​​each pixel and the initial adaptive segmentation threshold.

[0046] A high-resolution industrial camera is used to aim the camera at the welding part of the welded part to collect the corresponding welding image, which includes the base material and the weld. Then, the collected welding image is preprocessed, including: using histogram equalization or gamma correction to improve the image contrast, applying median filtering, bilateral filtering or other denoising algorithms to reduce image noise, while retaining edge information, and then graying to obtain the corresponding grayscale image. The grayscale image removes color information, reducing the amount of data and computational complexity.

[0047] Then, an initial region and an initial adaptive segmentation threshold are set for each pixel in the grayscale image. The setting of the initial region and the adaptive segmentation threshold provides a starting point, which can be adjusted later according to the specific situation to make the segmentation more accurate.

[0048] Specifically, a uniform initial region size is set for all pixels in the grayscale image. The pixel point at which the initial region is set to , where the local area is a rectangle, Indicates the side length and the initial area size It can be determined based on the diagonal length of the grayscale image:

[0049]

[0050] In the formula, is the width of the grayscale image, is the height of the grayscale image, is an adjustable parameter. Generally speaking, The larger the value, the smaller the initial area.

[0051] When the image resolution is high, that is, the grayscale image and When it is larger, if A small value will result in an overly large initial area, which may make it difficult to capture the detailed changes in the welding area when calculating the threshold, especially for some minor welding defects or complex weld textures (such as fish scale welds), which may be smoothed out. On the contrary, if If the value is too large and the initial area is too small, the amount of calculation will increase and it will be more sensitive to noise. Because there are fewer data points in each small area, the impact of noise on threshold calculation is relatively greater, which can easily lead to a large number of fragments or wrong edges in the segmentation result.

[0052] Therefore, this step determines the Range and recommended values:

[0053] When the grayscale image is a low-resolution image with a width and height less than 500 pixels, in this case Set between 5 and 10. The reason is that for simple welding images, smaller local areas can adapt to the grayscale changes between the weld and the base material more quickly, and because the image resolution is low, it will not cause excessive noise interference due to the small local area. The calculated initial region size is relatively moderate.

[0054] When the grayscale image is a medium-resolution image with a width and height of 500-1000 pixels, in this case, Set between 10-20. This is because with the improvement of image resolution and the increase of complexity of welding area, it is necessary to appropriately enlarge the local area to balance detail capture and noise suppression. This can take into account the details of the weld edge and the resistance to interference factors such as texture to a certain extent. For example, for a welding image with a width of 800 pixels and a height of 600 pixels, When the value is 15, the calculated initial region size is approximately equal to 82.

[0055] When the grayscale image is a high-resolution image with a width and height greater than 1000 pixels, Set between 20-50. , since high-resolution images contain more detailed information, larger It can avoid the loss of details due to the local area being too large. At the same time, for complex welding areas, smaller local areas can better adapt to local grayscale changes. For example, for a welding image with a width of 1500 pixels and a height of 1200 pixels, when K=30, the initial area size is approximately equal to 351 pixels, which can make the algorithm more flexible in processing complex welding textures and details, and reduce over-segmentation or wrong segmentation.

[0056] Next, an initial adaptive segmentation threshold is set for all pixels, based on the grayscale image. As an example, based on the pixel point at The pixel information contained in the initial area of ​​the pixel at The initial adaptive segmentation threshold of the pixel at:

[0057]

[0058] In the formula, yes The initial adaptive segmentation threshold of the pixel at is a constant less than 1, used to control the distance between the threshold and the local mean. is a constant, usually set to 0, used to fine-tune the threshold. yes The number of pixels, Is located in the initial area The gray value of the pixel at yes The initial area of ​​the pixel at .

[0059] S2: Dynamically adjust the size of the initial area of ​​each pixel to determine the local area of ​​each pixel.

[0060] In this step, for each pixel, the size of the initial area of ​​the pixel is dynamically adjusted according to the mean of the gradient amplitude of all pixels in the initial area of ​​the pixel and the mean of the spatial frequency of all pixels, and the size of the local area of ​​each pixel is finally determined. Taking into account the gradient amplitude and spatial frequency of the pixels in the initial area can more accurately reflect the local features of the image and improve the accuracy of segmentation.

[0061] The gradient magnitude of a pixel is a basic concept in image processing. It indicates the rate of change of the image at that point. The Sobel operator, Prewitt operator, or Scharr operator can be used to calculate the gradient direction and gradient magnitude of the pixel. The pixel point at which the gradient amplitude of all pixels in the initial area is calculated as );

[0062] Among them, spatial frequency refers to the speed of grayscale changes in an image, which is similar to the concept of frequency in signal processing. For an image, spatial frequency can be used to describe the richness of detail information in the image. High spatial frequency areas indicate that there are more details and fast grayscale changes in the image, such as the edge part of the image; while low spatial frequency areas indicate slow grayscale changes and fewer details, such as the smooth area in the image.

[0063] Therefore, for the grayscale image The spatial frequency of the initial area of ​​the pixel at the position is, specifically, the grayscale values ​​of all the pixels in the initial area are regarded as a two-dimensional signal, that is, the grayscale values ​​of all the pixels in the initial area are put together, just like arranging them in a table, which forms a two-dimensional signal. The two-dimensional signal is subjected to a two-dimensional Fourier transform. The result of the two-dimensional Fourier transform is a complex matrix, which reflects the frequency information in the initial area. Each complex number is in the form of ,in, is the real part, is the imaginary part. Each complex number in this complex matrix corresponds to an amplitude, the magnitude of which represents the intensity of different frequency components, and the amplitude is equal to , and then get an amplitude matrix, and take the mean of the amplitude matrix as the mean of the spatial frequency of the initial area .

[0064] Next, set the dynamic adjustment rules:

[0065] Preset gradient amplitude threshold and spatial frequency threshold , for grayscale images The pixel point at which the pixel point is dynamically adjusted is recorded as ;

[0066] like ,and , the size of the initial area of ​​the pixel is reduced to half of the original size, that is:

[0067]

[0068] This is because in areas with large gradient amplitude and high spatial frequency, there may be finer details, and a smaller local area is needed to capture local features. In terms of welding quality inspection, this phenomenon is particularly evident near the edge of the weld. There is a significant grayscale change at the boundary between the weld and the base material, which directly leads to the threshold At the same time, the texture characteristics of the weld edge are also very complex, such as irregular edges and tiny undercuts. In this case, in order to analyze the details of the welding image more deeply and accurately, it is necessary to reduce the local area. By reducing the local area, it is possible to focus more on these areas with rich details.

[0069] like ,and , then the size of the initial area of ​​the pixel is expanded to twice its original size, that is:

[0070]

[0071] This reflects that within the initial area of ​​the current pixel, the information contained in the pixel (such as texture, grayscale changes, etc.) is not rich enough, which makes it impossible to reflect the real structure or feature differences of the image well. Therefore, it is enlarged. In the welding quality inspection image, if the local area is too small, some defects that need to be observed from a larger range (such as large-area pore distribution or irregular shape of the overall weld) may not be effectively detected. After expanding the local area, the information of more pixel points can be comprehensively considered, so that the threshold and features can better reflect the actual situation in the image.

[0072] Furthermore, if and and and In other cases except these two, the initial area remains unchanged, that is:

[0073]

[0074] This situation reflects the initial area at this pixel The pixels within are in a relatively stable state, the grayscale changes are relatively smooth, and there are no obvious defect features. If the local area size is changed arbitrarily, unnecessary computational complexity may be introduced, and the feature description of these normal areas may even be destroyed. The current local area size can already well reflect the characteristics of the local area, and there is no need to adjust the local area size.

[0075] In summary, the scheme of this step reflects the edge information of the image through the gradient amplitude and reflects the detail changes of the image through the spatial frequency. The size of the initial area is adjusted based on these two indicators. After the adjustment, the local area of ​​each pixel is determined, so that the local area of ​​each pixel can be better adapted to different parts of the image. For example, in the edge area, the gradient amplitude is large, and a smaller local area may be required to more accurately capture the edge features; in the smooth area, the spatial frequency is low, and a larger local area may be required to better consider the overall information.

[0076] S3: Construct a high-dimensional feature descriptor for each pixel.

[0077] Specifically, the gradient amplitude, gradient direction, grayscale change intensity, skewness and kurtosis of grayscale value distribution of all pixels in the local area of ​​each pixel are used as feature values ​​of multiple dimensions to form a feature descriptor of the pixel.

[0078] Among them, the gradient amplitude and gradient direction can describe the edge and texture characteristics of the image, the grayscale change intensity can reflect the contrast of the image, and the skewness and kurtosis can describe the shape of the grayscale value distribution. The feature descriptors composed of these eigenvalues ​​can more comprehensively reflect the characteristics of the pixel points.

[0079] S31: For each pixel point of the grayscale image, obtain its gradient direction.

[0080] For example, for a grayscale image Get the gradient direction of the pixel at .

[0081] S32: Calculate the grayscale change intensity of each pixel of the grayscale image.

[0082] The details are as follows:

[0083] set up The local area of ​​the pixel The grayscale change intensity of all pixels in the horizontal direction for:

[0084]

[0085] in the formula , for The gray value of the pixel at express The gray value of the pixel at .

[0086] In this formula, It represents the difference in grayscale values ​​between two adjacent pixels in the local area in the horizontal direction. The squares of these differences are first summed and then divided by the number of pixels in the local area. , and finally take the square root to get , It reflects the frequency of grayscale value changes in the horizontal direction of all pixels in the local area. If the horizontal frequency is high, it means that the grayscale values ​​of all pixels in the local area change frequently in the horizontal direction, and there may be more horizontal textures or details.

[0087] set up The local area of ​​the pixel The grayscale change intensity of all pixels in the vertical direction for:

[0088]

[0089] In the formula, yes The coordinates of the pixel points in . It represents the difference between the grayscale values ​​of two adjacent pixels in the vertical direction. The pixel value here is also the grayscale value. It reflects the frequency of grayscale value changes of all pixels in the local area in the vertical direction.

[0090] calculate The grayscale change intensity of all pixels in the local area of ​​the pixel at:

[0091]

[0092] In the formula, yes The grayscale change intensity of all pixels in the local area of ​​the pixel at . is through and It is synthesized by taking into account the frequency of grayscale value changes in the horizontal and vertical directions of the local area. The larger the value is, the more likely it is that the grayscale value of the pixels in the local area changes frequently in the horizontal and / or vertical directions, and the local area is more likely to contain rich texture or detail information. The smaller it is, the less frequent the change in the grayscale value of the pixels in the local area is, which may be a relatively smooth area.

[0093] S33: Extract the skewness and kurtosis of the grayscale distribution of all pixels in the local area of ​​each pixel.

[0094] For grayscale images , extract the skewness of the grayscale distribution of all pixels in its local area and Kurtosis .

[0095] Among them, skewness is a statistic that describes the asymmetry of data distribution. For a set of data, it measures the direction and degree of skewness of the data distribution.

[0096] For grayscale images The skewness of the gray value distribution of all pixels in the local area of ​​the pixel at The calculation formula is:

[0097]

[0098] In the formula, and They are The mean grayscale value of all pixels and the standard deviation of the grayscale value of all pixels, is the total number of pixels in the local area.

[0099] The significance of the skewness calculated in this step in the welding quality assessment process is that in the welding image, the pixel grayscale distribution of the normal welding area and the defective welding area presents different asymmetries. For the normal welding area, its grayscale distribution is usually relatively symmetrical. For example, in the case of ideal uniform welding, the grayscale value of the weld metal fluctuates around a mean value, and the skewness is close to 0. However, when welding defects occur, the skewness may change. If the skewness is greater than 0 (positive skewness), it may indicate that there are some welding defects that cause the pixel grayscale value to be too large. For example, when a weld nodule appears during welding, the grayscale value of the weld nodule is usually high, so that the pixel grayscale distribution in the local area has a long tail on the right side (the larger value side), that is, the grayscale values ​​of most pixels are concentrated at a low level, while a few pixels with high grayscale values ​​caused by the weld nodule "stretch" the distribution of grayscale values, and the skewness is greater than 0. On the contrary, when the skewness is less than 0 (negative skewness), it may indicate the presence of defects that make the grayscale value smaller, such as undercut or lack of fusion. These defects will cause some pixels with lower grayscale values ​​in the local area, causing the grayscale value distribution to have a long tail on the left.

[0100] Among them, kurtosis is a statistic used to describe the distribution of data. The kurtosis value of normal distribution is 0. If the kurtosis is greater than 0, it means that the data distribution is more "peaked and thick-tailed" than the normal distribution; if the kurtosis is less than 0, it means that the data distribution is more "flat" than the normal distribution. Here, the kurtosis can be used to determine the characteristics of the gray value distribution of pixels in a local area.

[0101] For grayscale images The kurtosis of the gray value distribution of all pixels in the local area of ​​the pixel at The calculation formula is:

[0102]

[0103] The significance of the kurtosis calculated in this step in the process of evaluating welding quality: In the welding quality detection scenario, kurtosis can help determine the shape of the grayscale value distribution of the pixels in the local area of ​​the welding image. If the distribution of the grayscale values ​​of the pixels in the normal welding area is close to the normal distribution (kurtosis is 0), it means that the welding quality in this area may be relatively uniform, and the grayscale values ​​of the pixels do not have an obvious concentration or discrete trend. When the kurtosis is greater than 0, the distribution of the grayscale value is more "peaked and thick-tailed" than the normal distribution. In the welding image, this may indicate that the grayscale values ​​of all the pixels in the local area are concentrated. For example, when a porosity defect occurs, the grayscale values ​​of the pixels around the pores may be concentrated, because the difference in the grayscale values ​​of the pixels inside the pores and the pixels around the pores is obvious, making the distribution of the grayscale values ​​of the pixels more "peaked" and the kurtosis greater than 0. On the contrary, when the kurtosis is less than 0, that is, the distribution of the grayscale values ​​of the pixels is flatter than the normal distribution, it reflects that the distribution of the grayscale values ​​of the pixels is more dispersed. This may be due to the presence of defects such as slag inclusions in the welding area. The presence of slag inclusions makes the distribution of the grayscale values ​​of the pixels more dispersed, resulting in a decrease in kurtosis.

[0104] In summary, kurtosis can reflect the overall shape change of the grayscale value distribution of all pixels in the local area, and skewness can provide information about the asymmetry of the distribution. The combination of the two can more comprehensively describe the characteristics of the grayscale values ​​of pixels in the local area.

[0105] S34: Construct a high-dimensional feature descriptor for each pixel.

[0106] For grayscale images The pixel point at , the final constructed feature descriptor is:

[0107]

[0108] The feature descriptor is a high-dimensional vector, where express The gradient amplitude of the pixel at express The gradient direction of the pixel at is the grayscale change intensity of all pixels in the local area of ​​the pixel, , are the skewness and kurtosis of the grayscale value distribution of all pixels in the local area of ​​the pixel, respectively.

[0109] S4: Calculate the similarity of all pixels in the high-dimensional space based on the feature descriptors, and cluster all pixels based on the similarity.

[0110] Using feature values ​​of multiple dimensions can more comprehensively describe the features of pixels and improve the accuracy of similarity calculation. Clustering can group pixels with similar features into one category, providing more targeted processing for subsequent threshold adjustment and segmentation. By calculating similarity and performing clustering, similar pixels can be grouped together, making subsequent processing more targeted to different feature areas. For example, for pixels in edge areas, they may have similarities in gradient amplitude and gradient direction, and can be grouped into one category for processing; for pixels in smooth areas, they may have similarities in grayscale change intensity and skewness and kurtosis, and can also be grouped into one category for processing.

[0111] Among them, the method for calculating the similarity of all pixels in high-dimensional space based on the feature descriptors of all pixels is:

[0112] The feature descriptor of each pixel has a 5-dimensional feature value. First, calculate the distance between the feature descriptors of any two pixels. and The feature descriptors of the pixels at are:

[0113] = ;

[0114] = ;

[0115] calculate and The distance in high-dimensional space is , that is, calculation and Distance in 5-dimensional space (the space of eigenvalues ​​in 5 dimensions).

[0116] According to this method, the distance between each pixel and each other pixel in the 5-dimensional space is calculated. and The pixel points at and pixels , the pixel Feature descriptors and pixels The Euclidean distance of the feature descriptor in high-dimensional space is recorded as .

[0117] Next, the Gaussian kernel function is used to map the distance between each pixel and each other pixel in the 5-dimensional space to obtain the mapping value of the distance.

[0118] The Gaussian kernel function is: , in the formula, Represents a multidimensional vector and The mapping value of To adjust the parameters, Represents a multidimensional vector and The distance in the original space, is a natural exponential function.

[0119] Use Gaussian kernel function to get pixel points and The mapping value of the distance in 5-dimensional space is used as the pixel point and pixels similarity;

[0120]

[0121] in the formula , It's a pixel and The mapping value of the distance in the 5-dimensional space. According to this method, the similarity between each pixel and other pixels in the high-dimensional space is obtained.

[0122] Among them, the method of clustering all pixels based on the similarity of all pixels in high-dimensional space is:

[0123] The spectral clustering algorithm is used. This algorithm is a clustering method based on graph theory and matrix operations. The algorithm regards all pixels as a node, forms a graph with all nodes, and forms an edge between every two nodes. The similarity between two nodes is used as the weight of the edge between the two nodes to obtain a similarity graph composed of all pixels, obtain the Laplace matrix of the similarity graph, perform eigendecomposition on the Laplace matrix, obtain multiple eigenvalues ​​and corresponding eigenvectors, and select the smallest one. The eigenvectors corresponding to the non-zero eigenvalues ​​are constructed The matrix of is the number of nodes. Each row of the matrix corresponds to a pixel. The row vectors of the matrix are normalized so that the length of each row vector is 1. Each row vector of the matrix is ​​regarded as a new data point. The clustering algorithm clusters the data points and divides the pixels corresponding to the data points into multiple categories.

[0124] Advantages of using spectral clustering algorithm in welding images:

[0125] The algorithm can handle irregular data distribution shapes well, and is very effective for complex weld shapes and defect distributions in welding images. For example, when the weld has curved and irregular edges or defects (such as pores) of different shapes and sizes, spectral clustering can more accurately divide different regions based on the similarity between pixels (the similarity after mapping by the Gaussian kernel function). The algorithm can make full use of the similarity information of pixels: since the weight of each edge of the similarity graph is determined by the similarity between pixels, it can make full use of the similarity information (mapping value) after the Gaussian kernel function mapping, which makes the spectral clustering algorithm perform well in separating different pixels (such as normal welds and defect areas) and can effectively mine the potential clustering structure in the data. The spectral clustering algorithm can be effectively combined with the mapping value of the Gaussian kernel function, and this combination enables spectral clustering to operate in a space that better reflects the true similarity of pixels.

[0126] S5: Calculate the weight of each category after clustering.

[0127] By calculating the weights, the threshold can be adjusted according to the importance of different categories, so that the segmentation is more in line with the actual situation of the image. For example, the pixels contained in larger categories have higher weights because they represent the main part of the image. Considering the average eigenvalue can make the threshold adjustment more accurately reflect the characteristics of each category. For example, for the category of edge area, since it has larger eigenvalues ​​in gradient amplitude and gradient direction, the threshold can be appropriately increased to better segment the edge; for the category of smooth area, since it has smaller eigenvalues ​​in grayscale change intensity and skewness and kurtosis, the threshold can be appropriately lowered to better segment the smooth area.

[0128] Specifically, the weight of each category after clustering is calculated according to the following formula:

[0129]

[0130] In the formula, For the The weight of each category, For the The area ratio of pixels in each category in the grayscale image. is the total number of categories, is the total number of dimensions, For the The mean of the initial adaptive segmentation thresholds for the pixels in each category. For the The feature descriptors of the pixels in the category are The mean of the normalized values ​​of the eigenvalues ​​in the dimensions.

[0131] In this formula, the reason for calculating the normalized value is that since the feature descriptor of each pixel is a high-dimensional vector containing feature values ​​of multiple dimensions, in order to avoid the feature values ​​of each dimension affecting the calculation due to inconsistent dimensions, the feature descriptors of all pixels contained in each category are first normalized in each dimension, specifically using the minimum-maximum normalization method or Any of the (standard score) normalization methods is used to obtain the normalized value of the feature value of each pixel point contained in the category in each dimension, which is convenient for subsequent calculations and avoids the influence of inconsistent dimensions.

[0132] Therefore, the “eigenvalues” mentioned below all refer to normalized values ​​of the eigenvalues.

[0133] This formula takes into account the area ratio of the pixels contained in each category, reflecting the proportion of the pixels contained in each category in the entire grayscale image. If the pixels contained in a category occupy a larger area in the entire grayscale image, it means that it has a higher importance in the image. A larger area ratio represents the main part of the welding image, and its weight will increase accordingly. By increasing its weight, the final segmentation can be more inclined to the features represented by the category.

[0134] In this formula, considering that the characteristic values ​​of the feature descriptor in each dimension reflect the different characteristics of the pixel points, such as gradient amplitude, gradient direction, grayscale change intensity, etc., the average value of these characteristic values ​​is obtained , can measure the overall feature strength of the pixels in the category in each dimension. If the feature descriptors of the pixels in a category have significant feature values ​​in each dimension, it means that the pixels in the category have strong feature performance, which will increase the weight of the category, thereby highlighting the impact of its features during segmentation.

[0135] This formula is introduced in the numerator part It is for The categories in The eigenvalues ​​of the dimensions are standardized, where It represents the difference between the mean of the normalized values ​​of the feature values ​​of this category in this dimension and the mean of the normalized values ​​of the feature values ​​of all categories in this dimension, divided by the standard deviation This difference can be converted into a standard score value. This standardization operation makes the feature values ​​of different dimensions comparable and can better identify categories that have a large difference from the overall mean in the feature dimension. This difference reflects the The degree of deviation of the feature value of a category in this dimension relative to the overall mean of this dimension. The feature values ​​are standardized. For example, in the image of laser welding quality assessment, if a category is significantly different from other categories in some key feature dimensions (such as gradient amplitude, grayscale change intensity, etc.), this category will be more prominently reflected in the weight calculation, thereby better distinguishing different types of welding areas. It reflects the category's situation in terms of threshold relative to the overall situation. If this ratio is greater than 1, it means that the category is higher than the overall average in terms of threshold; if it is less than 1, it is lower than the overall average.

[0136] In this formula, This is to comprehensively consider the deviation of each category from the overall mean in terms of feature dimension and the situation of the threshold relative to the whole. In image segmentation applications, if a category has a large deviation from the overall mean in terms of feature dimension (large standardized difference), and its threshold is also greatly different from the overall threshold mean (large threshold ratio), then the result after multiplication will be large, which indicates that the comprehensive performance of this category in these two aspects is relatively outstanding, and more attention should be paid to it in subsequent calculations (such as weight calculation).

[0137] The denominator provides a normalized comprehensive measure for weight calculation. It sums up all categories and accumulates the comprehensive measures of each category after considering the area share, the difference between the eigenvalue and the mean, and the relative situation of the threshold, so as to determine the proportion of each category relative to the whole, thereby achieving weight normalization.

[0138] In short, this formula takes into account factors such as category area ratio, eigenvalue strength, and initial threshold mean, and can assign a reasonable weight to each category, so that the segmentation more accurately reflects the actual situation of the welding image. For pixels contained in categories with large areas, obvious features, and initial thresholds that match the overall image, their weights will be higher, and more attention will be paid to them during segmentation.

[0139] S6: Adjust the initial adaptive segmentation threshold of each pixel according to the weight of each category and the feature descriptors of the pixels contained in the category.

[0140] Specifically, the initial adaptive segmentation threshold of each pixel is adjusted according to the following formula:

[0141]

[0142] In the formula, yes The initial adaptive segmentation threshold of the pixel at yes The adaptive segmentation threshold after the pixel point is adjusted, is the total number of categories, is the total number of dimensions, For the The weight of each category, For the The pixels in the category are The coefficients of the eigenvalues ​​of the dimensions, Used to adjust the contribution of feature values ​​of different dimensions in threshold calculation. For the The feature descriptors of the pixels in the category are The mean of the normalized values ​​of the eigenvalues ​​in the dimensions, is the mean of the initial adaptive segmentation thresholds for all pixels in all categories.

[0143] This formula makes full use of the information of each clustering category in different feature dimensions to determine the adaptive threshold of each pixel. This means that the determination of the threshold is not based on a single factor, but a comprehensive consideration of the performance of different clustering categories in the image in multiple feature dimensions. The adjustment of the segmentation threshold of each pixel should be affected by the joint effect of all category information in the image. This method takes into account the category distribution and feature conditions of the entire image. From a global perspective, through cumulative calculation, the weights of pixels of different categories, the contribution of dimensional feature values ​​and other factors are integrated into the adjustment process of the segmentation threshold of each pixel. When adjusting the initial segmentation threshold, the pixels contained in the categories with high importance (larger weight) can have a greater impact on the initial segmentation threshold of the pixels, so that the adjusted segmentation threshold can better adapt to the complex situation of the welding image and improve the accuracy of adaptive segmentation.

[0144] In this formula, the initial threshold At the beginning, a preliminary reference is provided for segmentation. It is set based on the initial understanding of the image. The initial threshold determines the approximate range of the adjusted threshold. If the initial threshold is high, the adjusted threshold will also change on the basis of the high threshold; vice versa. For example, in a welding image, if it is initially believed that a certain area may require a higher threshold to distinguish (such as a welding area with higher brightness), this higher threshold will be used to distinguish the area with a higher brightness. This will make the subsequent adjustments It will also vary in the higher range to better accommodate the segmentation of this possibly brighter area.

[0145] In this formula, through Reflects the contribution of the characteristic value of the pixel's feature descriptor in each dimension to the threshold adjustment. It is used to adjust the contribution of feature values ​​of different dimensions in threshold calculation. This part reflects the specific contribution of feature values ​​of different dimensions of the feature descriptors of the pixels contained in each category to the threshold adjustment. The influence of feature values ​​of different dimensions (such as gradient amplitude, grayscale change intensity, etc.) on the segmentation threshold is different. To adjust this effect. For example, in welding images, if the gradient magnitude dimension is important for segmenting edge parts, by appropriately setting , the feature value of the gradient amplitude dimension can play a greater role in calculating the adjusted threshold. For edge pixels, the contribution of their gradient amplitude dimension may make the adjusted threshold more conducive to accurate edge segmentation.

[0146] In this formula, Divide by This item plays a normalization role, so that the threshold adjustment can take into account the level of the overall initial segmentation threshold. It can avoid unreasonable deviations in the adjusted segmentation threshold due to the initial segmentation threshold of individual pixels being too high or too low. For example, if the initial threshold of a certain pixel is Much higher than , then when calculating the adjusted threshold, Divide by This item will make the adjustment of the pixel point based on the overall threshold level, preventing the adjusted threshold from deviating excessively from the reasonable range, so that the adjusted threshold can more reasonably adapt to the segmentation requirements of the entire image.

[0147] In this formula, The method to obtain is: calculate the All pixels in the category The intra-class variance of the feature values ​​of the dimensions, and All pixels in the category The feature values ​​of the dimension and all the pixels contained in each other category are in the The inter-class variance value of the feature value of the dimension is obtained, and a total of 1 intra-class variance value and The between-class variance value is The ratio of the mean of the inter-class variance values ​​to the intra-class variance value is taken as the The pixels in the category are The coefficients of the eigenvalues ​​of the dimensions .

[0148] This acquisition The significance of this method is to calculate the The pixels in the category are The average eigenvalue of each dimension can summarize the overall characteristic performance of the pixels contained in this category in a specific dimension. For example, if the average eigenvalue of a category in the gradient amplitude dimension is high, it may mean that the area corresponding to this category has more obvious edge or texture changes.

[0149] Calculating the intra-class variance value measures the degree of feature dispersion of pixels within the same category on a specific dimension. A smaller intra-class variance value indicates that the feature values ​​of the pixels contained in this category on this dimension are relatively consistent, and vice versa, it indicates that the internal differences are large. In welding images, if the intra-class variance value of the pixels contained in a category on a certain dimension is small, it means that the feature values ​​of the pixels contained in this category on this dimension have high homogeneity, which may correspond to specific areas in the welding image, such as uniform welding areas or specific types of welding defect areas. This helps to give relatively stable weights to dimensions with smaller intra-class variances in subsequent threshold adjustments, avoiding inaccurate threshold adjustments due to excessive internal differences.

[0150] The calculated inter-class variance reflects the difference in the average eigenvalues ​​of different classes on a specific dimension. A larger inter-class variance indicates that the eigenvalues ​​of pixels in different classes on a specific dimension are more distinguishable, whereas a smaller inter-class variance indicates that the eigenvalues ​​of pixels in different classes on a specific dimension are more similar.

[0151] The ratio of the mean of the inter-class variance value to the intra-class variance value is used as a coefficient, which comprehensively considers the consistency within the class and the difference between the classes. This coefficient can adjust the contribution of feature values ​​of different dimensions in the threshold calculation. If the inter-class variance value of a dimension is large and the intra-class variance value is small, then The value of will be larger, indicating that this dimension is very important in distinguishing different categories and should be given a larger weight in threshold adjustment. For example, in a welding image, if a dimension (such as gradient amplitude) has a large difference between different welding areas, and the pixels in the same welding area are relatively consistent in this dimension, then The value of will be larger, making the feature value of this dimension play a greater role in adjusting the threshold.

[0152] S7: performing adaptive threshold segmentation on the welding image according to the adaptive segmentation threshold adjusted for all pixels, and evaluating the welding quality based on the result of the adaptive threshold segmentation.

[0153] Through adaptive threshold segmentation, the features of the welding area can be extracted more accurately, providing a more reliable basis for welding quality assessment. The adaptive segmentation threshold can be adjusted according to different parts of the image, making the segmentation more accurate. Evaluating the welding quality based on the segmentation results can more intuitively understand the quality of the welding. Based on accurate segmentation results, the reliability of welding quality assessment is improved.

[0154] Among them, the method for evaluating welding quality based on the results of adaptive threshold segmentation is:

[0155] A plurality of welding images meeting the standards are collected in advance, and the standard range of the texture features and the standard range of the shape features of the welding area are determined based on all welding areas meeting the standards. The standard range of the texture features of the welding area includes: the standard range of the contrast of the gray level co-occurrence matrix of the welding area, and the standard range of the gray entropy of the welding area. The standard range of the shape features of the welding area includes: the standard range of the aspect ratio of the welding area and the standard range of the circularity.

[0156] In multiple welding images that meet the standards, all welding areas are segmented according to the adaptive segmentation threshold adjusted for each pixel, and the contrast, grayscale entropy, aspect ratio and circularity of the grayscale co-occurrence matrix of each welding area are calculated; based on all welding areas that meet the standards, the standard range of the contrast of the grayscale co-occurrence matrix of the welding area, the standard range of the grayscale entropy, the standard range of the aspect ratio and the standard range of the circularity are obtained.

[0157] Next, the judgment rules are set: for any area after the adaptive threshold segmentation of the current grayscale image, only when the texture features and shape features of the area are within the above-mentioned corresponding standard range, the area is judged as a normal welding area, and the remaining areas in the current grayscale image except all normal welding areas are regarded as defective areas.

[0158] Finally, evaluate the welding quality: calculate the ratio of all defect areas to the number of all areas , and the ratio of the area of ​​all defective regions to the area of ​​all regions ,set up is the first threshold of the quantity ratio, and its empirical value is 0.1. is the second threshold of the quantity ratio, and its empirical value is 0.1. is the first threshold of the area ratio, and its empirical value is 0.3. is the second threshold of the area ratio, and its empirical value is 0.3. and , the welding quality is top-notch, if and , the welding quality is medium, if or , the welding quality is inferior.

[0159] In the description of this specification, "multiple" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0160] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A laser welding quality assessment method, characterized in that: include: An initial region and an initial adaptive segmentation threshold are set for the pixels in the welding image, and the size of the initial region of the pixels is dynamically adjusted according to the mean of the gradient amplitude of all pixels in the initial region of the pixels and the mean of the spatial frequency of all pixels to obtain the local region of the pixels; The gradient amplitude, gradient direction, grayscale change intensity, skewness and kurtosis of the grayscale value distribution of all pixels in the local area of ​​the pixel are used as feature values ​​of multiple dimensions to form a feature descriptor of the pixel. The similarity between every two pixels is calculated based on the feature descriptor, and all pixels are clustered based on the similarity to obtain multiple categories. Calculate the weight of each category , For the The weight of each category, For the The area ratio of pixels in each category in the grayscale image. For the The feature descriptors of the pixels in the category are The mean of the normalized values ​​of the eigenvalues ​​in the dimensions, is the feature descriptor of the pixels contained in all categories in the The mean of the normalized values ​​of the eigenvalues ​​in the dimensions, is the feature descriptor of the pixels contained in all categories in the The standard deviation of the eigenvalues ​​in the dimension, is the total number of categories, is the total number of dimensions, For the The mean of the initial adaptive segmentation thresholds for the pixels in each category. is the mean of the initial adaptive segmentation thresholds of all pixels in all categories; According to the weight of the category to which the pixel belongs and the average feature value of the feature descriptors of all pixels in the category in each dimension, the initial adaptive segmentation threshold of the pixel is adjusted according to the following relationship: , yes The initial adaptive segmentation threshold of the pixel at yes The adaptive segmentation threshold after the pixel point is adjusted, is the total number of categories, is the total number of dimensions, For the The pixels in the category are The coefficients of the eigenvalues ​​of the dimensions, For the The feature descriptors of the pixels in the category are The mean of the normalized values ​​of the feature values ​​of the dimensions; The welding image is adaptively segmented according to the adaptive segmentation threshold adjusted for all pixels, and the welding quality is evaluated based on the result of the adaptive threshold segmentation.

2. The laser welding quality assessment method according to claim 1, characterized in that: The method for calculating the similarity between each two pixels based on the feature descriptor is: Counting pixels Feature descriptors and pixels The Euclidean distance of the feature descriptor in high-dimensional space , and then use the Gaussian kernel function to obtain The mapping value of ,Will As a pixel and pixels similarity.

3. The laser welding quality assessment method according to claim 1, characterized in that: The method to dynamically adjust the size of the initial area is: Preset gradient amplitude threshold and spatial frequency threshold ; The grayscale values ​​of all pixels in the initial area of ​​each pixel are taken as a two-dimensional signal, and a two-dimensional Fourier transform is performed to obtain a complex matrix. Each complex number in the complex matrix corresponds to an amplitude, and the corresponding amplitude matrix is ​​obtained. The mean of the amplitude matrix is ​​taken as the mean of the spatial frequency of all pixels. ; and obtain the mean value of the gradient amplitude of all pixels in the initial area ; Setting condition 1: Greater than and Greater than ; Condition 2: Less than and Less than ; Condition 3: Other cases except conditions 1 and 2; If condition 1 is met, the size of the initial area is reduced to half of the original size; If condition 2 is met, the size of the initial area is expanded to twice the original size; If condition 3 is met, the size of the initial area remains unchanged.

4. The laser welding quality assessment method according to claim 1, characterized in that: The method for obtaining the grayscale change intensity of all pixels in the local area of ​​each pixel is: set up The local area of ​​the pixel The grayscale change intensity of all pixels in the horizontal direction And the grayscale change intensity in the vertical direction They are: ; ; In the formula, yes The coordinates of the pixels in for The gray value of the pixel at is the number of pixels in the local area; calculate The grayscale change intensity of all pixels in the local area of ​​the pixel at .

5. The laser welding quality assessment method according to claim 1, characterized in that: The method to obtain the coefficient of the eigenvalue is: Calculate the All pixels in the category The intra-class variance of the feature values ​​of the dimensions, and All pixels in the category The feature values ​​of the dimension and all the pixels contained in each other category are in the The inter-class variance value of the feature value of the dimension is obtained, and a total of 1 intra-class variance value and The between-class variance values ​​are The ratio of the mean of the inter-class variance values ​​to the intra-class variance value is taken as the The pixels in the category are The coefficients of the eigenvalues ​​of the dimensions .

6. The laser welding quality assessment method according to claim 1, characterized in that: The method for evaluating welding quality based on the results of adaptive threshold segmentation is: Determine the standard ranges of the texture features and shape features of the welding area based on a plurality of welding images that meet the standards collected in advance; For any area after the current grayscale image is segmented by adaptive threshold, the area is judged as a normal welding area only when the texture features and shape features of the area are within their respective standard ranges. The remaining areas outside the normal welding area are regarded as defective areas, and the welding quality is evaluated based on the proportion of the number of all defective areas and the proportion of the area of ​​all defective areas.

7. The laser welding quality assessment method according to claim 6, characterized in that: The method for evaluating welding quality based on the number ratio of all defective areas and the area ratio of all defective areas is: Calculate the ratio of all defect areas to the number of all areas , and the ratio of the area of ​​all defective regions to the area of ​​all regions ; set up , are the first and second thresholds of the quantity ratio, , are the first threshold and the second threshold of the area ratio respectively; Setting condition 1: and ; Condition 2: and ; Condition 3: Other situations except conditions 1 and 2; If condition 1 is met, the welding quality is superior, if condition 2 is met, the welding quality is medium, and if condition 3 is met, the welding quality is inferior.

8. The laser welding quality assessment method according to claim 6, characterized in that: The method for determining the standard range of the texture features and shape features of the welding area based on the pre-collection of multiple welding images that meet the standards is as follows: The standard range of texture features of the welding area includes: the standard range of contrast of the grayscale co-occurrence matrix of the welding area, the standard range of grayscale entropy of the welding area; the standard range of shape features of the welding area includes: the standard range of aspect ratio of the welding area and the standard range of circularity; A plurality of welding images meeting the standards are collected in advance, and all welding areas are segmented out according to the adaptive segmentation threshold after each pixel is adjusted in the plurality of welding images meeting the standards, and the contrast, grayscale entropy, aspect ratio and circularity of the grayscale co-occurrence matrix of each welding area are calculated; and a standard range of contrast, a standard range of grayscale entropy, a standard range of aspect ratio and a standard range of circularity of the grayscale co-occurrence matrix of the welding area are obtained according to all welding areas meeting the standards.

Citation Information

Patent Citations

  • A method and system for defect recognition in weld images

    CN117058144B

  • Clustering-based segmentation method for nodules on medical image

    CN116563208A

  • Mould plate quality detection method and system based on machine vision

    CN118587226A