A processing piece weld bead undercut defect identification processing method and system based on visual image detection

By employing visual image detection methods and utilizing techniques such as edge detection and curvature calculation, the problem of identifying welding undercut defects has been solved, achieving efficient and accurate undercut defect detection and improving the level of welding quality control.

CN120451088BActive Publication Date: 2026-02-24HENAN XINFENG NEW MATERIALS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510532733.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2026-02-24
Estimated Expiration
2045-04-25

AI Technical Summary

Technical Problem

Existing technologies for welding defect detection, especially for identifying undercut defects, suffer from low efficiency, high cost, and difficulty in accurate identification. In particular, traditional methods often miss or misjudge subtle defects.

Method used

A vision-based image detection method is adopted to identify and quantify undercut defects through edge detection, curve smoothing, curvature calculation, level set method and segmentation algorithm. This includes edge detection algorithm to analyze the weld texture area, calculate curvature and arc length, screen outliers, segment the undercut area using level set function and energy function, and calculate symmetry deviation index.

Benefits of technology

It improves the accuracy of identifying undercut defects, avoids errors, captures the true boundary of the area, reduces the false judgment rate, and ensures the accuracy of welding quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451088B_ABST
    Figure CN120451088B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on visual image detection's processing piece weld mark undercut defect identification processing method and system, method includes: processing piece is collected image, the image of processing piece is preprocessed, obtains image to be detected;Edge detection algorithm is analyzed to the image to be detected, obtains the weld mark area of image to be detected;Curve smoothing is carried out to weld mark area, obtains sampling point;According to the total arc length of weld mark area, the curvature of each sampling point is calculated by total arc length, and the curvature of sampling point is screened abnormal point;Through abnormal point, form undercut area, and the symmetry deviation index is calculated by segmenting undercut area;According to symmetry deviation index, it is judged whether there is undercut.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of welding, and in particular to a method and system for identifying and processing weld seam defects based on visual image detection. Background Technology

[0002] With the development of modern industry, welding, as a key process for joining metal materials, occupies an extremely important position in manufacturing. However, various defects that may occur during the welding process, such as undercut and weld beads, seriously affect the quality and service life of welded parts, and may even lead to serious safety accidents. Therefore, how to effectively detect and identify these welding defects has become one of the key issues in welding quality control.

[0003] Traditional methods for detecting welding defects mainly rely on manual inspection or non-destructive testing techniques such as X-rays and ultrasound. While these methods can detect welding defects to some extent, they are generally inefficient, costly, and highly dependent on the experience of the operators. Furthermore, traditional methods may struggle to accurately identify subtle defects, easily leading to missed detections or misjudgments.

[0004] In recent years, with the advancement of computer vision technology and image processing algorithms, the automatic detection of welding defects using digital image processing technology has gradually become a research hotspot. In particular, the application of edge detection algorithms has made extracting weld areas from machined part surface images more accurate and efficient. For example, classic edge detection algorithms such as the Canny operator have been widely used in target contour extraction, providing a foundation for subsequent defect analysis.

[0005] Nevertheless, existing technologies still have limitations in identifying specific welding defects such as undercut. On the one hand, simple edge detection cannot effectively distinguish normal weld lines from defective areas; on the other hand, one of the commonly used defect calculation algorithms is based on morphological processing and geometric feature analysis. It detects defects by analyzing the shape, size, and distribution of objects in an image, but lacks effective feature parameters to accurately determine the presence and severity of undercut defects. Therefore, developing a method that can accurately identify and quantify undercut defects is of great significance for improving welding quality control. Summary of the Invention

[0006] The purpose of this invention is to provide a method and system for identifying and processing weld seam defects based on visual image detection, which solves the above-mentioned technical problems pointed out in the prior art.

[0007] This invention provides a method for identifying and processing weld undercut defects in machined parts based on visual image detection, comprising the following steps:

[0008] Images of the workpiece are acquired and preprocessed to obtain the image to be inspected;

[0009] The image to be detected is analyzed using an edge detection algorithm to obtain the weld texture region of the image to be detected;

[0010] The weld texture area is smoothed to obtain sampling points; the total arc length of the weld texture area is calculated based on the sampling points, and the curvature of each sampling point is calculated based on the total arc length. Anomalies are screened based on the curvature of the sampling points; an undercut area is formed based on the anomalies, and the undercut area is segmented to calculate the symmetry deviation index.

[0011] The presence of bite is determined based on the symmetry deviation index.

[0012] Preferably, the weld bead region is smoothed to obtain sampling points; the total arc length of the weld bead region is calculated based on the sampling points. The specific operation steps are as follows:

[0013] The weld pattern area is smoothed using curve restoration to obtain s1, s2...sn sampling points;

[0014] Connect each adjacent sampling point with a straight line to obtain an approximate curve; calculate the Euclidean distance between adjacent sampling points in the approximate curve as the arc length increment between sampling points;

[0015] Calculate the arc length increment of each sampling point from sampling point s1 to sampling point sn to obtain the total arc length of the approximate curve.

[0016] Preferably, the curvature of each sampling point is calculated using the total arc length, and outliers are filtered based on the curvature of the sampling points. The specific operation steps are as follows:

[0017] The equation of the circle is calculated by least-squares circle fitting for each sampling point in the two-dimensional parametric curve and its preceding and following sampling points.

[0018] And calculate the sum of squared distances from all neighboring sampling points to the sampling points on the circle;

[0019] The curvature of the sampling point is calculated based on the equation of the circle using the sum of squared distances.

[0020] The curvature of all sampling points is calculated to obtain the curvature distribution of the two-dimensional parametric curve;

[0021] Using the sampling point as the center point, calculate the average curvature of each sampling point in the preceding and following neighborhoods of the sampling point, and further calculate the standard deviation of the curvature of the average curvature of each sampling point in the preceding and following neighborhoods.

[0022] Set an outlier asymmetry threshold and check whether the standard deviation of curvature of each sampling point in the neighborhood before and after the sampling point is less than the outlier asymmetry threshold.

[0023] If so, then the curvature of each sampling point in the preceding and following neighborhoods of the sampling point is determined to be fluctuating, and is regarded as an outlier.

[0024] Preferably, forming a bitten edge region based on the anomaly points and segmenting the bitten edge region to calculate a symmetry deviation index includes: calculating the convex hull boundary of the anomaly points using the level set method, and using the coverage area of ​​the convex hull boundary as a candidate bitten edge region; obtaining a level set function for an approximate curve of the candidate bitten edge region; calculating an energy function for the interior and exterior of the candidate bitten edge region using the approximate curve; updating the level set function using the energy function to find the bitten edge region; segmenting the bitten edge region into sub-regions, and calculating a symmetry deviation index based on the edge contours of the sub-regions.

[0025] Preferably, the convex hull boundary is calculated for outliers using the level set method, and the coverage area of ​​the convex hull boundary is used as the candidate biting edge region; the level set function is calculated by obtaining an approximate curve for the candidate biting edge region. The specific operation steps are as follows:

