An automobile accessory automatic welding defect detection method
By performing region growth in grayscale images using an improved growth rule and selecting seed points and grayscale difference conditions, the accuracy problem of burn-through defect detection in the automatic welding process of automotive parts was solved, achieving high-precision burn-through defect identification and welding quality assessment.
Patent Information
- Application Number
- CN202511501382.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-10-21
AI Technical Summary
In existing technologies, the accuracy of burn-through defect detection during the automatic welding process of automotive parts is insufficient. Especially when welding parameters are unstable and the surface condition of the workpiece is complex, the Otsu algorithm cannot effectively segment the burn-through area, resulting in blurred boundaries, misjudgment, and missed judgment, which makes it difficult to meet the accuracy requirements of industrial inspection.
An improved growth algorithm is used to perform region growth in grayscale images. By selecting seed points and merging pixels based on grayscale difference conditions, and combining grayscale change continuity index and regional feature values, the algorithm can distinguish between real burn-through defects and interference edges, achieving accurate growth and recognition.
It improves the accuracy of burn-through defect identification, avoids interference from weld beads, ensures the accuracy and safety of welding quality assessment, and reduces the risk of misjudgment and omission.
Smart Images

Figure CN121147201B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, and in particular to an automatic welding defect detection method for automotive parts. Background Technology
[0002] Unlike manual welding, which offers flexible adjustment capabilities, the incidence of burn-through defects in automated welding production of automotive parts is higher than in manual welding due to factors such as rigid parameters, high requirements for workpiece compatibility, and lag in feedback adjustment. Burn-through is a through-hole defect formed when the base material or weld metal is melted and penetrated by excessive arc energy or slow welding. It can damage the integrity of the weld, reduce the structural load-bearing capacity, and cause risks such as subsequent assembly interference and increased stress concentration. Therefore, the detection of burn-through defects in automated welding processes is extremely important.
[0003] Currently, image processing techniques are commonly used to detect burn-through defects during the automated welding process of automotive parts: images of the welding area are acquired using an industrial camera, and after preprocessing to optimize image quality, the Otsu algorithm is used for global threshold segmentation. This algorithm determines the segmentation threshold by maximizing the inter-class variance of the image's grayscale histogram, separating the low-grayscale areas suspected of burn-through from the high-grayscale background, and ultimately achieving the location and detection of defects.
[0004] The traditional Otsu algorithm performs global segmentation based on a single threshold. Its effectiveness hinges on a clear separation of grayscale distribution between the foreground and background, resulting in a distinct bimodal feature in the global grayscale histogram. However, when welding parameters are unstable or the workpiece surface condition is complex, the edges of the burn-through area exhibit continuous, gradual transitions, lacking clear boundaries. Furthermore, the prevalent secondary defects in the surrounding area exacerbate the chaotic grayscale distribution, leading to severe overlap between the burn-through area and the background, thus disrupting the bimodal feature of the global grayscale histogram. In this situation, the threshold selection of the Otsu algorithm fails, resulting in blurred boundaries of the segmented burn-through area, which is mixed with interference areas. It becomes impossible to accurately locate and extract the complete defect area. The complete extraction of the burn-through area is crucial for determining the welding quality level and assessing the structural safety of the workpiece. Incomplete extraction or deviations directly lead to misjudgments or missed defects, potentially causing assembly failures or even safety accidents, failing to meet the accuracy requirements of industrial inspection. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide an automatic welding defect detection method for automotive parts, in order to solve the problem of how to improve the accuracy of burn-through defect detection in the automatic welding process of automotive parts.
[0006] This invention provides an automatic welding defect detection method for automotive parts, which includes the following steps:
[0007] Image acquisition is performed on the surface of the weld area of the automotive parts to obtain the corresponding surface image. The surface image is then converted to grayscale to obtain a grayscale image. The grayscale image is then globally segmented to obtain at least one candidate region for burn-through defects.
[0008] Based on the area of the connected region of each candidate burn-through defect region, a seed point is determined. Starting from the seed point, a region is grown in the grayscale image using an improved growth rule to obtain a grown region.
[0009] Based on the area of the growth region, the growth region is divided into a circular central region and a surrounding region. According to the gray level difference between the circular central region and the surrounding region, and the gray level distribution within the growth region, the regional feature value of the growth region is obtained. The location of the burn-through defect in the automotive parts is determined based on the regional feature value.
[0010] The improved growth rule is as follows: For any pixel within a preset neighborhood of the seed point, if the gray value difference between the seed point and any pixel satisfies the gray value difference condition, then the pixel is merged into the seed region; if the gray value difference between the seed point and any pixel does not satisfy the gray value difference condition, then a gray value change continuity index is obtained based on the gray value difference between the inner and outer sides of the pixel; if the gray value change continuity index satisfies the gray value change condition, then the pixel is merged into the seed region.
[0011] Preferably, determining the seed point based on the connected region area of each of the candidate burn-through defect regions includes:
[0012] Based on the area of the connected domain of each candidate burn-through defect region, obtain the candidate burn-through defect region corresponding to the largest connected domain area, denoted as the target region, and obtain the geometric centroid of the target region as the seed point.
[0013] Preferably, dividing the growth region into a circular central region and a surrounding region based on the area of the growth region includes:
[0014] The centroid of the growth region is obtained as the center of a circle. Pi is used as the denominator, and the area of the growth region is used as the numerator to obtain the corresponding ratio. The square root of the ratio is used as the radius. The circular central region is constructed based on the center and the radius. The remaining area of the growth region excluding the circular central region is used as the surrounding area.
[0015] Preferably, obtaining the regional feature value of the growth region based on the grayscale difference between the circular central region and the surrounding region, and the grayscale distribution within the growth region, includes:
[0016] The average gray value of the central region of the circle is used as the numerator, and the sum of the average gray value of the surrounding region and the preset value is used as the denominator to obtain the corresponding ratio. The absolute value of the difference between the ratio and the constant 1 is recorded as the gray-scale contrast.
[0017] The grayscale entropy of the growth region is obtained, and the region feature value of the growth region is obtained by combining the grayscale contrast and the grayscale entropy.
[0018] Preferably, the step of combining the grayscale contrast and the grayscale information entropy to obtain the regional feature value of the growth region includes:
[0019] The negative of the grayscale contrast is used as the independent variable of an exponential function with the natural constant as the base to obtain the first function value. The negative of the grayscale information entropy is used as the independent variable of an exponential function with the natural constant as the base to obtain the second function value. The first function value and the second function value are weighted and summed to obtain the regional feature value of the growth region.
[0020] Preferably, the grayscale difference condition is that the absolute value of the grayscale difference between any two pixels is less than a preset threshold for the absolute value of the grayscale difference.
[0021] Preferably, obtaining the grayscale change continuity index based on the grayscale difference between the inner and outer pixels of any given pixel includes:
[0022] In the direction from the seed point to any pixel, obtain the pixel adjacent to the pixel and record it as the external reference point. Calculate the absolute value of the gray value difference between the seed point and the pixel and record it as the internal gray value change amplitude. Calculate the absolute value of the gray value difference between the pixel and the external reference point and record it as the external gray value change amplitude.
[0023] Using the internal grayscale change amplitude as the numerator and the sum of the external grayscale change amplitude and the preset value as the denominator, the corresponding ratio is obtained. The absolute value of the difference between the ratio and the constant 1 is calculated. The opposite of the absolute value of the difference is used as the independent variable of an exponential function with the natural constant as the base, to obtain the grayscale change continuity index.
[0024] Preferably, the grayscale change condition is that the grayscale change continuity index is greater than or equal to a preset grayscale change continuity threshold.
[0025] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:
[0026] This invention selects seed points in the candidate region of burn-through defects through global segmentation, which can determine a reliable growth starting point based on the gray-level uniformity of the burn-through core. Furthermore, by quantifying the gray-level change trend between the seed point and neighboring pixels, the growth rule is improved, enabling the region growth process to distinguish between the gradual edges of real burn-through defects and other abrupt edges, thereby achieving accurate growth of the burn-through region and obtaining the growth region corresponding to the burn-through defect. Further analysis of the local gray-level distribution and texture complexity of the growth region is performed to construct regional feature values that quantify the gray-level relationship and regional disorder of the weld bead region. This is used to avoid interference from weld beads attached around the burn-through defect during the welding process, enhancing the recognition accuracy of burn-through defects in the region growth. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of an automatic welding defect detection method for automotive parts provided in Embodiment 1 of the present invention;
[0029] Figure 2 An example diagram illustrating the acquisition of an external reference point provided in an embodiment of the present invention;
[0030] Figure 3 This is an example diagram illustrating a growth region divided into a circular central region and a surrounding region, as provided in an embodiment of the present invention. Detailed Implementation
[0031] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.
[0032] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.
[0033] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0034] See Figure 1 This is a flowchart of an automatic welding defect detection method for automotive parts provided in Embodiment 1 of the present invention. Figure 1 As shown, the method may include:
[0035] Step S101: Image acquisition is performed on the surface of the weld area of the automotive parts to obtain the corresponding surface image. The surface image is converted to grayscale to obtain a grayscale image. The grayscale image is then globally segmented to obtain at least one candidate region for burn-through defects.
[0036] For any type of automotive part, after automatic welding, images of the weld seam area are acquired to obtain corresponding surface images for weld defect identification, thereby improving the production quality of automotive parts. The specific image acquisition method is as follows: First, a high-resolution industrial camera (resolution ≥ 12MP), coupled with a telecentric lens and a high-brightness coaxial LED light source, is used to acquire surface images of the automatically welded weld seam area under controlled lighting conditions (ambient light ≤ 30 lux), ensuring clear images, no motion blur, and uniform exposure, providing a high-quality image foundation for subsequent defect analysis. Then, based on a high-precision calibration plate, dual-parameter correction of radial and tangential distortion is performed, combined with perspective transformation to achieve standardized alignment of multi-view images, ensuring consistent geometric benchmarks for images from different workstations. Finally, adaptive gamma correction and local histogram equalization are used to enhance contrast and strengthen the grayscale difference between the burn-through area and the background. Furthermore, a multi-scale Retinex algorithm is used to suppress high reflectivity on the metal surface, laying the foundation for subsequent segmentation. It is worth noting that the above image acquisition method is existing technology and will not be elaborated upon here.
[0037] In existing technologies, after obtaining surface images of the weld seam area of automotive parts, machine vision is typically used to detect and identify welding defects. Specifically, the Otsu algorithm is used to perform threshold segmentation on the surface image to identify burn-through defects. However, while the Otsu algorithm performs well when the grayscale distributions of the foreground and background are significantly separated and the global grayscale histogram exhibits a clear bimodal characteristic, accurately identifying welding defects, it becomes problematic when welding parameters are unstable or the workpiece surface condition is complex. The edges of the burn-through area show continuous, gradual transitions, lacking clear boundaries. Furthermore, the prevalent secondary defects in the surrounding area exacerbate the chaotic grayscale distribution, leading to severe overlap between the burn-through area and the background, and disrupting the bimodal characteristic of the global grayscale histogram. In such cases, the burn-through area segmented by the Otsu algorithm has blurred boundaries and is mixed with interference areas, making it impossible to accurately locate and extract the complete defect area.
[0038] Therefore, in this embodiment of the invention, the surface image is first converted to grayscale and denoised using median filtering to obtain a grayscale image, reducing the interference of noise on feature extraction. Then, the Otsu algorithm is used to perform global segmentation on the grayscale image to obtain at least one candidate region for burn-through defects, which is used to determine high-precision burn-through defect regions in the future. Based on the global grayscale histogram of the grayscale image, the inter-class variance corresponding to each threshold is calculated, and the threshold that maximizes the inter-class variance is locked for binarization segmentation. Pixels with grayscale values below the threshold are classified as suspected defect points, and the region composed of suspected defect points is recorded as a candidate region for burn-through defects, thus achieving the initial localization of burn-through defects and avoiding fine calculation of the entire image.
[0039] Step S102: Determine seed points based on the connected region area of each candidate burn-through defect region. Using the seed points as starting points, perform region growth in the grayscale image using an improved growth rule to obtain a grown region.
[0040] The global segmentation result of the Otsu algorithm provides a preliminary candidate region for defects, namely, the candidate region for burn-through defects. However, due to the overlap of grayscale distribution between the foreground and background in the actual weld area, this region often contains blurred boundaries and structural interference around the structure. Therefore, to avoid interference, this embodiment of the invention further utilizes a region growing algorithm to obtain the burn-through region in the grayscale image. The region growing is based on the global segmentation result of the Otsu algorithm. By introducing the microscopic features exhibited by the burn-through defect locally, a more complete and accurate segmentation is achieved: the grayscale value of the core region of the defect is extremely low, the edges have continuous and smooth gradient features, and the internal texture distribution is highly uniform.
[0041] Specifically, firstly, seed points are selected in the candidate regions of burn-through defects, serving as the starting point for growth. The seed point selection method is as follows: based on the connected region area of each candidate region of burn-through defects, the candidate region of burn-through defects corresponding to the largest connected region area is obtained and denoted as the target region. The geometric centroid of the target region is then obtained as the seed point. Next, by analyzing the grayscale change trend of the pixels surrounding the seed point, the focus is on capturing the unique smooth transition characteristics of the burn-through region edge. A growth rule capable of distinguishing between genuine gradient edges and disruptive abrupt edges is constructed. Pixels conforming to the burn-through characteristics are gradually incorporated to form the growth region. The construction of the growth rule is as follows:
[0042] Let P be the seed point. Using P as the center, traverse each pixel in its eight neighborhoods in turn. By quantifying the grayscale change trend between the seed point and neighboring pixels, the gradient edge of the real defect is distinguished from other abrupt edges. The grayscale difference condition is set so that the absolute value of the grayscale difference between any two pixels is less than the preset absolute value threshold of grayscale difference. The absolute value threshold of grayscale difference is set to 3 to ensure that only pixels with grayscale values almost identical to the seed point are directly included in the growth area, preventing the introduction of uneven pixels in the core area in the early stage of growth. In actual application, it can be fine-tuned according to the scene accuracy.
[0043] Taking any pixel within the eight neighborhoods of seed point P as an example, the absolute value of the grayscale difference between the seed point and any pixel is calculated. If the grayscale difference between the seed point and any pixel satisfies the grayscale difference condition, it indicates that the grayscale levels of the seed point and any pixel are highly uniform, and thus the pixel is merged into the seed region. If the grayscale difference between the seed point and any pixel does not satisfy the grayscale difference condition, it indicates that there is a significant grayscale change near any pixel. In this case, it is necessary to further determine whether the grayscale change is a true edge at the end of the region or local interference within the region. Therefore, in this embodiment of the invention, a grayscale change continuity index is obtained based on the grayscale difference between the inside and outside of any pixel. If the grayscale change continuity index satisfies the grayscale change condition, the pixel is merged into the seed region.
[0044] The method for obtaining the grayscale change continuity index based on the grayscale difference between the inner and outer pixels of any given pixel is as follows:
[0045] In the direction from the seed point to any pixel, obtain the pixel adjacent to any pixel and denote it as the external reference point, such as... Figure 2 As shown, Figure 2 middle For the neighboring pixels of seed point P, in the direction Above, obtain The neighboring pixels centered Let be the external reference point. Calculate the absolute value of the grayscale difference between the seed point and any pixel point, denoted as the internal grayscale change amplitude. Calculate the absolute value of the grayscale difference between any pixel point and the external reference point, denoted as the external grayscale change amplitude.
[0046] Using the internal grayscale change amplitude as the numerator and the sum of the external grayscale change amplitude and the preset value as the denominator, the corresponding ratio is obtained. The absolute value of the difference between the ratio and the constant 1 is calculated. The opposite of the absolute value of the difference is used as the independent variable of an exponential function with the natural constant as the base, to obtain the grayscale change continuity index.
[0047] The formula for calculating the grayscale change continuity index is as follows:
[0048]
[0049] in, This represents an index indicating the continuity of grayscale changes between a seed point and any other pixel. This represents an exponential function with the natural constant as its base. This represents the grayscale value of the seed point. Represents the grayscale value of any pixel. This represents the grayscale value of the external reference point. This represents the preset value to prevent the denominator from being zero. It is set to 0.01, where 1 represents a constant and | represents the absolute value sign.
[0050] It should be noted that the imaging characteristics of the burn-through area are as follows: the center of the burn-through area is extremely dark and exhibits a low grayscale value, while the background area is bright and exhibits a high grayscale value. Correspondingly, the grayscale value gradually increases along the outward direction. Therefore, The closer the value is to 1, the more ideal the grayscale change is as a continuous gradient feature, the larger the corresponding grayscale change continuity index, and the more likely any pixel is to represent a true defect gradient edge; conversely, the closer the value is to 1, the more likely it is to represent a true defect gradient edge. The closer the value is to 0, the more drastic the grayscale change becomes. The smaller the corresponding grayscale change continuity index, the more likely any pixel is to be on the edge of a sudden change.
[0051] Since the grayscale change continuity index ranges from [0, 1], the larger the grayscale change continuity index, the greater the probability that the neighboring pixels of the seed point belong to the real defect gradient edge. Therefore, in this embodiment of the invention, the grayscale change condition is set to the grayscale change continuity index being greater than or equal to a preset grayscale change continuity threshold. The grayscale change continuity threshold is set to 0.5. The intermediate value has the highest discrimination and tolerance for the ideal continuous gradient mode, ensuring a stable response of the growth process to typical burn-through edge features. In practical applications, small-amplitude calibration can be performed in combination with specific scenarios to adapt to the imaging differences of different devices or processes.
[0052] The main steps of the known region growing algorithm include: seed point selection, growth rule, and region growing. Therefore, in this embodiment of the invention, after determining the seed points, the improved growth rule described above is used to perform region growing in the grayscale image, thereby obtaining a grown region. The region growing algorithm is prior art and will not be described in detail here.
[0053] Step S103: Based on the area of the growth region, the growth region is divided into a circular central region and a surrounding region. According to the gray level difference between the circular central region and the surrounding region, as well as the gray level distribution within the growth region, the regional feature value of the growth region is obtained. The location of the burn-through defect in the automotive parts is determined based on the regional feature value.
[0054] While the growth region obtained through region growing can initially capture the edges of burn-through defects on the surface of automotive parts, in automated welding scenarios, the actual burn-through defects are often surrounded by weld beads and other interference. These secondary defects exhibit localized high brightness due to metal accumulation and have a gradual spatial connection with the burn-through area, making them easily misjudged as defect extensions by the region growing logic, resulting in distorted results. Therefore, this embodiment of the invention further refines the filtering of the growth region to eliminate secondary interference such as weld beads and identify the actual burn-through area.
[0055] First, morphological closing operations are performed on the growth region to fill in the small holes inside the region, smooth the boundaries, and merge the edge spikes. This eliminates isolated and scattered pixels caused by image noise or tiny splashes, while keeping the shape and size of the main region basically unchanged, providing a cleaner and more coherent growth region for subsequent analysis.
[0056] Then, a circular central region with radius r is defined with the centroid of the growth region as the center. The radius r is obtained as follows: using pi as the denominator and the area of the growth region (a predetermined proportion) as the numerator, a corresponding ratio is obtained. The square root of this ratio is then taken as the radius. Therefore, the formula for calculating the radius r is:
[0057]
[0058] in, The preset ratio represents the percentage of the preset central region to the total area of the growth region. This represents the area of the growth region, which is also the number of pixels it contains. It represents pi (π).
[0059] It should be noted that setting a preset ratio The aim is to ensure that the circular central area is completely contained within the growth area. If the shape of the growth area is highly irregular, the size needs to be appropriately reduced. The value is set to avoid the circular central region overflowing into the background outside the growth area, which would cause distortion in feature calculation.
[0060] like Figure 3 As shown, the centroid of the growth region is obtained as the center of a circle, and the circular central region is constructed based on the center and the radius. The remaining area in the growth region, excluding the circular central region, is considered as the surrounding region. By separating the center and periphery of the growth region, preparation is made for subsequent quantization of grayscale relationships and texture features.
[0061] Because the actual burn-through area and weld beads differ in local grayscale distribution and texture complexity, the regional feature values of the growth area are obtained based on the grayscale difference between the circular central area and the surrounding area, as well as the grayscale distribution within the growth area. This is used to quantify the grayscale relationship and regional disorder compensation index of the weld bead area, thereby identifying and eliminating high-brightness interference. The method for obtaining the regional feature values of the growth area is as follows: using the mean grayscale value of the circular central area as the numerator, and the sum of the mean grayscale value of the surrounding area and a preset value as the denominator, the corresponding ratio is obtained. The absolute value of the difference between the ratio and the constant 1 is recorded as the grayscale contrast ratio. The formula for calculating the grayscale contrast ratio is:
[0062]
[0063] in, Indicates grayscale contrast. This represents the average grayscale value of the central region of the circle. This represents the average grayscale value of the surrounding area. This represents the preset value to prevent the denominator from being zero; it is set to 0.01. | represents the absolute value sign.
[0064] It should be noted that grayscale contrast It can effectively capture the essential difference between weld bead interference and actual burn-through in imaging: the weld bead area is a raised accumulation of metal, with a denser metal accumulation in the central area, which is usually brighter than the surrounding area. The calculated results are relatively high; actual burn-through is a hole formed by material loss, and its central area usually has little difference in gray level and a smooth transition with the surrounding area. The calculation results are low.
[0065] Using the information entropy formula, the gray-level information entropy of the growth region is obtained to quantify the randomness and disorder of the gray-level distribution in the growth region: the surface texture of the weld bead region is irregular, and the gray-level distribution is scattered after imaging, corresponding to a higher entropy value; the gray-level of the region inside the hole is uniform and consistent, with the pixel gray-level highly concentrated at low gray levels, and the distribution is simple and orderly, corresponding to a lower entropy value. Then, the inverse of the gray-level contrast is used as the independent variable of an exponential function with the natural constant as the base to obtain a first function value, and the inverse of the gray-level information entropy is used as the independent variable of an exponential function with the natural constant as the base to obtain a second function value. The first function value and the second function value are then weighted and summed to obtain the regional feature value of the growth region.
[0066] The formula for calculating the regional characteristic value of the growth region is as follows:
[0067]
[0068] in, This represents the regional characteristic value of the growth region. Indicates weight, This represents an exponential function with the natural constant as its base. This represents grayscale contrast, and 1 represents a constant. This represents the grayscale information entropy.
[0069] It should be noted that, Used to adjust the contribution ratio of grayscale contrast features and region information entropy in the final decision. The value range is [0, 1], with a reference value. It can ensure discrimination accuracy through core features, and compensate for discrimination ability in special scenarios through auxiliary features. When When the gray level approaches 1, it indicates that the gray level difference between the center and the periphery of the growth region is minimal, and the gray level distribution within the region is concentrated, which is consistent with the characteristics of burn-through holes; when When the value approaches 0, it indicates that there is a large difference in gray level between the center and the periphery of the growth region, and the gray level distribution within the region is dispersed, which is consistent with the characteristics of weld bead interference.
[0070] Furthermore, based on the regional characteristic values of the growth region, the location of burn-through defects in the automotive parts is determined: a threshold t is set to characterize the regional characteristic values of burn-through defects. When W is greater than or equal to t, the growth region is determined to be a burn-through defect region, and the automotive parts are considered to have defects. The corresponding location in the automotive parts is then determined based on the growth region, achieving defect localization. Defect localization is existing technology and will not be elaborated upon here. When W is less than t, the growth region is determined to be a weld bead interference region, and the automotive parts are considered to have no burn-through defects and are considered quality-compliant. It is worth noting that setting t=0.6 is within the upper-middle range of theoretical values, providing sufficient sensitivity to growth regions exhibiting burn-through characteristics. This effectively distinguishes between actual burn-through and weld bead interference in most scenarios. In practical applications, the threshold can be fine-tuned according to the precision requirements for interference elimination.
[0071] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for automatically detecting welding defects in automotive parts, characterized in that, The method includes: Image acquisition is performed on the surface of the weld area of the automotive parts to obtain the corresponding surface image. The surface image is then converted to grayscale to obtain a grayscale image. The grayscale image is then globally segmented to obtain at least one candidate region for burn-through defects. Based on the area of the connected region of each candidate burn-through defect region, a seed point is determined. Starting from the seed point, a region is grown in the grayscale image using an improved growth rule to obtain a grown region. Based on the area of the growth region, the growth region is divided into a circular central region and a surrounding region. According to the gray level difference between the circular central region and the surrounding region, and the gray level distribution within the growth region, the regional feature value of the growth region is obtained. The location of the burn-through defect in the automotive parts is determined based on the regional feature value. The improved growth rule is as follows: For any pixel within a preset neighborhood of the seed point, if the grayscale difference between the seed point and any pixel satisfies the grayscale difference condition, then the pixel is merged into the seed region; if the grayscale difference between the seed point and any pixel does not satisfy the grayscale difference condition, then a grayscale change continuity index is obtained based on the internal and external grayscale differences of the pixel; if the grayscale change continuity index satisfies the grayscale change condition, then the pixel is merged into the seed region. Based on the grayscale difference between the circular central region and the surrounding region, and the grayscale distribution within the growth region, the regional feature values of the growth region are obtained, including: The average gray value of the central region of the circle is used as the numerator, and the sum of the average gray value of the surrounding region and the preset value is used as the denominator to obtain the corresponding ratio. The absolute value of the difference between the ratio and the constant 1 is recorded as the gray-scale contrast. Obtain the grayscale entropy of the growth region, and combine the grayscale contrast and the grayscale entropy to obtain the regional feature value of the growth region; The step of obtaining a grayscale change continuity index based on the grayscale difference between the inner and outer pixels of any given pixel includes: In the direction from the seed point to any pixel, obtain the pixel adjacent to the pixel and record it as the external reference point. Calculate the absolute value of the gray value difference between the seed point and the pixel and record it as the internal gray value change amplitude. Calculate the absolute value of the gray value difference between the pixel and the external reference point and record it as the external gray value change amplitude. Using the internal grayscale change amplitude as the numerator and the sum of the external grayscale change amplitude and the preset value as the denominator, the corresponding ratio is obtained. The absolute value of the difference between the ratio and the constant 1 is calculated. The opposite of the absolute value of the difference is used as the independent variable of an exponential function with the natural constant as the base, to obtain the grayscale change continuity index.
2. The automatic welding defect detection method for automotive parts according to claim 1, characterized in that, The step of determining seed points based on the connected region area of each candidate burn-through defect region includes: Based on the area of the connected domain of each candidate burn-through defect region, obtain the candidate burn-through defect region corresponding to the largest connected domain area, denoted as the target region, and obtain the geometric centroid of the target region as the seed point.
3. The automatic welding defect detection method for automotive parts according to claim 1, characterized in that, The step of dividing the growth region into a circular central region and a surrounding region based on the area of the growth region includes: The centroid of the growth region is obtained as the center of a circle. Pi is used as the denominator, and the area of the growth region is used as the numerator to obtain the corresponding ratio. The square root of the ratio is used as the radius. The circular central region is constructed based on the center and the radius. The remaining area of the growth region excluding the circular central region is used as the surrounding area.
4. The automatic welding defect detection method for automotive parts according to claim 1, characterized in that, The step of combining the grayscale contrast and the grayscale information entropy to obtain the regional feature value of the growth region includes: The negative of the grayscale contrast is used as the independent variable of an exponential function with the natural constant as the base to obtain the first function value. The negative of the grayscale information entropy is used as the independent variable of an exponential function with the natural constant as the base to obtain the second function value. The first function value and the second function value are weighted and summed to obtain the regional feature value of the growth region.
5. The automatic welding defect detection method for automotive parts according to claim 1, characterized in that, The grayscale difference condition is that the absolute value of the grayscale difference between any two pixels is less than a preset threshold for the absolute value of the grayscale difference.
6. The automatic welding defect detection method for automotive parts according to claim 1, characterized in that, The grayscale change condition is that the grayscale change continuity index is greater than or equal to a preset grayscale change continuity threshold.
Citation Information
Patent Citations
Defect detection method for industrial control capacitance touch LCD display assembly
CN115797342A
Interior trim part defect detection method and system, computer and storage medium
CN119399553A