A method and system for identifying a weld defect of a heat sink
By using clustering algorithms and feature fusion techniques in radiator weld identification, the problem of inaccurate defect identification caused by low grayscale contrast was solved, achieving higher accuracy and reliability in defect identification.
Patent Information
- Application Number
- CN202511696236.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-11-19
AI Technical Summary
In the existing technology, the defect identification method for radiator welds is inaccurate due to low grayscale contrast and background noise, which affects the reliability of weld quality assessment.
By segmenting the weld area using a clustering algorithm and combining structural deviation and texture difference features, a defect suspicion index is constructed. Weighted histogram equalization is then performed to accurately stretch the grayscale range of the defect area and suppress background noise.
It improves the accuracy and reliability of radiator weld defect identification, significantly enhances defect visibility, and avoids missed detection due to a single feature.
Smart Images

Figure CN121147228B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing. More particularly, the present application relates to a radiator weld defect recognition method and system. BACKGROUND
[0002] In the precision manufacturing industry, especially in the fields such as automobiles and aerospace with extremely high reliability requirements, the weld quality of the radiator as a key heat exchange component will directly affect the aerodynamic performance and heat exchange efficiency of the radiator, and is a key point of product quality control. While the automatic welding technology improves the production efficiency, it also introduces quality uncertainty caused by process parameter drift, material surface state change and other factors, so that process defects such as pores, undercut and weld bumps will inevitably occur in the weld. In the automatic quality control link, defect detection through machine vision has become the mainstream trend.
[0003] Considering that there is often a certain gray scale contrast between the actual weld defect area and the background, histogram equalization (HE) is used to redistribute the pixel gray levels of the image to stretch the overall dynamic range, thereby highlighting the defect area and improving the defect recognition accuracy.
[0004] However, due to the influence of light, the contrast between the weld defect and the background of the collected industrial image is low, and only a few pixels constitute the defect area. The statistical distribution of the global histogram is easily dominated by normal pixels, resulting in an equalization transformation function that infinitely approaches to enhance the contrast of the normal area. The result is that the background noise is amplified, while the defect features that need to be concerned are further suppressed, making the defect recognition inaccurate, and thus affecting the reliability of the evaluation of the radiator weld quality. SUMMARY
[0005] To solve the technical problem that the statistical distribution of the global histogram is easily dominated by normal pixels, resulting in inaccurate defect recognition, the present application provides solutions in the following aspects.
[0006] In a first aspect, the present application provides a radiator weld defect identification method, comprising: collecting an image of a radiator, clustering the gray values of all pixel points in the image, performing position analysis on the clustering results, and obtaining a binary image of a plurality of pixel points in a weld area and the weld area; extracting a center axis of the weld from the binary image; in the weld area: determining a structure deviation according to the vertical distance of each pixel point to the center axis and the number of occurrences; obtaining an LBP feature vector of each pixel point; determining a texture difference according to the difference between the LBP feature vector of each pixel point and the standard LBP feature vector with the highest frequency of occurrence; taking the mean value of the structure deviation and the texture difference as the defect suspicion degree of each pixel point; counting the gray level histogram of the weld area, including the frequency of each gray level; calculating the mean value of the defect suspicion degree of all pixel points at each gray level to obtain the defect suspicion degree of each gray level; weighting the frequency of each gray level according to the defect suspicion degree to determine the weighted frequency of each gray level; performing histogram equalization based on the weighted frequency to obtain an equalized image; and performing threshold segmentation on the equalized image to locate the weld defect area.
[0007] The present application segments the weld area by clustering algorithm combined with prior knowledge of the position distribution of the radiator structure, further fuses the features of structure deviation and texture difference in two dimensions to construct a defect suspicion degree index of each pixel point, weights the frequency of each gray level using the index, constructs a weighted histogram that can highlight the defect area, and performs equalization processing based on the weighted histogram; the method can accurately stretch the gray level range of the low-contrast defect area, suppresses the background noise, and significantly improves the visibility of the defect.
[0008] Preferably, the clustering algorithm is a k-means algorithm, and the number of clustering clusters is 3.
[0009] The present application obtains the prior number of clustering clusters through the geometric distribution characteristics of the radiator surface, uses the k-means algorithm to cluster the pixel gray values of the image, segments the image into different regions with similar gray characteristics, and realizes the division of different regions on the surface of the radiator, which excludes a large range of background interference for subsequent feature extraction.
[0010] Preferably, the obtaining of the binary image of the plurality of pixel points in the weld area and the weld area comprises: calculating the average value of the coordinate values in the axial direction of all pixel points in each clustering cluster, and sorting in ascending order, and marking the second value in the sequence as the plurality of pixel points in the weld area. The gray value of the marked pixel point is set to 255, and the gray value of the unmarked pixel point is set to 0 to obtain the binary image of the weld area.
[0011] The present application utilizes the prior knowledge that the weld of the radiator is necessarily located between the main sheet and the radiator pipe in physical space, and the middle cluster representing the weld can be stably identified by analyzing the average position of each cluster on the horizontal axis of the image, the method is simple in calculation and can effectively deal with the position of the weld of different types of radiators, and the adaptive ability of the segmentation algorithm is improved.
[0012] Preferably, the middle axis of the weld is obtained by a middle axis extraction algorithm.
[0013] Preferably, the structure deviation satisfies the expression: ; in the expression, is the structure deviation of the first pixel point; is the vertical distance from the first pixel point to the middle axis; is the maximum value of the vertical distance from all pixel points to the middle axis; is the number of times that the vertical distance from the first pixel point to the middle axis appears; is a natural exponential function.
[0014] The present application considers the relative distance of the pixel point to the middle axis and the rarity of the distance to comprehensively evaluate the structure deviation, and can sensitively capture abnormal geometric defect pixel points.
[0015] Preferably, the LBP feature vector of each pixel point is obtained by traversing the gray values of all pixel points in the eight-neighborhood of each pixel point and calculating the LBP feature vector of each pixel point by using the local binary pattern.
[0016] Preferably, the texture difference satisfies the expression: ; in the expression, is the texture difference of the first pixel point; is the LBP feature vector of the first pixel point; is a standard LBP feature vector; is the L2 norm between vectors; is a standard normalization function.
[0017] The present application uses the LBP feature vector with the highest frequency of occurrence as the standard texture, and since internal defects such as pores and cracks can cause changes in local texture features, the difference between the local texture and the standard texture can be evaluated by calculating the L2 norm, and internal defect problems can be identified.
[0018] Preferably, the gray scale histogram of the statistical weld area comprises: according to the gray scale value of all pixel points, the number of pixel points of each gray scale is counted, the gray scale histogram of the weld area and the frequency of each gray scale are obtained, wherein the frequency is equal to the ratio of the number of all pixel points at each gray scale to the number of all pixel points in the weld area.
[0019] Preferably, the weighted frequency of each gray scale is equal to the product of the frequency of each gray scale and the defect suspicion degree; and the threshold segmentation algorithm is the Otsu method.
[0020] In a second aspect, the present application provides a radiator weld defect identification system, comprising a processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, the above-mentioned one kind of radiator weld defect identification method is realized.
[0021] By adopting the above technical scheme, the above-mentioned one kind of radiator weld defect identification method is generated into computer program and stored in the memory, so as to be loaded and executed by the processor, so as to manufacture terminal equipment according to the memory and the processor, and facilitate use.
[0022] The beneficial effects of the present application are:
[0023] (1) The present application clusters by analyzing the structure distribution characteristics of the radiator, and segments the weld area, so as to exclude the interference of the large-area background area such as the main sheet and the radiator pipe on the subsequent analysis;
[0024] (2) The present application comprehensively judges the defect by fusing the structure deviation degree and the texture difference two-dimensional characteristics, can cover more defect types, effectively avoids the missed detection caused by single feature, and improves the accuracy of defect identification;
[0025] (3) The present application constructs the defect suspicion degree index, and weights the gray scale histogram according to the index, ensures that the image enhancement process is changed from global optimization to focusing on the suspected defect area, and improves the discrimination degree of the defect and the background. BRIEF DESCRIPTION OF DRAWINGS
[0026] Figure 1 is a flow chart schematically showing a kind of radiator weld defect identification method in the present application. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0028] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0029] This invention discloses a method for identifying weld defects in radiators, referring to... Figure 1 This includes steps S1-S5:
[0030] S1. Acquire an image of the radiator, cluster the gray values of all pixels in the image, perform position analysis on the clustering results, and obtain a binary image of the weld area.
[0031] It should be noted that the radiator welding area is the connection area between the main plate and the heat pipe. The acquired radiator image may include some non-welded areas of the main plate and heat pipe. In order to avoid the non-welded areas affecting the accuracy of subsequent defect identification, the welded area needs to be segmented first to provide image data basis for subsequent analysis of defect areas.
[0032] Specifically, high-resolution industrial cameras and coaxial ring light sources are deployed on the production line to obtain images of the heat sink under uniform illumination. The acquired images are then converted to grayscale to obtain the grayscale value of each pixel. Simultaneously, the position of each pixel needs to be determined. The specific method is as follows: taking the pixel at the bottom left corner of the image as the origin, and defining the horizontal direction to the right from the origin as... The positive direction of the axis is defined by taking the vertically upward direction from the origin as... The positive direction of the axis is used to construct a Cartesian coordinate system; the position of each pixel in the image is obtained in the Cartesian coordinate system, including... Coordinates in the axial direction and Coordinates along the axis.
[0033] Considering that the gray values of the weld area are significantly different from those of the main plate and the heat pipe area, and that the weld area is located between the main plate and the heat pipe in terms of geometric distribution, clustering algorithms can be used to segment the weld area.
[0034] Obtain the binary image of the weld area as follows: Use the grayscale value of each pixel as a clustering sample, perform k-means clustering with a prior cluster size of 3, and obtain the clustering results; calculate the corresponding values of all pixels within each cluster. The average value of the coordinates along the axis is taken and sorted in ascending order. All pixels in the cluster corresponding to the second value in the sequence are marked as pixels in the weld area. The gray value of the marked pixels is set to 255, and the gray value of the unmarked pixels is set to 0, thus obtaining a binary image of the weld area.
[0035] At this point, a binary image of the weld area has been obtained.
[0036] S2. Extract the centerline of the weld from the binary image; within the weld area: determine the structural deviation based on the vertical distance of each pixel to the centerline and the frequency of occurrence.
[0037] It should be noted that a normal weld has a uniform width and a continuous, smooth shape in terms of geometry, and its centerline can be regarded as its ideal geometric model. However, geometric defects in the welding process, such as undercut or weld beads, will cause the physical boundary of the weld to deviate from this ideal model. Therefore, by extracting the centerline of the weld as a geometric reference and calculating the distance from each point in the weld to its geometric reference, irregularities in the shape of the weld area can be identified, thereby detecting whether there are geometric defects.
[0038] Specifically, the centerline of the weld is obtained as follows: the centerline is extracted from the binary image of the weld region using the Skeleton Extraction algorithm. It should be noted that the centerline extraction algorithm is a well-known technique and will not be described in detail here.
[0039] Each pixel within the weld seam area, and all pixels in subsequent steps, are pixels within the weld seam area; obtain the vertical distance from each pixel to the central axis, and count the number of times each vertical distance occurs.
[0040] The structural deviation of each pixel is determined based on its vertical distance from the central axis and the frequency of its occurrence; the structural deviation satisfies the expression:
[0041]
[0042] In the formula, For the first Structural deviation of each pixel; For the first The vertical distance from each pixel to the central axis; It is the maximum vertical distance of all pixels from the central axis; For the first The number of times the vertical distance from each pixel to the central axis appears; It is a natural exponential function.
[0043] in, Reflecting the The vertical distance of a pixel to the centerline is the relative value of all vertical distances. The larger the value, the further the pixel is from the weld centerline. Reflecting the The number of times the vertical distance from the nth pixel to the central axis occurs, i.e., the prevalence of pixels with the same vertical distance. The smaller this value, the more likely the nth pixel is to be at a vertical distance from the central axis. The vertical distance from each pixel to the central axis is quite rare in welds; if the greater, and the smaller (i.e. the greater), the greater the structural deviation of the pixel point relative to the weld geometric reference, and the higher the probability that the pixel point is a geometric defect point; otherwise, the smaller the structural deviation of the pixel point, and the lower the probability that the pixel point is a geometric defect point.
[0044] At this point, the structural deviation of each pixel point in the weld area is obtained.
[0045] S3, obtain the LBP feature vector of each pixel point; and determine the texture difference according to the difference between the LBP feature vector of each pixel point and the standard LBP feature vector with the highest frequency.
[0046] It should be noted that actual welding process defects not only include geometric defects, but also may include internal porosity, cracks and other defects caused by uneven welding speed. Relying solely on structural deviation may result in failure to identify some defects. Considering that a normal weld surface usually presents a regular fish scale or similar welding texture, internal defects will break the regularity of this texture, causing the corresponding regional pixel points to form a local texture abnormal area. Therefore, by analyzing the difference between the local texture around each point and the standard texture, these surface micro-defects caused by internal quality problems can be identified.
[0047] Specifically, the LBP feature vector of each pixel point is obtained as follows: traverse the gray value of each pixel point in the eight-neighborhood of each pixel point, and use the local binary pattern (LBP) to obtain the LBP feature vector of each pixel point.
[0048] Considering that in actual welding process, the defect part of the weld area usually accounts for a small proportion, i.e. the texture features of most pixel points in the weld area belong to regular welding texture, therefore, the LBP feature vector with the highest frequency among all pixel points in the weld area represents the normal texture features of the current weld.
[0049] The standard LBP feature vector is obtained as follows: use the LBP feature vectors of all pixel points to construct a texture feature vector set, count the frequency of each LBP feature vector in the set, and take the LBP feature vector with the highest frequency as the standard LBP feature vector.
[0050] Determine the texture difference of each pixel point according to the difference between the LBP feature vector of each pixel point and the standard LBP feature vector; the texture difference satisfies the expression:
[0051]
[0052] In the formula, is the texture difference of the i-th pixel point, and is the LBP feature vector of the i-th pixel point. the texture difference of the i-th pixel point; the LBP feature vector of the i-th pixel point; the LBP feature vector of the i-th pixel point; the standard LBP feature vector; the L2 norm between the two vectors; the standard normalization function.
[0053] wherein, the LBP feature vector of the i-th pixel point; the LBP feature vector of the i-th pixel point and the standard LBP feature vector in the multi-dimensional space, since the LBP feature vector is essentially a mathematical description of the local texture pattern, reflects the difference between the local texture of the i-th pixel point and the normal texture of the current weld, the greater the value, the greater the difference between the local texture of the i-th pixel point and the normal texture feature, indicating that it may be located in the defect area; otherwise, the smaller the difference between the local texture of the i-th pixel point and the normal texture feature, indicating that it may not be located in the defect area.
[0054] Thus, the texture difference of each pixel point in the weld area is obtained.
[0055] S4, taking the average of the structure deviation and the texture difference as the defect suspicion degree of each pixel point; statistics the gray histogram of the weld area, including the frequency of each gray level; calculating the average of the defect suspicion degree of all pixel points under each gray level, obtaining the defect suspicion degree of each gray level; according to the defect suspicion degree, the frequency of each gray level is weighted to determine the weighted frequency of each gray level.
[0056] It should be noted that the structure deviation focuses on capturing geometric defects, while the texture difference focuses on capturing internal texture defects, and the two complement each other, which can sensitively identify various types of defects; therefore, the two-dimensional features are fused to obtain the defect suspicion degree of each pixel point, thereby avoiding missed detection caused by a single feature.
[0057] Specifically, the defect suspicion degree of each pixel point is calculated, and the defect suspicion degree of each pixel point is equal to the average of the structure deviation and the texture difference of each pixel point; wherein the average reflects the comprehensive abnormality of each pixel point in the two dimensions of geometric defects and internal texture defects, the greater the average, the higher the defect performance of the pixel point in at least one dimension, which means that the pixel point has a higher suspicion degree of defects; otherwise, the suspicion degree is lower.
[0058] Thus, the defect suspicion degree of each pixel point in the weld area is obtained.
[0059] It should be further explained that, considering that actual weld defects consist of only a very small number of pixels and have low contrast with the background, and that traditional histogram equalization is a statistical analysis of the global histogram, the gray values of defect areas are easily dominated by the gray values of normal pixels, causing some defects to be suppressed and affecting the reliability of subsequent defect identification; therefore, it is necessary to adjust the contribution of each pixel to the histogram based on the defect suspicion of each pixel, so that pixels with high suspicion can obtain higher statistical weight, thereby dominating the direction of subsequent equalization transformation, and ensuring that the final contrast enhancement effect can accurately focus on the suspected defect area.
[0060] Specifically, based on the grayscale values of all pixels, the number of pixels at each grayscale level is counted, and the grayscale histogram of the weld area and the frequency of each grayscale level are obtained. The frequency is equal to the ratio of the number of all pixels at each grayscale level to the number of all pixels in the weld area.
[0061] Calculate the average value of the defect suspicion of all pixels at each gray level, and use it as the defect suspicion of each gray level.
[0062] The frequencies of each gray level are weighted according to their defect likelihood levels to determine the weighted frequency for each gray level; the weighted frequency satisfies the expression:
[0063]
[0064] In the formula, For the first Weighted frequencies of each gray level; For the first The frequency of each gray level; For the first Each grayscale level indicates the degree of defect suspicion.
[0065] Among them, if the first The higher the defect likelihood of a gray level, the greater its contribution to the subsequent equalization transformation should be. Get the The weighted frequency of each gray level makes the weight of the gray level of the pixel in the defect area dominate the entire histogram.
[0066] At this point, the weighted frequencies of each gray level within the weld area have been obtained.
[0067] S5. Perform histogram equalization based on weighted frequency to obtain an equalized image; perform threshold segmentation on the equalized image to locate the weld defect area.
[0068] It should be noted that the acquisition of the weight frequency of the gray level of each pixel point in the weld area can greatly reduce the inaccuracy of the traditional histogram equalization processing, and lays a foundation for the final accurate segmentation based on the equalization processing.
[0069] Specifically, the cumulative distribution function (CDF) is calculated by using the histogram equalization principle for the weight frequency of each gray level to obtain the equalization processed image; it should be noted that the histogram equalization principle is a known technology, and will not be described here; if the weight frequency of each gray level is 0, which leads to the cumulative distribution function error, it is considered that the suspected defect degree of all pixel points in the weld area is 0, and the system can directly determine that the weld area is a defect-free area.
[0070] Exemplarily, the number of pixel points under the weld defect gray level (50) is 3, the frequency is , the defect suspected degree of the gray level is 0.9; the number of pixel points under the weld normal gray level (60) is 13, the frequency is , the defect suspected degree of the gray level is 0.1; the weight frequency of each gray level is calculated: the weight frequency of the gray level (50) is , the weight frequency of the gray level (60) is , and the total weight frequency of the weighted histogram is ; the weighted cumulative distribution function (CDF) is calculated: CDF (50) = , CDF (60) = ; the mapped gray value: the weld defect pixel point: , the weld normal pixel point: , wherein is a rounding function, the initial gray difference between the defect and the background is 10, and the gray difference between the defect and the background is enlarged to 87 after the defect suspected degree weighting processing, so that the contrast between the defect and the normal area is enlarged.
[0071] The equalization processed image is binarized by using the Otsu method, wherein the white pixel point is a defect area, and the black pixel point is a normal area, so that the weld defect area is accurately located; it should be noted that the Otsu method is used to realize the segmentation of the defect area and the normal area by maximizing the inter-class variance.
[0072] Thus, the heat sink weld defect identification is completed.
[0073] The embodiment of the present application also discloses a heat sink weld defect identification system, which comprises a processor and a memory, and the memory stores computer program instructions; when the computer program instructions are executed by the processor, the heat sink weld defect identification method according to the present application is realized.
[0074] The system also comprises other components well known to those skilled in the art such as a communication bus and a communication interface, the arrangement and function of which are known in the art and thus will not be described here in more detail.
Claims
1. A method for identifying weld defects in radiators, characterized in that, include: Images of the radiator are acquired, the gray values of all pixels in the image are clustered, the clustering results are analyzed for location, and a binary image of multiple pixels in the weld area and the weld area is obtained; the centerline of the weld is extracted from the binary image. Within the weld area, the structural deviation is determined, satisfying the expression: ; In the formula, For the first Structural deviation of each pixel; For the first The vertical distance from each pixel to the central axis; It is the maximum vertical distance of all pixels from the central axis; For the first The number of times the vertical distance from each pixel to the central axis appears; It is a natural exponential function; Obtain the LBP feature vector of each pixel to determine the texture dissimilarity, satisfying the expression: ; In the formula, For the first Texture differences at each pixel level; For the first LBP feature vector of 1 pixel; The standard LBP feature vector; The L2 norm between vectors; For standard normalized functions; The mean of structural deviation and texture difference is used as the defect suspicion of each pixel; the gray-level histogram of the weld area is statistically analyzed, including the frequency of each gray level; the mean of the defect suspicion of all pixels at each gray level is calculated to obtain the defect suspicion of each gray level. The frequencies of each gray level are weighted according to the degree of defect suspicion to determine the weighted frequency of each gray level; histogram equalization is performed based on the weighted frequency to obtain an equalized image; threshold segmentation is performed on the equalized image to locate the weld defect area.
2. The method for identifying weld defects in a radiator according to claim 1, characterized in that, The clustering algorithm used is the k-means algorithm, and the number of clusters is 3.
3. The method for identifying weld defects in a radiator according to claim 1, characterized in that, The process of obtaining multiple pixels within the weld area and a binary image of the weld area includes: Calculate the corresponding pixel points within each cluster. The average value of the coordinates along the axis is taken and sorted in ascending order. All pixels in the cluster corresponding to the second value in the sequence are marked as multiple pixels in the weld area. The gray value of the marked pixels is set to 255, and the gray value of the unmarked pixels is set to 0, thus obtaining a binary image of the weld area.
4. The method for identifying weld defects in a radiator according to claim 1, characterized in that, The centerline of the weld was obtained using a centerline extraction algorithm.
5. The method for identifying weld defects in a radiator according to claim 1, characterized in that, The process of obtaining the LBP feature vector of each pixel includes: Iterate through the gray values of all pixels in the eight neighborhoods of each pixel, and calculate the LBP feature vector of each pixel using the local binary mode.
6. The method for identifying weld defects in a radiator according to claim 1, characterized in that, The grayscale histogram of the statistical weld area includes: Based on the grayscale values of all pixels, the number of pixels at each grayscale level is counted, and the grayscale histogram of the weld area and the frequency of each grayscale level are obtained. The frequency is equal to the ratio of the number of all pixels at each grayscale level to the number of all pixels in the weld area.
7. The method for identifying weld defects in a radiator according to claim 1, characterized in that, The weighted frequency of each gray level is equal to the product of the frequency of each gray level and the defect suspicion level; the algorithm for threshold segmentation is the Otsu method.
8. A radiator weld defect identification system, characterized in that, include: A processor and a memory, wherein the memory stores computer program instructions that, when executed by the processor, implement a method for identifying weld defects in a radiator according to any one of claims 1-7.
Citation Information
Patent Citations
Building hanging basket welding quality detection method based on machine vision
CN115457035A
Visual feature-based ship sheet metal part welding defect detection method
CN116823822A