[0026] The convex hull boundary of the selected outliers is calculated using the level set method. The outliers cover the surrounding pixels after the convex hull boundary calculation, until all outliers completely cover the surrounding pixels. The area covered by each outlier is taken as the candidate biting edge area.

[0027] For each candidate bite area, an approximate curve is obtained;

[0028] For each candidate edge-biting region, the number of pixels inside and outside the approximate curve is counted; and the distance from the pixels inside and outside the approximate curve of each candidate edge-biting region to the boundary of the approximate curve is calculated. The boundary distances calculated from the pixels inside and outside the approximate curve are combined to form a level set function.

[0029] The horizontal set function represents the segmentation function between the interior and exterior of the approximate curve of the candidate bite edge region.

[0030] Preferably, the energy function is calculated for the interior and exterior of the candidate bite edge region using the approximate curve; the level set function is then updated using the energy function to find the bite edge region. The specific operation steps are as follows:

[0031] Calculate the internal average gray value and external average gray value of the pixels for the approximate curve of the candidate edge-biting region, respectively.

[0032] The curvature of the approximate curve of the candidate bite edge region is calculated;

[0033] The finite difference method is used to calculate the average gray difference between the internal average gray value and the external average gray value of the approximate curve of the candidate edge-biting region, which serves as the gray-level driving force.

[0034] The approximate curve of the candidate bite edge region is used to find outliers with maximum curvature and minimum curvature. The outliers corresponding to the maximum curvature are smoothed, and the smoothed outliers corresponding to the maximum curvature and minimum curvature are used as curvature driving forces.

[0035] The energy function is obtained by calculating the grayscale driving force and the curvature driving force.

[0036] The energy function is represented as the segmentation state of the approximate curve of the candidate bite region by the level set function.

[0037] Preferably, the level set function is updated using an energy function to find the bitten edge region; the bitten edge region is then divided into sub-regions, and a symmetry deviation index is calculated based on the edge contours of the sub-regions. The specific operation steps are as follows:

[0038] The horizontal set function of the candidate biting edge region is initialized; and the energy function is quantized using gradient descent based on the grayscale driving force and the curvature driving force, so that the horizontal set function is updated.

[0039] A preset function update threshold p is used to determine whether the updated level set function is equal to the function update threshold p.

[0040] If so, then determine whether the updated level set function has found the bitten edge region;

[0041] If not, then iteratively update the level set function until the updated level set function equals the function update threshold p;

[0042] The bitten edge region is divided into sub-regions using a segmentation algorithm. The boundary points of the edge contours of the sub-regions are discretized, and the symmetry deviation index is calculated using the boundary points of the sub-regions.

[0043] Preferably, the bitten edge region is divided into sub-regions using a segmentation algorithm, the boundary points of the edge contours of the sub-regions are discretized, and the symmetry deviation index is calculated using the boundary points of the sub-regions. The specific operation steps are as follows:

[0044] The biting edge region is divided into four sub-regions: a first sub-region, a second sub-region, a third sub-region, and a fourth sub-region using a segmentation algorithm.

[0045] The sub-region is the horizontal division of the bite-edge region. After finding the center point on the horizontal dividing line, the sub-region is then vertically divided along the center point.

[0046] The first and second sub-regions of the bitten edge region are left and right adjacent sub-regions, and the third and fourth sub-regions are left and right adjacent sub-regions; the first and second sub-regions are vertically adjacent sub-regions, and the third and fourth sub-regions are vertically adjacent sub-regions.

[0047] For each sub-region, the edge contour is extracted to obtain the contour boundary of each sub-region, and the contour boundary is discretized into a number of continuous boundary points;

[0048] For each sub-region, the overall offset of the weld pattern and the coefficient of variation of the weld pattern edge are calculated by dividing several consecutive boundary points along the longitudinal dividing line of the center point.

[0049] By comparing the ratio of the first sub-region to the second sub-region with the ratio of the third sub-region to the fourth sub-region using the weld edge variation coefficient and the overall weld offset of each sub-region, a symmetry deviation index is obtained.

[0050] Preferably, the overall offset of the weld bead and the coefficient of variation of the weld bead edge are calculated for several consecutive boundary points of each sub-region along the longitudinal dividing line formed by the center point. The specific operation steps are as follows:

[0051] Calculate the centroid coordinates of the boundary points of the left and right contour boundaries of each sub-region, and then connect the centroid coordinates of the boundary points of the left and right contour boundaries with a straight line to form the ideal center line;

[0052] The horizontal dividing line is used to find a parallel ideal center line, and the distance from the parallel ideal center line to the horizontal dividing line is calculated. The parallel ideal center line with the smallest distance is selected as the best center line.

[0053] Connect the boundary points of the upper and lower contour boundaries of each sub-region vertically to the optimal center line, and calculate the vertical distance between the boundary points of all upper and lower contour boundaries.

[0054] Find the vertical distance with the smallest sum of vertical distances among all the boundary points of the upper and lower contour boundaries, and use it as the overall offset of the weld pattern.

[0055] Preferably, the specific steps for calculating the variation coefficient of weld edge are as follows:

[0056] The overall offset of the weld pattern at the boundary points is sorted using the interquartile range, and the average value of the overall offset of the weld pattern at the middle boundary points is calculated as the median of the overall offset of the weld pattern at the boundary points.

[0057] The average value of the overall offset of the weld pattern at the middle boundary point in the first half of the middle boundary point is calculated and used as the first quartile.

[0058] The average value of the overall offset of the weld pattern at the middle boundary point in the latter half of the middle boundary point is calculated and used as the third quartile.

[0059] The interquartile range is calculated using the first quartile and the third quartile.

[0060] The dimensionless index is calculated by using the median of the overall offset of the weld pattern at the boundary point and the interquartile range, and is used as the weld pattern edge variation coefficient.

[0061] Compared with the prior art, the embodiments of the present invention have at least the following technical advantages:

[0062] Analysis of the above-mentioned method and system for identifying and processing weld seam defects based on visual image detection provided by the present invention reveals that, in specific applications, curve restoration is used to smooth the weld seam area and obtain sampling points; an approximate curve of the weld seam area is obtained based on the connection of the sampling points, reflecting the shape and contour curvature of the weld seam area; further, the total arc length of the approximate curve of the weld seam area is calculated to understand the contour length of the weld seam area; the curvature and curvature distribution of the sampling points are calculated based on the total arc length of the approximate curve, and the calculated curvature and curvature distribution can reveal the degree of curvature of the curve at different positions, thereby improving the accuracy of extracting abnormal points of the weld seam and avoiding errors; and based on the curvature and curvature distribution of the sampling points, the curvature fluctuations of each sampling point in the neighborhood before and after the sampling point are judged to see if there are any asymmetrical changes, thereby filtering out abnormal points.

