Method for on-line intelligent detection of welding seam defects based on machine vision
By adaptively adjusting the resolution of the Freeman chain code and combining the features of the weld edge line and the fitted straight line, the detection method is dynamically adjusted, which solves the contradiction between accuracy and efficiency in weld bend defect detection and achieves efficient weld bend defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU ZHIXIANG HAIGONG ROBOTICS CO LTD
- Filing Date
- 2026-05-20
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies struggle to balance accuracy and efficiency in weld bend defect detection. Fixed low-resolution encoding modes cannot effectively capture subtle changes, while fixed high-resolution encoding modes significantly increase computational load, impacting online detection efficiency.
By acquiring the main edge lines and fitted straight line features on both sides of the weld bead, the resolution of the Freeman chain code is adaptively adjusted. Combined with the interval difference of the overall and local constraint parallel lines, the resolution of the Freeman chain code is dynamically adjusted to detect weld bead bending defects.
It achieves improved accuracy in detecting weld bend defects while ensuring detection efficiency, effectively capturing smooth, gradual, subtle bend patterns and improving detection precision.
Smart Images

Figure CN122244028A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, and more specifically to an online intelligent detection method for weld defects based on machine vision. Background Technology
[0002] In automated welding production, weld bead formation quality is a key indicator of welding process stability. Weld bead bending is a common forming defect, characterized by the weld centerline deviating from the preset straight welding path, forming an unexpected arc or bend. This type of defect significantly weakens the mechanical properties of the weld, leading to stress concentration and affecting the fatigue life and sealing performance of structural components. Therefore, high-precision online intelligent detection methods for weld bead bending defects are of great significance for ensuring welding quality and improving the yield rate of automated production.
[0003] Existing technologies typically employ weld contour descriptors based on Freeman chain codes for weld bend defect detection. This involves first obtaining the binary contour of the weld edge, then using a skeleton extraction algorithm to obtain the single-pixel centerline of the weld, and finally using Freeman chain codes to encode the orientation of the centerline pixels. By statistically analyzing the number and magnitude of orientation changes between adjacent chain codes, weld bend defects are identified and detected. The core principle is to characterize the degree of weld bend through abrupt changes in chain code orientation between adjacent pixels. However, in actual production inspections, weld bend defects often exhibit a smooth, gradual overall bend, with extremely small changes in chain code orientation between adjacent pixels. This means that fixed low-resolution encoding modes based on local orientation changes cannot effectively capture such subtle changes, reducing detection accuracy. While fixed high-resolution encoding modes can effectively capture subtle changes, they significantly increase computational load, impacting online detection efficiency. Ultimately, it is difficult to balance detection accuracy and efficiency. Summary of the Invention
[0004] To address the aforementioned technical problems, the present invention aims to provide an online intelligent detection method for weld defects based on machine vision. The specific technical solution adopted is as follows:
[0005] Obtain the main edge lines on both sides of the weld in the weld image;
[0006] Obtain fitted straight lines of the main edge lines on both sides of the weld bead; obtain geometric distortion feature values based on the distance characteristics of the main edge lines and the corresponding fitted straight lines, and the positional distribution characteristics of the fitted straight lines on both sides of the weld bead; determine the resolution of the Freeman chain code based on the geometric distortion feature values and obtain suspected curved weld bead;
[0007] Obtain the overall constraint parallel lines of the main edge lines on both sides of the suspected curved weld bead; obtain the interval difference degree based on the difference characteristics between the interval width of the overall constraint parallel lines and the interval width of the main edge lines; determine the resolution of the Freeman chain code based on the interval difference degree and obtain the local curved weld bead; obtain the local constraint parallel lines of the main edge lines on both sides of the local curved weld bead, and determine the resolution of the Freeman chain code based on the interval difference degree corresponding to the local constraint parallel lines.
[0008] The bending features of all weld beads are extracted based on Freeman chain codes of different resolutions, and weld bend defects are detected.
[0009] Further, the step of obtaining the geometric distortion feature value based on the distance characteristics of the main edge line and the corresponding fitted straight line, and the positional distribution characteristics of the fitted straight lines on both sides of the weld bead includes:
[0010] In the formula, W represents the geometric distortion characteristic value of the weld bead. This represents the angle between the fitted straight lines on both sides of the weld bead. Represents the sine function. Represents the hyperbolic tangent function; This represents the average Euclidean distance between all pixels on the main edge line of any side of the weld bead and the corresponding pixels on the fitted straight line. This represents the average Euclidean distance between all pixels on the main edge line on the other side of the weld and the corresponding fitted straight line pixels.
[0011] Furthermore, the step of determining the resolution of the Freeman chain code and obtaining suspected bent weld beads based on the geometric distortion feature values includes:
[0012] When the geometric distortion feature value is less than a preset first threshold, a preset low-resolution Freeman chain code direction encoding is used; when the geometric distortion feature value is not less than the preset first threshold, the weld bead is regarded as a suspected bent weld bead, and the resolution of the Freeman chain code cannot be determined at present.
[0013] Furthermore, the step of obtaining the overall constraint parallel lines of the main edge lines on both sides of the suspected curved weld bead includes:
[0014] Construct any two parallel lines such that the main edge lines on both sides of the suspected curved weld bead are completely between the two parallel lines, and use the two parallel lines with the narrowest interval as the overall constraint parallel lines.
[0015] Further, the step of obtaining the interval difference degree based on the difference characteristics between the interval width of the overall constraint parallel lines and the interval width of the main edge lines includes:
[0016] In the formula, H represents the interval difference degree, L represents the vertical distance between the overall constraint parallel lines, and N represents the number of pixels of the shortest main edge line on both sides of the suspected curved weld. A Cartesian coordinate system is constructed with the horizontal direction of the overall constraint parallel lines as the X-axis direction. This represents the ordinate of the nth pixel on the shortest principal edge in a Cartesian coordinate system. This represents the ordinate of the nth pixel in the Cartesian coordinate system of another main edge line.
[0017] Furthermore, the step of determining the resolution of the Freeman chain code and obtaining the locally bent weld bead based on the interval difference includes:
[0018] When the interval difference is less than a preset second threshold, a preset high-resolution Freeman chain code direction encoding is used; when the interval difference is not less than the preset second threshold, the suspected bent weld bead is treated as a local bent weld bead, and the resolution of the Freeman chain code cannot be determined at present.
[0019] Furthermore, the step of obtaining the local constraint parallel lines of the main edge lines on both sides of the locally bent weld bead includes:
[0020] Using a preset sliding window and preset sliding step size, slide on the locally curved weld bead to construct a local constraint parallel line of the main edge line within the sliding window for each slide.
[0021] Further, the step of determining the resolution of the Freeman chain code based on the interval difference corresponding to the local constraint parallel lines includes:
[0022] When the interval difference corresponding to the local constraint parallel line is less than a preset third threshold, the local main edge line corresponding to the local constraint parallel line adopts preset high-resolution Freeman chain code direction encoding; when the interval difference corresponding to the local constraint parallel line is not less than the preset third threshold, the local main edge line corresponding to the local constraint parallel line adopts preset low-resolution Freeman chain code direction encoding.
[0023] Furthermore, the step of extracting the bending features of all weld beads based on Freeman chain codes of different resolutions and detecting weld bend defects includes:
[0024] The segmented encoding of the entire weld centerline is obtained by using Freeman chain code. The directional change between adjacent chain codes is counted, and the area where the directional change exceeds the preset small fluctuation threshold is identified as the area of weld bending defect.
[0025] The present invention has the following beneficial effects:
[0026] In this invention, obtaining the fitted straight line can be used to quickly determine the weld bead state. Obtaining the geometric distortion feature value can preliminarily and quickly determine the applicable Freeman chain code and suspected bent weld bead based on the macroscopic geometric features of the main edge lines on both sides of the weld bead, thus initially improving detection efficiency. Obtaining the overall constraint parallel lines can further analyze the bending situation of suspected bent weld beads. Obtaining the interval difference can determine the bending situation of suspected bent weld beads and provide the applicable Freeman chain code resolution based on the difference between the interval width of the overall constraint parallel lines and the interval width of the main edge lines. Obtaining the local constraint parallel lines on both sides of the main edge lines of the locally bent weld bead, and determining the Freeman chain code resolution based on the interval difference corresponding to the local constraint parallel lines, can finely analyze the applicable Freeman chain code resolution at different positions on the locally bent weld bead. Finally, the bending features of all weld beads are extracted based on the Freeman chain codes of different resolutions, and the weld bead bending defect is detected, which can improve the accuracy of weld bead bending defect detection while ensuring detection efficiency. Attached Figure Description
[0027] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, 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 online intelligent detection method for weld defects based on machine vision, provided as an embodiment of the present invention. Detailed Implementation
[0029] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a machine vision-based online intelligent detection method for weld defects proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0031] The following description, in conjunction with the accompanying drawings, details a specific scheme for an online intelligent detection method for weld defects based on machine vision provided by the present invention.
[0032] Please see Figure 1 The diagram illustrates a flowchart of an online intelligent detection method for weld defects based on machine vision, according to an embodiment of the present invention. The method includes the following steps:
[0033] Step S1: Obtain the main edge lines on both sides of the weld in the weld image.
[0034] In this embodiment of the invention, the implementation scenario is online detection of bending defects in weld beads, improving detection accuracy while ensuring detection efficiency. A high-resolution linear industrial camera, combined with a laser-assisted light source, is used to acquire images of the welding area on an automated welding production line; the lateral resolution is better than 0.02 mm / pixel, which can clearly capture the fine geometric shape of the weld bead edge. For each weld bead, a complete surface grayscale image is acquired to ensure uniform illumination and clear weld bead edges. Guided filtering and adaptive gamma correction are applied to the acquired images to uniformly illuminate and suppress local overexposure or underexposure caused by arc spatter and reflection; cascaded median filtering and bilateral filtering remove spatter noise and maintain edge sharpness; finally, local contrast normalization is used to enhance the grayscale gradient between the weld bead and the base material, thereby obtaining the weld bead image.
[0035] Furthermore, adaptive thresholding is performed on the preprocessed weld image to distinguish the weld foreground from the base material background. Morphological operations are then used to remove isolated noise and fill in the micro-pores inside the weld, resulting in a complete weld region. All edge contours of the weld region are extracted. Based on the inherent geometric features of the weld edges exhibiting a similar parallel distribution, and combined with the spatial position and direction of the edges, the main edge lines on both sides of the weld are selected. These two main edge lines can reflect the approximate shape distribution characteristics of the weld, and subsequent analysis can be performed based on the main edge lines on both sides of the weld.
[0036] Step S2: Obtain the fitted straight lines of the main edge lines on both sides of the weld bead. Based on the distance characteristics of the main edge lines and the corresponding fitted straight lines, and the positional distribution characteristics of the fitted straight lines on both sides of the weld bead, obtain the geometric distortion feature values. Based on the geometric distortion feature values, determine the resolution of the Freeman chain code and obtain the suspected curved weld bead.
[0037] Traditional weld bend detection methods use Freeman chain codes with fixed resolution, which suffers from insufficient accuracy in detecting smooth, progressive bend defects. Using high-resolution codes for all welds leads to a surge in computation, failing to meet the timeliness requirements of online detection. Therefore, to improve accuracy and timeliness, the resolution of the Freeman chain codes needs to be adaptively adjusted based on the weld bend condition. First, the macroscopic fitted straight line features of the main edge lines on both sides of the weld bend are used to quickly distinguish between normal straight welds and suspected bent welds. Normal welds are directly detected using low-resolution, high-efficiency chain codes, while suspected bent welds are further analyzed, thereby significantly improving overall detection efficiency while maintaining detection accuracy. Therefore, the fitted straight lines of the main edge lines on both sides of the weld bend are obtained. In this embodiment, the least squares method is used to fit the main edge lines. Geometric distortion feature values are obtained based on the distance features between the main edge lines and the corresponding fitted straight lines, and the positional distribution features of the fitted straight lines on both sides of the weld bend. Preferably, in this embodiment, the step of obtaining the geometric distortion feature values includes: ; In the formula, W represents the geometric distortion characteristic value of the weld bead. This represents the angle between the fitted straight lines on both sides of the weld bead, and the value of this angle ranges from... The smaller the included angle, the closer the two fitted lines are to being parallel, and the less likely the weld bead is to be bent. This represents the sine function. Represents the hyperbolic tangent function; This represents the average Euclidean distance between all pixels on the main edge line of any side of the weld bead and the corresponding pixels on the fitted straight line. This represents the average Euclidean distance between all pixels on the main edge line on the other side of the weld and the corresponding pixels on the fitted straight line. When The larger the value, the more severe the deviation between the main edge line and the corresponding fitted straight line, the less obvious the linear characteristics of the main edge line, and the greater the degree of geometric distortion. Therefore, the larger the geometric distortion characteristic value, the greater the possibility that the weld bead has non-parallel edges or edge distortion, and the more likely the weld bead is to be curved; the smaller the value, the more parallel the main edges on both sides of the weld bead are and the better the straight line is.
[0038] Furthermore, by fitting a straight line to the main edge line, weld beads can be quickly screened initially. The resolution of the Freeman chain code is determined based on the geometric distortion feature value, and suspected bent weld beads are obtained. Preferably, in this embodiment of the invention, when the geometric distortion feature value is less than a preset first threshold, it means that the weld bead is a normal straight weld bead, and a preset low-resolution Freeman chain code direction encoding can be used to improve detection efficiency. When the geometric distortion feature value is not less than the preset first threshold, it means that the weld bead may have a bending defect, and the weld bead is considered a suspected bent weld bead. At present, the resolution of the Freeman chain code cannot be determined, and further analysis is required to ensure detection accuracy. In this embodiment of the invention, the preset first threshold is 0.3. The smaller threshold aims to ensure sufficient detection capability for slightly bent weld beads, avoiding misjudging them as normal weld beads and causing missed detections, while still filtering out most straight weld beads, achieving a balance between detection efficiency and accuracy. The preset low resolution is 8 directions; the implementer can set it according to the implementation scenario.
[0039] Step S3: Obtain the overall constraint parallel lines of the main edge lines on both sides of the suspected curved weld bead; obtain the interval difference degree based on the difference between the interval width of the overall constraint parallel lines and the interval width of the main edge lines; determine the resolution of the Freeman chain code based on the interval difference degree and obtain the local curved weld bead; obtain the local constraint parallel lines of the main edge lines on both sides of the local curved weld bead, and determine the resolution of the Freeman chain code based on the interval difference degree corresponding to the local constraint parallel lines.
[0040] Suspected bent welds identified through initial screening may exhibit various deformation patterns, such as overall bending, local bulging, or irregular edges. To further improve detection efficiency and accuracy, it is necessary to analyze the weld state of suspected bent welds and use different resolutions for different types of welds. First, obtain the overall constraint parallel lines of the main edge lines on both sides of the suspected bent weld. Preferably, in this embodiment, obtaining the overall constraint parallel lines includes: constructing any two parallel lines such that the main edge lines on both sides of the suspected bent weld are completely between the two parallel lines, and using the two parallel lines with the narrowest interval as the overall constraint parallel lines. It should be noted that the extension direction of the main edge lines is similar to the direction of the parallel lines; the overall constraint parallel lines can measure the degree of bending of the suspected bent weld, and the interval difference can be obtained based on the difference between the interval width of the overall constraint parallel lines and the interval width of the main edge lines; preferably, in this embodiment, obtaining the interval difference includes: ; In the formula, H represents the interval difference degree, L represents the vertical distance between the overall constraint parallel lines, and N represents the number of pixels of the shortest main edge line on both sides of the suspected curved weld. A Cartesian coordinate system is constructed with the horizontal direction of the overall constraint parallel lines as the X-axis. This coordinate system allows the interval width between the main edge lines to be measured through the ordinate. This represents the ordinate of the nth pixel on the shortest principal edge in a Cartesian coordinate system. This represents the ordinate of the nth pixel in the Cartesian coordinate system of another main edge line. If the suspected curved weld bead has a low degree of curvature and is relatively smooth, the spacing width of the overall constraint parallel lines is similar to the spacing width of the main edge lines on both sides of the suspected curved weld bead. This represents the distance between pixels of the same position on two main edge lines. The closer this distance is to the perpendicular distance between parallel lines, the better. The smaller the value, the less the overall curvature of the suspected bent weld bead; conversely, when... The larger the value, the more pronounced the overall or local bending of the suspected bent weld bead, resulting in a wider overall constraint parallel line.
[0041] Furthermore, the smaller the interval difference, the less obvious the bending of the suspected bent weld bead. To improve detection accuracy, a higher resolution Freeman chain code is required. Conversely, the larger the interval difference, the more obvious the bending of the suspected bent weld bead, but it cannot yet be determined whether the bending is significant overall or localized. Therefore, the resolution of the Freeman chain code can be determined based on the interval difference to obtain the locally bent weld bead. Preferably, in this embodiment, when the interval difference is less than a preset second threshold, it means that although the bending characteristics of the suspected bent weld bead are weak at the macroscopic scale, it may still have a gradual, slight bending with a large bending radius and smooth changes. To improve detection precision and accuracy, a preset high-resolution Freeman chain code direction encoding is required. When the interval difference is not less than the preset second threshold, it means that at least one part of the weld bead has obvious bending characteristics, but the location of the obvious bending cannot be determined. Therefore, the suspected bent weld bead is treated as a locally bent weld bead. Since the resolution of the Freeman chain code cannot be determined at present, the suspected bent weld bead needs to be split to analyze the bending characteristics of different local locations, thereby further limiting the resolution and improving detection timeliness. In this embodiment of the invention, the preset second threshold is 0.4. The smaller threshold is intended to ensure sufficient detection capability for slightly bent weld beads, while balancing detection timeliness; the preset high resolution is 16 directions; the implementer can determine it according to the implementation scenario.
[0042] For locally curved welds where the resolution is currently undetermined, refined analysis is required. First, local constraint parallel lines of the main edge lines on both sides of the locally curved weld are obtained. Preferably, in this embodiment, a preset sliding window and a preset sliding step size are used to slide along the locally curved weld, constructing the local constraint parallel lines of the main edge lines within the sliding window for each slide. It should be noted that the method for obtaining the local constraint parallel lines is the same as that for the overall constraint parallel lines. In this embodiment, the preset sliding window length is 100 pixels, aiming to balance the ability to capture subtle local deformations with algorithm detection efficiency. The preset sliding step size is half the window length, which can be determined by the implementer according to the implementation scenario. Acquiring local constraint parallel lines can capture local morphological features. Furthermore, the resolution of the Freeman chain code can be determined based on the interval difference corresponding to the local constraint parallel lines. Preferably, in this embodiment, when the interval difference corresponding to the local constraint parallel lines is less than a preset third threshold, it means that the interval width of the local main edge line is close to the interval width of the local constraint parallel lines. Therefore, the bending features at this local weld bead are weak, the deformation is relatively gentle, and it is easy to miss detection. Thus, the local main edge line corresponding to the local constraint parallel lines uses a preset high-resolution Freeman chain code direction encoding. When the interval difference corresponding to the local constraint parallel lines is not less than the preset third threshold, it means that the deformation of this local weld bead is significant, the bending features are relatively obvious and clear, and it is easy to identify. Therefore, for detection efficiency, the local main edge line corresponding to the local constraint parallel lines uses a preset low-resolution Freeman chain code direction encoding. It should be noted that the calculation method for the interval difference corresponding to the local constraint parallel lines is the same as that for the overall constraint parallel lines. In this embodiment, the preset third threshold is 0.5. This threshold aims to balance detection accuracy and detection efficiency, limiting high-resolution encoding to the key areas that truly need analysis. The implementer can determine this threshold according to the implementation scenario. For weld beads in overlapping areas during the sliding process, the highest resolution is used for encoding.
[0043] Step S4: Extract the bending features of all weld beads according to the Freeman chain code of different resolutions and detect weld bend defects.
[0044] Low-resolution Freeman chain codes, such as those in 8 directions with 45-degree angles between adjacent directions, enable rapid directional feature extraction. The low-resolution chain codes have low computational cost and fast encoding speed, significantly reducing overall detection time and meeting the needs of online real-time detection. This allows limited computational resources to be allocated to areas requiring fine-grained inspection. Low-resolution chain codes are suitable for straight weld beads and weld beads with significant bends. High-resolution Freeman chain codes, such as those in 16 directions with 22.5-degree angles between adjacent directions, capture smooth, gradual, subtle changes with high sensitivity. The high-resolution chain codes, with smaller angle quantization steps, significantly improve sensitivity to subtle bends, thus accurately identifying weak bending defects that are difficult to detect using traditional methods. High-resolution chain codes are suitable for weld beads with subtle and weak bends. Finally, the bending features of all weld beads are extracted based on Freeman chain codes at different resolutions to detect weld bend defects. First, the segmented encoding of the weld bend centerline is extracted based on the resolution of the Freeman chain code of the local region to which the pixel belongs. The directional change between adjacent chain codes is statistically analyzed, and regions where the directional change exceeds a preset micro-fluctuation threshold are identified as areas of weld bend defects. Further analysis is then performed on these marked areas. The implementer can determine the preset micro-fluctuation threshold according to the implementation scenario. Thus, by encoding the weld bend centerline using Freeman chain codes with adaptive resolution, online detection efficiency can be ensured while improving the accuracy of detecting minute bending defects.
[0045] In summary, this invention provides an online intelligent detection method for weld defects based on machine vision. It obtains geometric distortion feature values based on the distance characteristics between the main edge line and the corresponding fitted straight line, and the positional distribution characteristics of the fitted straight lines on both sides of the weld. The resolution of the Freeman chain code is determined based on the geometric distortion feature values to obtain suspected bent welds. The interval difference degree is obtained based on the difference between the interval width of the overall constraint parallel lines and the interval width of the main edge line. The resolution of the Freeman chain code is determined based on the interval difference degree to obtain locally bent welds. The resolution of the Freeman chain code is determined based on the interval difference degree corresponding to the locally constraint parallel lines. The bending features of all welds are extracted based on Freeman chain codes of different resolutions, and weld bending defects are detected, thus improving detection accuracy while ensuring detection efficiency.
[0046] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0047] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A machine vision-based online intelligent detection method for weld defects, characterized in that, The method includes the following steps: Obtain the main edge lines on both sides of the weld in the weld image; Obtain fitted straight lines of the main edge lines on both sides of the weld bead; obtain geometric distortion feature values based on the distance characteristics of the main edge lines and the corresponding fitted straight lines, and the positional distribution characteristics of the fitted straight lines on both sides of the weld bead; determine the resolution of the Freeman chain code based on the geometric distortion feature values and obtain suspected curved weld bead; Obtain the overall constraint parallel lines of the main edge lines on both sides of the suspected curved weld bead; obtain the interval difference degree based on the difference characteristics between the interval width of the overall constraint parallel lines and the interval width of the main edge lines; determine the resolution of the Freeman chain code based on the interval difference degree and obtain the local curved weld bead; obtain the local constraint parallel lines of the main edge lines on both sides of the local curved weld bead, and determine the resolution of the Freeman chain code based on the interval difference degree corresponding to the local constraint parallel lines. The bending features of all weld beads are extracted based on Freeman chain codes of different resolutions, and weld bend defects are detected.
2. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of obtaining the geometric distortion feature value based on the distance characteristics of the main edge line and the corresponding fitted straight line, and the positional distribution characteristics of the fitted straight lines on both sides of the weld bead includes: In the formula, W represents the geometric distortion characteristic value of the weld bead. This represents the angle between the fitted straight lines on both sides of the weld bead. Represents the sine function. Represents the hyperbolic tangent function; This represents the average Euclidean distance between all pixels on the main edge line of any side of the weld bead and the corresponding pixels on the fitted straight line. This represents the average Euclidean distance between all pixels on the main edge line on the other side of the weld and the corresponding fitted straight line pixels.
3. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of determining the resolution of the Freeman chain code and obtaining suspected bent weld beads based on the geometric distortion feature values includes: When the geometric distortion feature value is less than a preset first threshold, a preset low-resolution Freeman chain code direction encoding is used; when the geometric distortion feature value is not less than the preset first threshold, the weld bead is regarded as a suspected bent weld bead, and the resolution of the Freeman chain code cannot be determined at present.
4. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of obtaining the overall constraint parallel lines of the main edge lines on both sides of the suspected curved weld bead includes: Construct any two parallel lines such that the main edge lines on both sides of the suspected curved weld bead are completely between the two parallel lines, and use the two parallel lines with the narrowest interval as the overall constraint parallel lines.
5. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of obtaining the interval difference degree based on the difference characteristics between the interval width of the overall constraint parallel lines and the interval width of the main edge lines includes: In the formula, H represents the interval difference degree, L represents the vertical distance between the overall constraint parallel lines, and N represents the number of pixels of the shortest main edge line on both sides of the suspected curved weld. A Cartesian coordinate system is constructed with the horizontal direction of the overall constraint parallel lines as the X-axis direction. This represents the ordinate of the nth pixel on the shortest principal edge in a Cartesian coordinate system. This represents the ordinate of the nth pixel in the Cartesian coordinate system of another main edge line.
6. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of determining the resolution of the Freeman chain code and obtaining the locally bent weld bead based on the interval difference includes: When the interval difference is less than a preset second threshold, a preset high-resolution Freeman chain code direction encoding is used; when the interval difference is not less than the preset second threshold, the suspected bent weld bead is treated as a local bent weld bead, and the resolution of the Freeman chain code cannot be determined at present.
7. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of obtaining the local constraint parallel lines of the main edge lines on both sides of the locally bent weld bead includes: Using a preset sliding window and preset sliding step size, slide on the locally curved weld bead to construct a local constraint parallel line of the main edge line within the sliding window for each slide.
8. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The step of determining the resolution of the Freeman chaincode based on the interval difference corresponding to the local constraint parallel lines includes: When the interval difference corresponding to the local constraint parallel line is less than a preset third threshold, the local main edge line corresponding to the local constraint parallel line adopts preset high-resolution Freeman chain code direction encoding; when the interval difference corresponding to the local constraint parallel line is not less than the preset third threshold, the local main edge line corresponding to the local constraint parallel line adopts preset low-resolution Freeman chain code direction encoding.
9. The online intelligent detection method for weld defects based on machine vision according to claim 1, characterized in that, The steps of extracting the bending features of all weld beads based on Freeman chain codes of different resolutions and detecting weld bend defects include: The segmented encoding of the entire weld centerline is obtained by using Freeman chain code. The directional change between adjacent chain codes is counted, and the area where the directional change exceeds the preset small fluctuation threshold is identified as the area of weld bending defect.