[0063] Furthermore, the level set method is used to construct convex hull boundaries for outliers. The regions not covered by the convex hull boundary are used as initial candidate biting regions. After neighborhood coverage, isolated outliers that may contain errors can also be identified, improving the capture rate of the true region boundary. The boundary distance between pixels inside and outside the approximate curve of the candidate biting region is calculated, reflecting the spatial distribution of pixels inside and outside the candidate biting region. The level set function is calculated using the boundary distance to reflect the segmentation state of the approximate curve, i.e., the biting region of the true boundary. Grayscale driving force is obtained by calculating the grayscale values ​​of pixels inside and outside the approximate curve, reflecting the background and foreground of the biting region. Curvature driving force is calculated using the curvature of the approximate curve, reflecting the regularity of the contour. An energy function is calculated using the curvature driving force and the grayscale driving force, reflecting information such as the shape of the candidate biting region. The energy function is then used to update the level set function to find the biting region.

[0064] Furthermore, the undercut area is segmented into sub-regions using a segmentation algorithm to avoid the risk of global analysis masking detailed defects. For each sub-region, the boundary points of the edge contour are extracted, and the weld edge variation coefficient and the overall offset of the weld are captured to reflect the irregularity and local fluctuations of the sub-region. In addition, the symmetry deviation index is calculated to reflect abnormal undercut in a certain local area. Attached Figure Description

[0065] Figure 1 The main flow of a method for identifying and processing weld undercut defects in machined parts based on visual image detection, as described in Example 1;

[0066] Figure 2 This is a flowchart illustrating the process of determining the symmetry deviation index in a visual image detection-based method for identifying and processing weld seam defects in machined parts, as described in Example 1.

[0067] Figure 3 This is a flowchart illustrating the symmetry deviation index of the undercut region based on the level set function in a visual image detection-based method for identifying and processing weld undercut defects in machined parts, as described in Example 1.

[0068] Figure 4 This is a schematic diagram of the level set function segmentation form of a visual image detection-based method for identifying and processing weld seam defects in machined parts, as described in Embodiment 1.

[0069] Figure 5 This is a flowchart illustrating the symmetry deviation index obtained by segmenting the undercut region in a visual image detection-based method for identifying and processing weld seam defects in machined parts, as described in Example 1.

[0070] Figure 6 This is a schematic diagram of a sub-region of a visual image detection-based method for identifying and processing weld seam defects in a workpiece, as described in Embodiment 1.

[0071] Figure 7 This is a flowchart illustrating the overall offset of the weld and the coefficient of variation of the weld edge in a visual image detection-based method for identifying and processing weld undercut defects in a workpiece, as described in Example 1.

[0072] Figure 8 This is a flowchart illustrating the main process of undercut analysis in a visual image detection-based method for identifying and processing weld undercut defects in machined parts, as described in Example 1.

[0073] Figure 9 This is a flowchart of a processing system for identifying and processing weld seam defects based on visual image detection, as described in Example 2.

[0074] Labels: Acquisition Module 10; Weld Pattern Module 20; Analysis Module 30; Judgment Module 40. Detailed Implementation

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

[0076] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings.

[0077] Example 1

[0078] like Figure 1 As shown, this application provides a method for identifying and processing weld undercut defects in machined parts based on visual image detection, including the following steps:

[0079] S1: Acquire images of the workpiece, preprocess the images of the workpiece to obtain the image to be detected;

[0080] S2: Analyze the image to be detected using an edge detection algorithm to obtain the weld texture region of the image to be detected;

[0081] It should be noted that edge detection algorithms (such as the Canny operator) are used to extract the weld seam from the image to be detected, and the weld texture area is obtained. Edge detection algorithms are common knowledge and will not be elaborated further.

[0082] S3: Smooth the weld texture area to obtain sampling points; calculate the total arc length of the weld texture area based on the sampling points, calculate the curvature of each sampling point based on the total arc length, and filter out abnormal points based on the curvature of the sampling points; form an undercut area based on the abnormal points, and segment the undercut area to calculate the symmetry deviation index.

[0083] It should be noted that smoothing the edges of the welding area to obtain discrete but continuous sampling points helps to remove noise and local abrupt changes, resulting in a more accurate contour shape. The arc length of the entire weld is calculated using the sampling points, and the curvature of each sampling point is determined based on the arc length. Abrupt changes in curvature often correspond to local edge depressions or protrusions (i.e., undercut). By screening outliers, these outliers are combined into potential undercut regions, and these regions are further segmented and symmetry deviation indices are calculated. The symmetry deviation index is calculated based on the symmetry of the segmented regions after the undercut region is segmented. Under normal circumstances, the weld edge should be continuous, smooth, and exhibit a certain degree of symmetry. The symmetry deviation index is used to determine whether there are obvious local curve depressions or abnormal curvature undercuts.

[0084] S4: Determine whether there is biting edge based on the symmetry deviation index.

[0085] It should be noted that the determination of whether undercut exists based on the symmetry deviation index specifically includes the following steps: a preset symmetry threshold f is used to determine whether the symmetry deviation index is greater than or equal to the preset symmetry threshold f; if not, it is determined that the workpiece does not have an undercut abnormality; if so, it is determined that the workpiece has an undercut abnormality; using the weld edge variation coefficient and overall offset of each sub-region (obtained through local segmentation) calculated in S3, the symmetry deviation index is calculated by ratio to statistically quantify the symmetry between each region;

[0086] When the symmetry deviation index exceeds the set threshold, it indicates that the asymmetry of the local weld edge is obvious due to undercut or other defects, thus making a detection judgment that there is an undercut defect. An ideal weld should have good symmetry, and the local geometric features (such as the coefficient of variation and offset of the edge) should be relatively consistent between different sub-regions to avoid global averages masking minor defects, thereby improving the accuracy of detection.

[0087] Specifically, such as Figure 2 As shown, in step S3, the weld texture area is smoothed to obtain sampling points; the total arc length of the weld texture area is calculated based on the sampling points, and the curvature of each sampling point is calculated using the total arc length. Outliers are then filtered based on the curvature of the sampling points; an undercut area is formed using the outliers, and the undercut area is segmented to calculate a symmetry deviation index. The specific operation steps are as follows:

[0088] S31: Smooth the weld pattern area using curve restoration to obtain s1, s2...sn sampling points;

[0089] Connect each adjacent sampling point with a straight line to obtain an approximate curve; calculate the Euclidean distance between adjacent sampling points in the approximate curve as the arc length increment between sampling points;

[0090] Calculate the arc length increment of each sampling point from sampling point s1 to sampling point sn to obtain the total arc length of the approximate curve;

[0091] It should be noted that curve restoration (i.e., curve restoration refers to the process of reconstructing the original or ideal continuous curve from discrete, potentially noisy or incomplete sampled data, with the goal of recovering a smooth, continuous curve that better matches the shape of the actual object) is used to smooth the weld area and the contour area, obtaining s1, s2...sn sampling points; at the same time, straight lines are connected between each sampling point to obtain an approximate curve, which is the contour of the weld area. The approximate curve is also used to understand the weld area of ​​the workpiece under different contours for identification (i.e., due to the shape of the workpiece itself or the angle of the welding point, different welding contours may appear during welding, which makes it difficult to identify undercut edges. Therefore, the approximate curve can increase the accuracy of undercut edge identification for the weld area of ​​the workpiece under different contours), thereby increasing the accuracy of undercut edge identification for the weld area of ​​the workpiece under different contours.

[0092] Furthermore, by calculating the Euclidean distance between sampling points, the arc length of each sampling point of the approximate curve can be determined, that is, the arc length increment can be used to judge the degree of curvature of the approximate curve (i.e., the degree of curvature of the approximate curve); by calculating the arc length increment of each sampling point along the path from sampling point s1 to sampling point sn, the curvature path of each sampling point can be understood, and the total arc length of the weld area can be obtained by calculating the arc length increment from s1 to sn, that is, the length of the weld area outline.

[0093] S32: Parameterize the incremental arc length of each sampling point of the total arc length of the approximate curve, map the sampling points to two-dimensional parameters, and construct a two-dimensional parametric curve through the mapping parameters of each sampling point;

[0094] It should be noted that the total arc length of the approximate curve is parameterized by incremental arc length. That is, based on the incremental arc length accumulated at each sampling point of the approximate curve, each sampling point si is mapped to a two-dimensional parameter (ui, vi), where ui is the incremental arc length of sampling point si and vi is the corresponding coordinate of sampling point si. A two-dimensional parametric equation, that is, a two-dimensional parametric curve, is constructed using the two-dimensional parameters of each sampling point. By parameterizing the incremental arc length, the problem of uneven parameter distribution caused by the non-smoothness of the approximate curve can be avoided, making the final two-dimensional parametric curve smoother.

[0095] S33: The equation of the circle (i.e., the fitted circle) is calculated by using least squares circle fitting for each sampling point in the two-dimensional parametric curve and the sampling points in the neighborhood before and after each sampling point.

[0096] And calculate the sum of squared distances from all neighboring sampling points to the sampling points on the circle;

[0097] The curvature of the sampling point is calculated based on the equation of the circle using the sum of squared distances.

[0098] The curvature of all sampling points is calculated to obtain the curvature distribution of the two-dimensional parametric curve;

[0099] Using the sampling point as the center point, calculate the average curvature of each sampling point in the preceding and following neighborhoods of the sampling point, and further calculate the standard deviation of the curvature of the average curvature of each sampling point in the preceding and following neighborhoods.

[0100] It should be noted that for each sampling point si on the two-dimensional parametric curve, several sampling points in its immediate and neighboring areas are taken. Then, the least squares method is used to perform circle fitting to obtain the parameters (center, radius, etc.) of the best-fit circle for that local region, which effectively describes the curve shape near the sampling point. Furthermore, the sum of squared distances from all neighboring sampling points to the sampling points of this circle is calculated as the fitting error. The sum of squared distances is not directly used as a parameter for calculating the curvature of the sampling points, but rather as an auxiliary function to suppress the interference of random noise on the curvature calculation, to verify the reliability of the curvature, and to avoid misjudging noise or complex shapes as defects. At the same time, by calculating the curvature and curvature distribution, the degree of curvature along the curve at different positions can be understood, thereby improving the accuracy of extracting abnormal points of the edge and avoiding errors.

[0101] Meanwhile, the average curvature of the neighborhood before and after the sampling point is used to reflect the overall curvature trend of the local area, and the standard deviation of curvature is further calculated to quantify the dispersion of curvature of all sampling points before and after the sampling point. In this way, sampling points with fluctuations before and after the sampling point si are found (that is, when all sampling points in the neighborhood before and after the sampling point have fluctuations, it indicates that the curve of the sampling point may be asymmetrical, so fluctuations before and after the sampling points will occur), and the sampling point si is regarded as an outlier.

[0102] S34: Set an outlier asymmetry threshold, and check whether the standard deviation of curvature of each sampling point in the neighborhood before and after the sampling point is less than the outlier asymmetry threshold.

[0103] If so, then the curvature of each sampling point in the preceding and following neighborhoods of the sampling point is determined to be fluctuating, and is regarded as an outlier.

[0104] It should be noted that by setting an outlier asymmetry threshold to determine whether there is fluctuation in the curvature of all sampling points in the neighborhood before and after a sampling point, if the standard deviation of curvature of each sampling point in the neighborhood before and after the sampling point is greater than or equal to the outlier asymmetry threshold, it indicates that the curvature of the sampling point has not changed significantly and the curvature of each sampling point in the neighborhood before and after the sampling point has not fluctuated. If the standard deviation of curvature of each sampling point in the neighborhood before and after the sampling point is less than the outlier asymmetry threshold, it indicates that the curvature of each sampling point in the neighborhood before and after the sampling point fluctuates and there may be asymmetric changes. Furthermore, in the undercut defects of processed parts, the asymmetry of the weld area often indirectly indicates that there is undercut in the weld area. Therefore, by using the asymmetry of sampling points, outliers that may have undercut can be screened out.

[0105] S35: Calculate the convex hull boundary for outliers using the level set method, and use the coverage area of ​​the convex hull boundary as a candidate biting edge region; obtain the level set function of the approximate curve for the candidate biting edge region; calculate the energy function for the interior and exterior of the candidate biting edge region using the approximate curve; update the level set function using the energy function to find the biting edge region; divide the biting edge region into sub-regions, and calculate the symmetry deviation index based on the edge contour of the sub-regions;

[0106] It should be noted that scattered outliers are difficult to determine directly as valid edge-cutting features on their own. Aggregating them using convex hull boundaries ensures that even with local discrete anomalies, overall defect information is not missed, while reducing the impact of noise. The level set function can express the approximate curve of the candidate edge-cutting region as a continuous function, capturing the details of the region's true boundary. Minimizing the energy function indicates the most obvious difference between the inside and outside of the approximate curve boundary, guiding region segmentation. Iteratively updating the level set function using the energy function allows the boundaries of the initial candidate regions to gradually converge to the true edge-cutting defect edge. Through energy-driven iterative updates, the boundaries can be adaptively adjusted, making the segmentation process more accurate. After segmentation, edge contours are extracted for each sub-region, and a symmetry deviation index is calculated to statistically measure the geometric consistency between different sub-regions, ensuring sensitive detection of local defects.

[0107] Specifically, such as Figure 3As shown, in step S35, the convex hull boundary is calculated for outliers using the level set method, and the coverage area of ​​the convex hull boundary is used as a candidate biting edge region; an approximate curve is obtained for the candidate biting edge region to calculate the level set function; an energy function is calculated for the interior and exterior of the candidate biting edge region using the approximate curve; the level set function is updated using the energy function to find the biting edge region; the biting edge region is divided into sub-regions, and a symmetry deviation index is calculated based on the edge contours of the sub-regions. The specific operation steps are as follows:

[0108] S351: The convex hull boundary of the selected outliers is calculated using the level set method. The outliers cover the surrounding pixels after the convex hull boundary calculation, until all outliers completely cover the surrounding pixels. The area covered by each outlier is taken as the candidate biting edge area.

[0109] For each candidate undercut area, an approximate curve is obtained (that is, the approximate curve of S351 is the outline of the candidate undercut area, which is different from the approximate curve of step S31 above. The approximate curve of S31 is the outline of the weld texture area; at the same time, the method of obtaining the approximate curve of the candidate undercut area is the same as that of the approximate curve of the weld texture area in S31, and will not be repeated).

[0110] For each candidate edge-biting region, the number of pixels inside and outside the approximate curve is counted; and the distance from the pixels inside and outside the approximate curve of each candidate edge-biting region to the boundary of the approximate curve is calculated. The boundary distances calculated from the pixels inside and outside the approximate curve are combined to form a level set function.

[0111] The level set function represents the segmentation function between the interior and exterior of the approximate curve of the candidate edge-biting region (that is, converting the approximate curve itself into a function form, and using the level set function to reflect whether the true contour of the approximate curve is an edge-biting region, such as...). Figure 4 (as shown);

[0112] It should be noted that the convex hull boundary of outliers is calculated using the level set method. Each selected outlier is processed, and its surrounding pixels are gradually covered until the local regions of all outliers are completely covered. Through the covering operation, the originally discrete or isolated outliers are also covered and transformed into coherent regions, thus forming a continuous set of multiple candidate edge-grabbing regions. After the outliers are covered by the neighborhood, the capture rate of the true region boundary can also be improved for isolated outliers that may contain errors.

[0113] For each candidate biting edge region covered by neighboring pixels, an approximate curve (i.e., the outline of the candidate biting edge region) is extracted. The approximate curve here is calculated in the same way as the approximate curve of the weld texture region (in S31), but it is for a different target region. By obtaining the approximate curve of the candidate biting edge region, the abnormal region can be better described, and the shape of the possible biting edge can also be determined.

[0114] By distinguishing the pixels inside and outside the candidate edge-biting region using an approximate curve, we can understand the segmentation state of the candidate edge-biting region by the approximate curve. At the same time, by calculating the distance to the nearest boundary from these pixels, we can reflect the spatial distribution of the pixels inside and outside the candidate edge-biting region. Based on the segmentation state and spatial distribution, we convert them into a continuous function to obtain a level set function that reflects the segmentation function of the approximate curve of the candidate edge-biting region. Therefore, we need to calculate the boundary distance, and use the boundary distance reflecting the segmentation state and spatial distribution to calculate the level set function.

[0115] S352: Calculate the internal average gray value and external average gray value of the pixels for the approximate curve of the candidate edge-biting region, respectively.

[0116] The curvature of the approximate curve of the candidate biting edge region is calculated (i.e., the curvature calculation of the approximate curve of the candidate biting edge region in step S252 is the same as the curvature calculation in step S33 above, and will not be repeated here).

[0117] The finite difference method is used to calculate the average gray difference between the internal average gray value and the external average gray value of the approximate curve of the candidate edge-biting region, which serves as the gray-level driving force.

[0118] The approximate curve of the candidate bite edge region is used to find outliers with maximum curvature and minimum curvature. The outliers corresponding to the maximum curvature are smoothed, and the smoothed outliers corresponding to the maximum curvature and minimum curvature are used as curvature driving forces.

[0119] The energy function is obtained by calculating the grayscale driving force and the curvature driving force.

[0120] The energy function is represented as the segmentation state of the approximate curve of the candidate bite region by the level set function;

[0121] It is important to note that the above steps require calculating the average grayscale values ​​of pixels inside and outside the approximate curve of the candidate edge-cutting region, reflecting the contrast between the target region and the background. Calculating the curvature of the approximate curve of the candidate edge-cutting region describes the degree of curvature at various local points. Simultaneously, calculating the difference between the average grayscale values ​​of the internal and external pixels as the grayscale driving force allows the approximate curve (i.e., the contour) of the candidate edge-cutting region to evolve towards the contour of the real edge-cutting region. Introducing curvature information ensures that the energy function not only considers grayscale contrast but also the geometrical smoothness of the region boundaries, reducing scattered segmentation caused by noise, and calculating the curvature driving force (i.e., in the calculation...). When calculating curvature driving force, outliers with maximum curvature are smoothed because these outliers may affect the surrounding area, avoiding jagged edges or noise interference. Outliers with minimum curvature have relatively little noise. Therefore, after smoothing, outliers with maximum curvature will be close to outliers with minimum curvature, thus allowing for the calculation of curvature driving force. Curvature driving force can eliminate contour irregularities caused by noise or fitting errors. At the same time, the energy function integrates information from both grayscale and geometry (i.e., curvature can not only smooth candidate edge regions but also reflect information such as the shape of candidate edge regions), providing a unified index for evaluating the segmentation quality of candidate regions and guiding the contour to evolve towards the optimal segmentation result.

[0122] S353: Initialize the level set function of the candidate biting edge region; and quantize the energy function using gradient descent based on the grayscale driving force and the curvature driving force, thereby updating the level set function;

[0123] A preset function update threshold p is used to determine whether the updated level set function is equal to the function update threshold p.

[0124] If so, then determine whether the updated level set function has found the bitten edge region;

[0125] If not, then iteratively update the level set function until the updated level set function equals the function update threshold p;

[0126] It should be noted that when the candidate edge-biting region passes through the convex hull of the approximate curve, the resulting level set function is essentially a mathematical function that converts the geometric contour (i.e., the approximate curve) into a mathematical function form. When the level set function equals 0, the approximate curve is the actual contour boundary to be obtained, which is the final contour boundary of the edge-biting region. When the level set function is less than or equal to 0, it indicates that the approximate curve of the level set function may have deviations due to background (i.e., the background is related to the grayscale value, so the grayscale driving force and curvature driving force are needed to quantize the energy function and update the level set function) or noise. Therefore, the grayscale driving force and the curvature driving force need to be used to quantize the energy function and update the level set function using the gradient descent method.

[0127] The gradient descent method is used to adjust the level set function of the approximate curve along the negative gradient direction of the energy function. The energy function is obtained through grayscale driving force and curvature driving force, which represent the negative gradient of the energy function. This indicates the direction in which the approximate curve should move (i.e., the negative gradient direction calculated by gradient descent, which is determined by the driving force, not the energy function) to reduce the energy function, thereby updating the level set function. A function update threshold p (i.e., 0) is set. When the level set function is updated to 0, the approximate curve no longer changes significantly, and the boundary of the bitten area is found. If it is not equal to 0, the iteration continues until the threshold condition is met.

[0128] S354: The biting edge area is divided into sub-regions using a segmentation algorithm, the boundary points of the edge contours of the sub-regions are discretized, and the symmetry deviation index is calculated using the boundary points of the sub-regions;

[0129] It should be noted that the biting edge area is divided into sub-regions by a segmentation algorithm, and the boundaries of the sub-regions are discretized to obtain multiple boundary points. The symmetry deviation index of the left and right adjacent sub-regions is calculated by using the boundary points of the sub-regions, so as to determine whether there is biting edge in the subsequent process.

[0130] Specifically, such as Figure 5 As shown, in step S354, the bitten edge region is divided into sub-regions using a segmentation algorithm, and the boundary points of the edge contours of the sub-regions are discretized. The symmetry deviation index is calculated using the boundary points of the sub-regions. The specific operation steps are as follows:

[0131] S3541: The biting edge area is divided into four sub-regions: a first sub-region, a second sub-region, a third sub-region, and a fourth sub-region using a segmentation algorithm;

[0132] The sub-region is the horizontal division of the bite-edge region. After finding the center point on the horizontal dividing line, the sub-region is then vertically divided along the center point.

[0133] The first and second sub-regions of the bitten edge region are left and right adjacent sub-regions, and the third and fourth sub-regions are left and right adjacent sub-regions; the first and second sub-regions are vertically adjacent sub-regions, and the third and fourth sub-regions are vertically adjacent sub-regions.

[0134] It should be noted that the overall area is divided into four sub-areas, such as Figure 6 As shown, the geometric features of each local region can be statistically analyzed in detail, avoiding the risk of global analysis masking detailed defects. For example, when the overall symmetry of the weld is good, the features of each sub-region (such as edge fluctuations) should be relatively similar; while local anomalies (such as undercut on one side) will lead to significant local deviations after partitioning.

[0135] S3542: Extract the edge contour of each sub-region to obtain the contour boundary of each sub-region, and discretize the contour boundary into several continuous boundary points;

[0136] It should be noted that edge contours are extracted for each sub-region and discretized into several continuous boundary points; the discretized boundary points provide discrete data for subsequent calculations, which can accurately capture the irregularities and local fluctuations of the edges.

[0137] S3543: Calculate the overall offset of the weld pattern and the coefficient of variation of the weld pattern edge for each sub-region by dividing several consecutive boundary points along the longitudinal dividing line of the center point.

[0138] It should be noted that the weld edge variation coefficient can be used to measure the irregularity and fluctuation of local edges. In symmetry detection, by comparing the weld edge variation coefficients of each sub-region (e.g., the first sub-region, the second sub-region, the third sub-region, and the fourth sub-region), the characteristics of each sub-region of a weld with a good symmetry structure should be similar. If the weld edge variation coefficient of a local region is abnormal, it indicates that the contour of that sub-region has shifted or changed irregularly, thus affecting the overall symmetry.

[0139] The overall offset of the weld pattern represents the average deviation of the actual weld pattern in this sub-region from the ideal symmetry center line;

[0140] S3544: By comparing the ratio of the first sub-region to the second sub-region with the ratio of the third sub-region to the fourth sub-region using the weld edge variation coefficient and the overall weld offset of each sub-region, a symmetry deviation index is obtained. The calculation formula is as follows:

[0141]

[0142] Q edgeThe symmetry deviation index is expressed as a comparison between the ratio of the first sub-region to the second sub-region and the ratio of the third sub-region to the fourth sub-region.

[0143] B is a preset adjustment parameter used to adjust the sensitivity of the formula comparison value;

[0144] Wj i (i = 1, 2, 3, 4) are the weld edge variation (fluctuation) coefficients in the four sub-regions of the first sub-region, the second sub-region, the third sub-region, and the fourth sub-region, respectively, reflecting the degree of irregularity of the local edge;

[0145] Δ i ′=Δ i ×G i (i = 1, 2, 3, 4) represents the overall offset of the weld pattern after geometric correction, where: Δ i It is the average deviation between the weld pattern and the ideal centerline symmetry line in the uncorrected i-th sub-region;

[0146] G i It is the corresponding geometric correction factor, used to eliminate errors caused by perspective or imaging angle;

[0147] It should be noted that the coefficient of variation of the weld edge obtained through step S3643 and the overall offset of the weld are used to calculate the coefficient of variation (i.e., fluctuation) of the weld between each sub-region (i.e., the first sub-region and the second sub-region, the third sub-region and the fourth sub-region) and the symmetry of the overall offset of the weld (i.e., the change in shape or irregular symmetry). This results in a symmetry deviation index, which reflects the abnormal undercut that occurs in a certain local area.

[0148] Using the ratios between the various sub-regions (e.g., the characteristic ratios between region 1 and region 2, region 3 and region 4), under ideal symmetry, these ratios should be nearly identical. If significant deviations occur, it may indicate a local anomaly (such as undercut), which statistically disrupts the symmetry of the entire weld. If the weld is absolutely symmetrical, these two ratios should be nearly equal. Once undercut or other defects are present, they usually cause changes in the local geometry of one side, leading to a significant difference between these two ratios.

[0149] Specifically, such as Figure 7 As shown, in step S3543, the overall offset of the weld bead and the coefficient of variation of the weld bead edge are calculated for several consecutive boundary points of each sub-region along the longitudinal dividing line of the center point. The specific operation steps are as follows:

[0150] S35431: Calculate the centroid coordinates of the boundary points of the left and right contour boundaries of each sub-region, and then connect the centroid coordinates of the boundary points of the left and right contour boundaries with a straight line to form the ideal center line.

[0151] The horizontal dividing line is used to find a parallel ideal center line, and the distance from the parallel ideal center line to the horizontal dividing line is calculated. The parallel ideal center line with the smallest distance is selected as the best center line.

[0152] It should be noted that the centroid coordinates of the boundary points of the left and right contour boundaries of the two-dimensional sub-region are calculated, for example, {(x1, y1), (x2, y2), ..., (x... 100 y 100 (Assuming there are 100 points); Calculate the centroid: mean of the x-coordinates: Mean of the ordinate: Left edge centroid: (C x,left C y,left Similarly, calculate the centroid of the right edge (C). x,right C y,right Then, the centroid coordinates of the boundary points of the left and right contour boundaries are connected by a straight line to form the theoretical axis of symmetry (i.e., the ideal center line, which serves as the initial axis of symmetry for calculating the offset). The centroid connection defines the symmetry reference. If the centroid connection deviates significantly from the expected position (e.g., due to undercut causing one side to be concave), it indicates that the symmetry is broken, which is used to calculate the offset of the weld.

[0153] Multiple ideal center lines parallel to the horizontal dividing line are identified as candidates, and their distances from the horizontal dividing line are calculated. Parallel ideal center lines can correct the offset caused by local anomalies, making the optimal center line more consistent with the true axis of symmetry of the actual target area. Selecting the parallel center line with the smallest distance as the optimal center line ensures that the offset obtained when calculating the vertical distance between the upper and lower contours through this center line is more in line with the actual situation. It is often the center line that is least affected by local anomalies and best represents the overall trend.

[0154] S35432: Connect the boundary points of the upper and lower contour boundaries of each sub-region vertically to the optimal center line, and calculate the vertical distance between the boundary points of all upper and lower contour boundaries.

[0155] Find the vertical distance with the smallest sum of vertical distances among all the boundary points of the upper and lower contour boundaries, and use it as the overall offset of the weld pattern.

[0156] It should be noted that for the upper and lower contour boundaries of each sub-region, the boundary points are vertically projected onto the determined optimal center line, and these vertical distances are calculated. The vertical distance reflects the degree of deviation between the region boundary and the ideal center line, and is a direct measure of weld pattern offset. It can also comprehensively reflect the symmetry and offset distribution of the entire weld pattern region.

[0157] The distances obtained from all vertical connections are statistically analyzed to find the combination scheme that minimizes the sum of vertical distances, and the distance of this combination is used as the overall offset of the weld. Minimizing the sum of vertical distances ensures that the selected optimal center line best matches the upper and lower boundaries as a whole. This selection can better reflect the actual offset state of the weld. By balancing the left-right and up-down relationships, the distortion of the overall offset caused by local anomalies is avoided, thus improving the detection accuracy.

[0158] S35433: The overall offset of the weld pattern at the boundary points is sorted using the interquartile range, and the average value of the overall offset of the weld pattern at the middle boundary points is calculated as the median of the overall offset of the weld pattern at the boundary points.

[0159] The average value of the overall offset of the weld pattern at the middle boundary point in the first half of the middle boundary point is calculated and used as the first quartile.

[0160] The average value of the overall offset of the weld pattern at the middle boundary point in the latter half of the middle boundary point is calculated and used as the third quartile.

[0161] The interquartile range is calculated using the first quartile and the third quartile.

[0162] The dimensionless index is calculated by using the median and interquartile range of the overall offset of the weld pattern at the boundary point, and is used as the weld pattern edge variation coefficient.

[0163] It should be noted that the overall offset of the weld lines at all boundary points is sorted by size, and the middle part is selected for statistical analysis. The average value of the middle part is calculated as the median. The interquartile range method is used to remove extreme offset values. The median is used as a central trend statistic and can reflect the representative value of the overall offset.

[0164] The first quartile is calculated by averaging the first half of the intermediate boundary points, and the third quartile is calculated by averaging the second half. The interquartile range is then calculated using both. The interquartile range is a robust dispersion measure that can measure the degree of data variation and reflects the dispersion of the overall weld offset at different boundary points. Compared with extreme values ​​or standard deviation, the interquartile range is more sensitive to outliers and is more suitable for handling the coefficient of variation that may exist in actual measurements due to deviations from the data.

[0165] By calculating the median and interquartile range (usually the ratio of the two or other normalization methods), a dimensionless index is obtained, namely the weld edge variation coefficient. The dimensionless index is not affected by specific numerical dimensions, which allows for horizontal comparison between different regions and different welds. Thus, the dimensionless index can be used as a variation coefficient to directly reflect the stability of the weld edge. A higher variation coefficient indicates that the edge offset has large fluctuations, which may indicate undercut or other quality problems; a lower variation coefficient indicates that the weld edge is relatively stable and consistent.

[0166] Example 2

[0167] like Figure 9 As shown, this application also provides a visual image detection-based system for identifying and processing weld undercut defects in machined parts, including: a data acquisition module 10; a weld pattern module 20; an analysis module 30; and a judgment module 40.

[0168] The acquisition module 10 is used to acquire images of the workpiece, preprocess the images of the workpiece, and obtain the image to be detected.

[0169] The weld pattern module 20 is used to analyze the image to be detected using an edge detection algorithm to obtain the weld pattern region of the image to be detected.

[0170] The analysis module 30 is used to smooth the weld texture area and obtain sampling points; calculate the total arc length of the weld texture area based on the sampling points; calculate the curvature of each sampling point based on the total arc length; filter out abnormal points based on the curvature of the sampling points; form an undercut area based on the abnormal points; and divide the undercut area to calculate the symmetry deviation index.

[0171] The judgment module 40 is used to determine whether there is biting based on the symmetry deviation index.

[0172] In summary, the present invention provides a method and system for identifying and processing weld seam defects based on visual image detection. This method utilizes curve restoration to smooth the weld seam area and obtain sampling points. The connection of these sampling points yields an approximate curve of the weld seam area, reflecting its shape and contour curvature. Furthermore, the total arc length of the approximate curve is calculated to determine the contour length of the weld seam area. The curvature and curvature distribution of the sampling points are calculated using the total arc length of the approximate curve. This calculation reveals the degree of curvature along different positions, improving the accuracy of extracting abnormal points and avoiding errors. Finally, based on the curvature and curvature distribution of the sampling points, the curvature fluctuations of the sampling points in the surrounding neighborhood are assessed to determine if asymmetrical changes exist, thus filtering out abnormal points.

[0173] Furthermore, the level set method is used to construct convex hull boundaries for outliers. The regions not covered by the convex hull boundary are used as initial candidate biting regions. After neighborhood coverage, isolated outliers that may contain errors can also be identified, improving the capture rate of the true region boundary. The boundary distance between pixels inside and outside the approximate curve of the candidate biting region is calculated, reflecting the spatial distribution of pixels inside and outside the candidate biting region. The level set function is calculated using the boundary distance to reflect the segmentation state of the approximate curve, i.e., the biting region of the true boundary. Grayscale driving force is obtained by calculating the grayscale values ​​of pixels inside and outside the approximate curve, reflecting the background and foreground of the biting region. Curvature driving force is calculated using the curvature of the approximate curve, reflecting the regularity of the contour. An energy function is calculated using the curvature driving force and the grayscale driving force, reflecting information such as the shape of the candidate biting region. The energy function is then used to update the level set function to find the biting region.

[0174] Furthermore, the undercut area is segmented into sub-regions using a segmentation algorithm to avoid the risk of global analysis masking detailed defects. For each sub-region, boundary points are extracted based on the edge contour, capturing the weld edge variation coefficient and overall weld offset to reflect the irregularity and local fluctuations of the sub-region. Additionally, a symmetry deviation index is calculated to reflect abnormal undercut occurring in a specific locality, such as... Figure 8 As shown.

[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; those skilled in the art can modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for identifying and processing weld undercut defects in machined parts based on visual image detection, characterized in that, The following steps are included: Images of the workpiece are acquired and preprocessed to obtain the image to be inspected; The image to be detected is analyzed using an edge detection algorithm to obtain the weld texture region of the image to be detected; The weld bead area is smoothed to obtain sampling points; The total arc length of the weld bead region is calculated based on the sampling points. The curvature of each sampling point is then calculated using the total arc length. Anomalies are filtered based on the curvature of the sampling points. Undercut regions are formed using the anomalies, and the undercut regions are segmented to calculate the symmetry deviation index. The presence of bite edge is determined based on the aforementioned symmetry deviation index; The weld bead region is smoothed to obtain sampling points; the total arc length of the weld bead region is calculated based on the sampling points. The specific operation steps are as follows: The weld pattern area is smoothed using curve restoration to obtain s1, s2...sn sampling points; Connect each adjacent sampling point with a straight line to obtain an approximate curve; calculate the Euclidean distance between adjacent sampling points in the approximate curve as the arc length increment between sampling points; Calculate the arc length increment of each sampling point from sampling point s1 to sampling point sn to obtain the total arc length of the approximate curve; The curvature of each sampling point is calculated using the total arc length. Outliers are then filtered based on the curvature of the sampling points. The specific steps are as follows: For each sampling point of the total arc length of the approximate curve, the incremental arc length is parameterized, and the sampling point is mapped to a two-dimensional parameter. A two-dimensional parametric curve is constructed through the mapping parameter of each sampling point. The equation of the circle is calculated by least-squares circle fitting for each sampling point in the two-dimensional parametric curve and its neighboring sampling points. And calculate the sum of squared distances from all neighboring sampling points to the sampling points on the circle; The curvature of the sampling point is calculated based on the equation of the circle using the sum of squared distances. The curvature of all sampling points is calculated to obtain the curvature distribution of the two-dimensional parametric curve; Using the sampling point as the center point, calculate the average curvature of each sampling point in the preceding and following neighborhoods of the sampling point, and further calculate the standard deviation of the curvature of the average curvature of each sampling point in the preceding and following neighborhoods. Set an outlier asymmetry threshold and check whether the standard deviation of curvature of each sampling point in the neighborhood before and after the sampling point is less than the outlier asymmetry threshold. If so, then the curvature of each sampling point in the preceding and following neighborhoods of the sampling point is determined to be fluctuating, and is regarded as an outlier. The abnormal points are used to form an edge-biting region, and the edge-biting region is segmented and a symmetry deviation index is calculated, including: The convex hull boundary of outliers is calculated using the level set method, and the coverage area of ​​the convex hull boundary is used as a candidate biting edge region; the level set function of the approximate curve is obtained for the candidate biting edge region. The energy function of the interior and exterior of the candidate bite edge region is calculated using the approximate curve; The level set function is updated using an energy function to find the biting edge region; the biting edge region is divided into sub-regions, and the symmetry deviation index is calculated based on the edge contour of the sub-regions; The convex hull boundary of outliers is calculated using the level set method, and the coverage area of ​​the convex hull boundary is used as a candidate biting edge region. An approximate curve is then obtained for the candidate biting edge region to calculate the level set function. The specific steps are as follows: The convex hull boundary of the selected outliers is calculated using the level set method. The outliers cover the surrounding pixels after the convex hull boundary calculation, until all outliers completely cover the surrounding pixels. The area covered by each outlier is taken as the candidate biting edge area. For each candidate bite area, an approximate curve is obtained; For each candidate edge-biting region, the number of pixels inside and outside the approximate curve is counted; and the distance from the pixels inside and outside the approximate curve of each candidate edge-biting region to the boundary of the approximate curve is calculated. The boundary distances calculated from the pixels inside and outside the approximate curve are combined to form a level set function. The level set function represents the segmentation function between the interior and exterior of the approximate curve of the candidate bite edge region; The energy function is calculated for the interior and exterior of the candidate bite region using the approximate curve; the level set function is then updated using the energy function to find the bite region. The specific operation steps are as follows: Calculate the internal average gray value and external average gray value of the pixels for the approximate curve of the candidate edge-biting region, respectively. The curvature of the approximate curve of the candidate bite edge region is calculated; The finite difference method is used to calculate the average gray difference between the internal average gray value and the external average gray value of the approximate curve of the candidate edge-biting region, which serves as the gray-level driving force. The approximate curve of the candidate bite edge region is used to find outliers with maximum curvature and minimum curvature. The outliers corresponding to the maximum curvature are smoothed, and the smoothed outliers corresponding to the maximum curvature and minimum curvature are used as curvature driving forces. The energy function is obtained by calculating the grayscale driving force and the curvature driving force. The energy function is represented as the segmentation state of the approximate curve of the candidate bite region by the level set function; The level set function is updated using an energy function to find the bitten edge region; the bitten edge region is then divided into sub-regions, and the symmetry deviation index is calculated based on the edge contours of the sub-regions. The specific operation steps are as follows: The horizontal set function of the candidate biting edge region is initialized; and the energy function is quantized using gradient descent based on the grayscale driving force and the curvature driving force, so that the horizontal set function is updated. A preset function update threshold p is used to determine whether the updated level set function is equal to the function update threshold p. If so, then determine whether the updated level set function has found the bitten edge region; If not, then iteratively update the level set function until the updated level set function equals the function update threshold p; The biting edge region is divided into sub-regions using a segmentation algorithm. The boundary points of the edge contours of the sub-regions are discretized, and the symmetry deviation index is calculated using the boundary points of the sub-regions. The bitten edge region is divided into sub-regions using a segmentation algorithm. The boundary points of the edge contours of the sub-regions are discretized. The symmetry deviation index is calculated using the boundary points of the sub-regions. The specific operation steps are as follows: The biting edge region is divided into four sub-regions: a first sub-region, a second sub-region, a third sub-region, and a fourth sub-region using a segmentation algorithm. The sub-region is the horizontal division of the bite-edge region. After finding the center point on the horizontal dividing line, the sub-region is then vertically divided along the center point. The first and second sub-regions of the bitten edge region are left and right adjacent sub-regions, and the third and fourth sub-regions are left and right adjacent sub-regions; the first and second sub-regions are vertically adjacent sub-regions, and the third and fourth sub-regions are vertically adjacent sub-regions. For each sub-region, the edge contour is extracted to obtain the contour boundary of each sub-region, and the contour boundary is discretized into a number of continuous boundary points; For each sub-region, the overall offset of the weld pattern and the coefficient of variation of the weld pattern edge are calculated by dividing several consecutive boundary points along the longitudinal dividing line of the center point. By comparing the ratio of the first sub-region to the second sub-region with the ratio of the third sub-region to the fourth sub-region using the weld edge variation coefficient and the overall weld offset of each sub-region, a symmetry deviation index is obtained.

2. The method for identifying and processing weld undercut defects in machined parts based on visual image detection according to claim 1, characterized in that, For each sub-region, the overall offset of the weld bead and the coefficient of variation of the weld bead edge are calculated along the longitudinal dividing line formed by dividing several consecutive boundary points along the center point. The specific operation steps are as follows: Calculate the centroid coordinates of the boundary points of the left and right contour boundaries of each sub-region, and then connect the centroid coordinates of the boundary points of the left and right contour boundaries with a straight line to form the ideal center line. The horizontal dividing line is used to find a parallel ideal center line, and the distance from the parallel ideal center line to the horizontal dividing line is calculated. The parallel ideal center line with the smallest distance is selected as the best center line. Connect the boundary points of the upper and lower contour boundaries of each sub-region vertically to the optimal center line, and calculate the vertical distance between the boundary points of all upper and lower contour boundaries. Find the vertical distance with the smallest sum of vertical distances among all the boundary points of the upper and lower contour boundaries, and use it as the overall offset of the weld pattern.

3. The method for identifying and processing weld seam defects based on visual image detection in a machined part according to claim 2, characterized in that, The specific steps for calculating the variation coefficient of weld edge are as follows: The overall offset of the weld pattern at the boundary points is sorted using the interquartile range, and the average value of the overall offset of the weld pattern at the middle boundary points is calculated as the median of the overall offset of the weld pattern at the boundary points. The average value of the overall offset of the weld pattern at the middle boundary point in the first half of the middle boundary point is calculated and used as the first quartile. The average value of the overall offset of the weld pattern at the middle boundary point in the latter half of the middle half is calculated and used as the third quartile. The interquartile range is calculated using the first quartile and the third quartile. The dimensionless index is calculated by using the median of the overall offset of the weld pattern at the boundary point and the interquartile range, and is used as the weld pattern edge variation coefficient.

Citation Information

Patent Citations

  • Steel die welding defect detection method and system based on machine vision

    CN115100171A

  • Lithium battery shell welding quality detection method based on machine vision

    CN117929386A