A method for detecting welding quality of welded pipe based on defect recognition

By calculating the pore edge characteristic value of the welded pipe welding area, combining the shape and grayscale distribution of the edge communication domain, and performing edge detection instead of the grayscale value, the problem of low edge detection accuracy of the grayscale image of welding welded pipe welding in the prior art is solved, and the problem of low edge detection of grayscale images is improved Accuracy of welding quality inspection of welded pipes.

CN118982538BInactive Publication Date: 2024-12-20NANTONG HENGQIANG ROLLER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411456892.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2024-12-20
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art has low accuracy in the edge segmentation of defects detected by the edge detection method, resulting in poor accuracy in welding quality detection of welding pipes.

Method used

By obtaining the edge pixel points of the welded area of ​​the welded pipe, calculating the edge characteristic value of the pore edge, combining the shape and grayscale distribution of the edge communication domain, edge detection is performed to divide the pore defect area, and instead of the traditional grayscale value for edge detection.

Benefits of technology

It improves the accuracy of the pore defect area, enhances the accuracy of welding quality detection of welded pipes, and reduces the appearance of false defect edges.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118982538B_ABST
    Figure CN118982538B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of optical defect detection, and in particular to a method for detecting the welding quality of a welded pipe based on defect recognition. The method first obtains welding edge pixel points according to the difference characteristics of a welded pipe welding area compared with a background area under optical detection conditions and the gradient regularity distribution of edge pixel points in a welded pipe welding grayscale image, and further calculates the pore edge feature value of each weld edge pixel point according to the edge shape characteristics and grayscale distribution characteristics of welded pipe welding pores; further, edge detection is performed based on the obtained pore edge feature value instead of the grayscale value, and a more accurate pore defect area is segmented, so that the accuracy of the welded pipe welding quality detection is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of optical defect detection, and in particular to a method for detecting the welding quality of a welded pipe based on defect recognition. Background Art

[0002] Welding is commonly used to connect metal parts and is widely used in industrial production, manufacturing, maintenance and other fields. Among them, pipe welding technology, as an important welding method, has high requirements for welding quality. When porosity defects appear on the welding surface, it will seriously affect the use of welded parts, so it is necessary to detect the welding quality of pipes. Considering that manual visual inspection methods are time-consuming, labor-intensive and error-prone to detect welding defects of pipes, automatic and efficient computer vision technology is usually used to analyze and detect optical inspection images of pipe welding.

[0003] The prior art usually detects the defect edges of the welded pipe grayscale image obtained based on optical detection through edge detection methods, segments the pore defect area, and performs welded pipe welding quality inspection based on the pore defect area. However, in a specific welded pipe welding scenario, the edge texture of the corresponding welded pipe welding area is relatively complex, and it is difficult to distinguish the edge textures of the pore defect, the welding point, and the background. As a result, when directly performing edge detection on the welded pipe grayscale image, a lot of false defect edges will appear, causing the image to segment out incorrect pore defects. That is, the prior art detects the defect edges of the welded pipe grayscale image through edge detection methods, and the accuracy of the segmented pore defect area is low, resulting in poor accuracy in the welded pipe welding quality inspection. Summary of the invention

[0004] In order to solve the technical problem that the defect edge detected by the edge detection method of the welded pipe grayscale image in the prior art and the segmented pore defect area have low accuracy, resulting in poor accuracy of the weld quality detection of the welded pipe, the purpose of the present invention is to provide a weld quality detection method for welded pipes based on defect recognition, and the technical scheme adopted is as follows:

[0005] The present invention proposes a method for detecting the welding quality of a welded pipe based on defect recognition, the method comprising:

[0006] Acquire the pipe welding grayscale image of the pipe welding area;

[0007] According to the gradient distribution of edge pixels in the welded pipe welding grayscale image, the welded edge pixels are obtained; the connected domain composed of the welded edge pixels is used as the edge connected domain; according to the similarity between the shape of the edge connected domain where each welded edge pixel is located and the shape of the welded pipe welding pores, as well as the grayscale distribution of the neighborhood, the pore edge feature value of each welded edge pixel is obtained;

[0008] Edge detection is performed according to the pore edge characteristic value to obtain the pore defect area; and welding quality detection of the welded pipe is performed according to the pore defect area.

[0009] Furthermore, the method for acquiring welding edge pixel points includes:

[0010] Obtain the grayscale gradient values ​​of all edge pixels in the welded pipe welding grayscale image; take the same grayscale gradient value as a grayscale gradient level; obtain the welding response degree of each grayscale gradient level according to the position distribution law of all edge pixels in each grayscale gradient level and the grayscale value change law;

[0011] Arrange all grayscale gradient levels in descending order according to the corresponding grayscale gradient values ​​to obtain a grayscale gradient level sequence; in the grayscale gradient level sequence, the difference between the welding response degree of each grayscale gradient level and the welding response degree of the corresponding next grayscale gradient level is used as the response decrease degree of each grayscale gradient level; the grayscale gradient level with a response decrease degree greater than a preset decrease threshold is used as a reference grayscale gradient level; all edge pixel points corresponding to the reference grayscale gradient level with the largest grayscale gradient value are used as welding edge pixel points.

[0012] Furthermore, the method for obtaining the pore edge characteristic value includes:

[0013] The circumscribed rectangle of each edge connected domain is used as a reference circumscribed rectangle; the perimeter of the maximum inscribed ellipse of the reference circumscribed rectangle is used as the standard shape feature value of each edge connected domain; the major axis of the maximum inscribed ellipse is the same as the long side length of the reference circumscribed rectangle, and the minor axis of the maximum inscribed ellipse is the same as the short side length of the reference circumscribed rectangle;

[0014] The difference between the area of ​​each edge connected domain and the standard shape characteristic value is used as the pore characteristic reference difference of each edge connected domain; the pore shape characteristic value of each edge connected domain is obtained according to the pore characteristic reference difference and the perimeter of the reference circumscribed rectangle, wherein the pore characteristic reference difference is positively correlated with the pore shape characteristic value, and the perimeter of the reference circumscribed rectangle is negatively correlated with the pore shape characteristic value;

[0015] In the welded pipe welding grayscale image, the variance of the grayscale values ​​of all pixels in a preset neighborhood window of each weld edge pixel is used as the pore grayscale feature value of each weld edge pixel;

[0016] According to the pore shape characteristic value and the pore gray characteristic value of the edge connected domain where each welding edge pixel point is located, the pore edge characteristic value of each welding edge pixel point is obtained, and the pore shape characteristic value and the pore gray characteristic value are both positively correlated with the pore edge characteristic value.

[0017] Furthermore, the method for obtaining the pore defect area includes:

[0018] The preset edge feature value is used as the pore edge feature value of other pixel points other than the welding edge pixel points in the welded pipe welding grayscale image, and the preset edge feature value is less than or equal to the pore edge feature value of all welding edge pixel points; edge detection is performed through the Canny algorithm according to the pore edge feature value of all pixel points in the welded pipe welding grayscale image to obtain the pore defect edge; and the connected domain surrounded by all pore defect edges is used as the pore defect area.

[0019] Furthermore, the method for detecting the welding quality of the welded pipe according to the porosity defect area includes:

[0020] When the cumulative sum of the number of pixels in all the pore defect areas in the welded pipe welding grayscale image is greater than the preset abnormal threshold, there is a quality problem in the welded pipe welding;

[0021] When the cumulative sum of the number of pixels in all the pore defect areas in the welded pipe welding grayscale image is less than or equal to the preset abnormal threshold, there is no quality problem in the welded pipe welding.

[0022] Furthermore, the method for obtaining the welding response degree includes:

[0023] Each grayscale gradient level is taken as the target grayscale gradient level in turn, and the maximum bounding rectangle corresponding to all edge pixels corresponding to the target grayscale gradient level is taken as the target bounding rectangle; all pixels in the target bounding rectangle are taken as reference pixels;

[0024] Traverse the target circumscribed rectangle through a straight line perpendicular to the long side of the target circumscribed rectangle to obtain all the long-axis traversal lines corresponding to the target grayscale gradient level; traverse the target circumscribed rectangle through a straight line perpendicular to the short side of the target circumscribed rectangle to obtain all the short-axis traversal lines corresponding to the target grayscale gradient level;

[0025] The grayscale values ​​of all reference pixel points on each long-axis traversal straight line are curve-fitted along the extension direction of the long-axis traversal straight line to obtain the long-axis grayscale change curve of each long-axis traversal straight line; the reference pixel points corresponding to the extreme points in the long-axis grayscale change curve are used as the long-axis extreme points of each long-axis traversal straight line; on the long-axis grayscale change curve, the grayscale difference between each long-axis extreme point and the next long-axis extreme point is used as the grayscale reference difference of each long-axis extreme point; the distance between each long-axis extreme point and the next long-axis extreme point on the corresponding long-axis traversal straight line is used as the reference distance of each long-axis extreme point; according to the grayscale reference difference of all long-axis extreme points on the long-axis traversal straight line and the reference distance of all long-axis extreme points, the local response degree of each long-axis traversal straight line is obtained;

[0026] According to the method for obtaining the local response degree of each long-axis traversal straight line, the local response degree of each short-axis traversal straight line is obtained;

[0027] The mean of the local response degrees of all the long-axis traversal lines corresponding to the target grayscale gradient level is taken as the long-axis response degree of the target grayscale gradient level; the mean of the local response degrees of all the short-axis traversal lines corresponding to the target grayscale gradient level is taken as the short-axis response degree;

[0028] A normalized value of a maximum value between the long-axis response degree and the short-axis response degree is used as a welding response degree of a target grayscale gradient level.

[0029] Furthermore, the method for obtaining the local response degree of each long-axis traversal line according to the grayscale reference difference of all long-axis extreme value points on the long-axis traversal line and the reference distance of all long-axis extreme value points includes:

[0030] The product of the negative correlation mapping value of the mean value of the grayscale reference difference of all the long axis extreme value points on each long axis traversal line and the negative correlation mapping value of the mean value of the reference distance of all the long axis extreme value points is taken as the local response degree of each long axis traversal line.

[0031] Furthermore, the method for obtaining the pore shape characteristic value includes:

[0032] The normalized value of the negative correlation mapping value of the ratio between the pore feature reference difference and the perimeter of the reference circumscribed rectangle is used as the pore shape feature value of each edge connected domain.

[0033] Furthermore, the method for obtaining the pore edge feature value of each welding edge pixel point according to the pore shape feature value of the edge connected domain where each welding edge pixel point is located and the pore grayscale feature value comprises:

[0034] The normalized value of the product of the pore shape characteristic value of the edge connected domain where each welding edge pixel point is located and the pore grayscale characteristic value is used as the pore edge characteristic value of each welding edge pixel point.

[0035] Furthermore, the preset edge feature value is set to 0.

[0036] The present invention has the following beneficial effects:

[0037] Since the edge texture corresponding to the welding area of ​​the welded pipe is relatively complex, it is impossible to obtain an accurate pore defect edge by performing edge detection based only on the grayscale value. Therefore, the present invention analyzes the features at the pore defect edge in the welded pipe welding grayscale image, and replaces the grayscale value with the calculated pore edge feature value used to characterize the possibility that the pixel point belongs to the pore defect edge pixel point for edge detection, so that the obtained pore defect area is more accurate. That is, the main purpose of the embodiment of the present invention is to analyze the possibility that each pixel point belongs to the pore defect edge pixel point, that is, to obtain the pore edge feature value. The pore defect edge must be located on the welded pipe welding area. Therefore, the present invention first calculates the welding edge pixel points belonging to the welded pipe welding area, and improves the calculation efficiency while excluding the influence of the texture edge of the background area, so that the subsequent pore defect area is more accurate. Pipe welding usually connects two sections of pipe, so the welding position usually appears as a narrow straight line, and the metal material in the welding area undergoes high-temperature melting, deep melting and rapid solidification processes. When the molten metal cools and solidifies rapidly, some small grains are formed. These grains are eventually combined into a crystalline structure in the welding area, and show a periodic arrangement and size distribution, forming a regular texture in the form of strips, that is, there is a periodicity in the grayscale gradient distribution, while the background area texture does not have this feature, and the grayscale gradient of the image area corresponding to the welding position is larger than that of the background area. Therefore, the present invention obtains welding edge pixel points according to the gradient regular distribution of edge pixel points in the grayscale image of pipe welding, that is, edge pixel points belonging to the welding area of ​​the pipe.

[0038] Further, based on the welding edge pixel points, according to the characteristics of the pore defect edge, the possibility of each welding edge pixel point belonging to the pore defect edge is obtained. The appearance characteristics of the pores are usually small circular or elliptical holes, so in the edge detection results of the welded pipe welding area, it is usually shown as a circular or elliptical edge connected domain, and due to the concave characteristics of the pore defect, the corresponding pore defect edge is shown in the image as a brighter edge and darker inside the pore, that is, the grayscale difference in the neighborhood range corresponding to the pixel points of the pore defect edge is large. Therefore, according to this feature, the present invention obtains the pore edge feature value of each welding edge pixel point according to the similarity between the edge connected domain shape of each welding edge pixel point and the shape of the welded pipe welding pore, and the neighborhood grayscale distribution, that is, the possibility of each welding edge pixel point belonging to the pore defect edge. Further, the pore edge feature value that characterizes the possibility of the pore defect edge pixel point is replaced by the grayscale value for edge detection, thereby segmenting a more accurate pore defect area, so that the accuracy of the welded pipe welding quality detection is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A flow chart of a method for detecting the welding quality of a welded pipe based on defect identification provided by an embodiment of the present invention;

[0041] Figure 2 A schematic diagram of periodic texture in a welding area of ​​a welded pipe provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a welded pipe welding quality detection method based on defect recognition proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0043] Unless defined otherwise, 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 belongs.

[0044] The specific scheme of the method for detecting the welding quality of welded pipes based on defect recognition provided by the present invention is described in detail below with reference to the accompanying drawings.

[0045] See also Figure 1 , which shows a flow chart of a method for detecting welding quality of a welded pipe based on defect identification provided by an embodiment of the present invention, the method comprising:

[0046] Step S1: Acquire a welded pipe grayscale image of a welded pipe welding area.

[0047] The embodiment of the present invention aims to provide a method for detecting the quality of welded pipe welding based on defect recognition, which is used to analyze the welded pipe welding grayscale image of the welded pipe welding area based on the edge segmentation method in computer vision, and segment the pore defect area, so that the accuracy of the welded pipe welding quality detection based on the pore defect area is higher. Therefore, it is necessary to first obtain the welded pipe welding grayscale image of the welded pipe welding area.

[0048] In the embodiment of the present invention, the welding area of ​​the welded pipe is photographed by an optical camera to obtain the welded pipe welding surface image. Since the grayscale value and grayscale gradient of the pixel point need to be combined for analysis later, the welded pipe welding image is grayed to obtain the welded pipe welding grayscale image required by the embodiment of the present invention. In the embodiment of the present invention, the optical camera adopts a high-precision industrial camera. It should be noted that, in addition to the high-precision industrial camera, the implementer can select the optical image acquisition device according to the specific implementation environment, which will not be further described here.

[0049] Step S2: according to the gradient regularity distribution of edge pixel points in the weld gray image of the welded pipe, the weld edge pixel points are obtained; the connected domain composed of the weld edge pixel points is used as the edge connected domain; according to the similarity between the shape of the edge connected domain where each weld edge pixel point is located and the shape of the weld pore of the welded pipe, as well as the gray distribution of the neighborhood, the pore edge feature value of each weld edge pixel point is obtained.

[0050] Since the edge texture corresponding to the welding area of ​​the welded pipe is relatively complex, it is impossible to obtain the accurate pore defect edge by performing edge detection based only on the grayscale value. Therefore, the present invention analyzes the features at the pore defect edge in the welded pipe welding grayscale image, and performs edge detection by replacing the grayscale value with the calculated pore edge feature value used to characterize the possibility that the pixel point belongs to the pore defect edge pixel point, so that the obtained pore defect area is more accurate. That is, the main purpose of the embodiment of the present invention is to analyze the possibility that each pixel point belongs to the pore defect edge pixel point.

[0051] The edge of the pore defect must be located on the welding area of ​​the welded pipe, so the present invention first calculates the welding edge pixel points belonging to the welding area of ​​the welded pipe, and improves the calculation efficiency while excluding the influence of the texture edge of the background area, so that the subsequently obtained pore defect area is more accurate. The welding of the welded pipe usually connects two sections of pipes, so the welding position usually appears as a relatively narrow straight line, and the metal material in the welding area undergoes high-temperature melting, deep melting and rapid solidification processes. When the molten metal cools and solidifies rapidly, some small grains will be formed. These grains are finally combined into the crystalline structure of the welding area, and show a periodic arrangement and size distribution, forming a regular texture in the form of strips, while the texture of the background area does not have this feature, and the grayscale gradient of the image area corresponding to the welding position is larger than that of the background area. Therefore, the embodiment of the present invention obtains the welding edge pixel points according to the gradient regular distribution of the edge pixel points in the grayscale image of the welded pipe.

[0052] Preferably, the method for acquiring welding edge pixel points includes:

[0053] Obtain the grayscale gradient values ​​of all edge pixels in the grayscale image of welded pipe welding; take the same grayscale gradient value as a grayscale gradient level; obtain the welding response degree of each grayscale gradient level according to the position distribution law of all edge pixels in each grayscale gradient level and the grayscale value change law. In an embodiment of the present invention, all edge pixels are obtained by using the canny edge detection algorithm according to the grayscale values ​​of the pixels in the grayscale image of welded pipe welding. It should be noted that the canny edge detection algorithm is a prior art well known to those skilled in the art, and is not further defined or elaborated herein. Considering that there are grayscale gradient values ​​of different sizes in all edge pixels of the grayscale image of welded pipe welding, although the grayscale gradient value of the welded pipe welding area is larger than that of the background area, determining the welded pipe welding area only according to the grayscale gradient size may result in the obtained welded pipe welding area being inaccurate, so the welded pipe welding area is further obtained by calculating the welding response degree of each grayscale gradient level. As for the welding response degree, it can characterize the periodic regularity of the welding area to a certain extent. Although the welding area of ​​the welded pipe cannot be directly determined based on the welding response degree, the grayscale gradient value of the welded pipe welding area is larger than that of the background area, and there is no periodic regularity corresponding to welding in the background area. It can be further based on the changes in the welding response degree between different grayscale gradient levels to obtain the required welded pipe welding area. Therefore, it is necessary to first calculate the welding response degree of each grayscale gradient level.

[0054] Preferably, the method for obtaining the welding response degree includes:

[0055] Each grayscale gradient level is taken as the target grayscale gradient level in turn, and the maximum bounding rectangle corresponding to all edge pixels corresponding to the target grayscale gradient level is taken as the target bounding rectangle; all pixels in the target bounding rectangle are taken as reference pixels. Since the welding area is a relatively narrow straight line and a rectangle as a whole, the maximum bounding rectangle corresponding to the grayscale gradient level corresponding to the welding area usually includes the welding area of ​​the welding pipe, and the texture of the welding area of ​​the welding pipe will show the periodicity of the grayscale gradient distribution. Further analysis is performed in the target bounding rectangle based on this feature.

[0056] Since the welding direction cannot be determined, that is, the direction of the grain arrangement obtained by welding cannot be determined, but it can be determined that the welding direction is always along the welding pipe, so for the target circumscribed rectangle of the welding pixel points of the welding pipe, the arrangement pattern presented after welding can only be in the long axis direction and the short axis direction, that is, the long side direction and the short side direction. Therefore, the embodiment of the present invention analyzes the long axis and short axis directions of the target circumscribed rectangle respectively. By traversing the target circumscribed rectangle with a straight line perpendicular to the long side of the target circumscribed rectangle, all the long axis traversal lines corresponding to the target grayscale gradient level are obtained; by traversing the target circumscribed rectangle with a straight line perpendicular to the short side of the target circumscribed rectangle, all the short axis traversal lines corresponding to the target grayscale gradient level are obtained.

[0057] First, analyze the long axis traversal line: curve fit the grayscale values ​​of all reference pixels on each long axis traversal line along the extension direction of the long axis traversal line to obtain the long axis grayscale change curve of each long axis traversal line. Since the welding direction cannot be determined, the analysis is first performed in the long axis direction. If the welding direction is along the long axis direction, the grains corresponding to the crystal structure of the welding area formed during the welding process will show a periodic arrangement and size distribution of periodic textures. Please refer to Figure 2 , which shows a schematic diagram of periodic texture of a welding area of ​​a welded pipe provided by an embodiment of the present invention. The welding area in the figure presents regular texture changes in strips. These regular textures will cause the grayscale gradient of the pixel points in the welding direction to show regular fluctuations. Therefore, when the target circumscribed rectangle corresponds to the welding area and the welding direction is the same as the long axis direction, due to the existence of periodic regular textures, the pixels with higher brightness will appear periodically on the long axis grayscale change curve, that is, the corresponding extreme points in the grayscale change curve. Therefore, the extreme points on the long axis change curve are first obtained, and the reference pixel points corresponding to the extreme points in the long axis grayscale change curve are used as the long axis extreme points of each long axis traversal line.

[0058] Since the welding area presents a regular strip-shaped texture, the distance between adjacent long-axis extreme points usually presents regularity, and the grayscale value difference between adjacent extreme points is usually small. According to this feature, in an embodiment of the present invention, on the long-axis grayscale change curve, the grayscale difference between each long-axis extreme point and the next long-axis extreme point is used as the grayscale reference difference of each long-axis extreme point; the distance between each long-axis extreme point and the next long-axis extreme point on the corresponding long-axis traversal line is used as the reference distance of each long-axis extreme point; the smaller the corresponding grayscale reference difference is as a whole, the smaller the reference distance is as a whole, indicating that the grayscales between adjacent extreme points are more similar, and the intervals are more regular, that is, the more consistent with the characteristics of the periodic regular texture of the welding area, so the reference distance and the grayscale reference difference are further combined, and the local response degree of each long-axis traversal line is obtained according to the grayscale reference difference of all long-axis extreme points on the long-axis traversal line and the reference distance of all long-axis extreme points. The larger the corresponding local response degree is, the more consistent with the characteristics of the periodic regular texture of the welding area. It should be noted that, considering that the last long-axis extreme point has no corresponding next long-axis extreme point, in order to ensure the integrity of the calculation, the mean of the reference distances of all long-axis extreme points before the last long-axis extreme point is used as the reference distance of the last long-axis extreme point; the mean of the grayscale reference differences of all long-axis extreme points before the last long-axis extreme point is used as the reference grayscale difference of the last long-axis extreme point.

[0059] Preferably, the method for obtaining the local response degree of each long-axis traversal line according to the grayscale reference difference of all long-axis extreme value points on the long-axis traversal line and the reference distance of all long-axis extreme value points includes:

[0060] According to the relationship between the grayscale reference difference, the reference distance, the local response degree and the conforming characteristics of the periodic regular texture of the welding area, the embodiment of the present invention uses the product of the negative correlation mapping value of the mean of the grayscale reference difference of all the long-axis extreme value points on each long-axis traversal line and the negative correlation mapping value of the mean of the reference distance of all the long-axis extreme value points as the local response degree of each long-axis traversal line. In the embodiment of the present invention, the negative correlation mapping method of the mean of the grayscale reference difference of all the long-axis extreme value points and the negative correlation mapping method of the mean of the reference distance both use the reciprocal. The implementer can also perform negative correlation mapping by sampling other methods other than the reciprocal according to the specific implementation environment, such as using an exponential function with a natural constant as the base, which will not be further elaborated here.

[0061] In the embodiment of the present invention, in the target circumscribed rectangle corresponding to the target grayscale gradient level, each long axis traversal straight line is sequentially used as the first The major axis traverses the straight line, then The method for obtaining the local response degree of the long axis traversal line is expressed in the formula as follows:

[0062]

[0063] Among them, in the target circumscribed rectangle corresponding to the target grayscale gradient level, For the The local response degree of the long axis traversal line, For the The number of reference pixels on the long axis traversal line, For the The major axis traversal line The reference distance of pixels; For the The major axis traversal line The grayscale reference difference of each pixel.

[0064] The method for obtaining the local response degree of the short-axis traversal line and the local response degree of the long-axis traversal line is only different in direction, so the embodiment of the present invention obtains the local response degree of each short-axis traversal line according to the method for obtaining the local response degree of each long-axis traversal line. Specifically:

[0065] The grayscale values ​​of all reference pixel points on each short-axis traversal line are curve-fitted along the extension direction of the short-axis traversal line to obtain the short-axis grayscale change curve of each long-axis traversal line; the reference pixel points corresponding to the extreme points in the short-axis grayscale change curve are used as the short-axis extreme points of each short-axis traversal line; on the short-axis grayscale change curve, the grayscale difference between each short-axis extreme point and the next short-axis extreme point is used as the grayscale reference difference of each short-axis extreme point; the distance between each short-axis extreme point and the next short-axis extreme point on the corresponding short-axis traversal line is used as the reference distance of each short-axis extreme point; according to the grayscale reference difference of all short-axis extreme points on the short-axis traversal line and the reference distance of all short-axis extreme points, the local response degree of each short-axis traversal line is obtained.

[0066] In the embodiment of the present invention, in the target circumscribed rectangle corresponding to the target grayscale gradient level, each short axis traversal straight line is sequentially used as the first The minor axis traverses the straight line, then The method for obtaining the local response degree of the short axis traversal line is expressed in the formula as follows:

[0067]

[0068] Among them, in the target circumscribed rectangle corresponding to the target grayscale gradient level, For the The local response degree of the minor axis traversal line, For the The number of reference pixels on the short axis traversal line, For the The minor axis traverses the straight line The reference distance of pixels, For the The minor axis traverses the straight line Since the method for obtaining the local response degree of the short-axis traversal line is the same as the method for obtaining the local response degree of the long-axis traversal line, its significance will not be further described.

[0069] Since there are multiple long-axis traversal lines and short-axis traversal lines in the target circumscribed rectangle, in order to calculate the overall response degrees in the long-axis direction and the short-axis direction respectively, the embodiment of the present invention uses the mean of the local response degrees of all long-axis traversal lines corresponding to the target grayscale gradient level as the long-axis response degree of the target grayscale gradient level; and uses the mean of the local response degrees of all short-axis traversal lines corresponding to the target grayscale gradient level as the short-axis response degree. The larger the corresponding long-axis response degree, the more it conforms to the characteristics of the periodic regular texture of the welding area in the long side direction of the target circumscribed rectangle; the larger the corresponding short-axis response degree, the more it conforms to the characteristics of the periodic regular texture of the welding area in the short side direction of the target circumscribed rectangle.

[0070] When the target circumscribed rectangle corresponding to the target grayscale gradient level is a welding area, since the arrangement pattern presented after welding is only possible in the major axis direction and minor axis direction of the target circumscribed rectangle corresponding to the welding area, that is, the long side direction and the short side direction, the embodiment of the present invention normalizes the maximum value of the major axis response degree and the minor axis response degree as the welding response degree of the target grayscale gradient level.

[0071] In the embodiment of the present invention, the target grayscale gradient level The method for obtaining the welding response degree is expressed in the formula:

[0072]

[0073] in, is the target grayscale gradient level The welding response degree, is the target grayscale gradient level The number of major axis traversal lines in the target circumscribed rectangle; is the target grayscale gradient level The target bounding rectangle of The local response degree of the long axis traversal line; is the target grayscale gradient level The number of minor axis traversal lines in the target circumscribed rectangle; is the target grayscale gradient level The target bounding rectangle of The local response degree of the minor axis traversal line; Select function for maximum value; is a normalization function. The normalization methods in the embodiments of the present invention all adopt linear normalization. The implementer may also select other normalization methods according to the specific implementation environment, which will not be further elaborated here.

[0074] As for the welding response degree, it can characterize the periodic regularity of the welding area to a certain extent. However, if it is directly selected according to the size of the welding response degree, certain accidental characteristics may appear, resulting in the final welding area selection being inaccurate. Therefore, the embodiment of the present invention takes into account that the grayscale gradient value of the welding area of ​​the welding pipe is larger than that of the background area, and there is no periodic regularity corresponding to welding in the background area. The welding response degree is calculated starting from the grayscale gradient level with the largest grayscale gradient value. Since the grayscale level similarity corresponding to the welding area is relatively high, when the grayscale gradient level in the calculation process involves more background areas, the corresponding welding response degree will show a significant decrease. Therefore, if the grayscale gradient level that first shows a significant decrease is used as the grayscale gradient level of the welding edge pixel point, the welding area of ​​the welding pipe can be accurately obtained.

[0075] According to this feature, the embodiment of the present invention arranges all grayscale gradient levels in order from large to small in terms of the corresponding grayscale gradient values ​​to obtain a grayscale gradient level sequence; in the grayscale gradient level sequence, the difference between the welding response degree of each grayscale gradient level and the welding response degree of the corresponding next grayscale gradient level is used as the response drop degree of each grayscale gradient level; the grayscale gradient level with a response drop degree greater than a preset drop threshold is used as a reference grayscale gradient level; all edge pixel points corresponding to the reference grayscale gradient level with the largest grayscale gradient value are used as welding edge pixel points. In the embodiment of the present invention, the preset drop threshold is set to 0.15, and the implementer can adjust the size of the preset drop threshold according to the specific implementation environment, which will not be further elaborated here.

[0076] Further according to the purpose of the embodiment of the present invention, based on the welding edge pixel points, according to the characteristics of the pore defect edge, the possibility of each welding edge pixel point belonging to the pore defect edge is obtained. The appearance characteristics of the pores are usually small circular or elliptical holes, so in the edge detection results of the welding area of ​​the welded pipe, it is usually shown as a circular or elliptical edge connected domain, and due to the concave characteristics of the pore defect, the corresponding pore defect edge is shown in the image as a brighter edge and darker inside the pore, that is, the grayscale difference in the neighborhood range corresponding to the pixel points of the pore defect edge is large, so according to this feature, the present invention first uses the connected domain composed of the welding edge pixel points as the edge connected domain for subsequent comparison of the shape of the pores of the welded pipe; further, according to the similarity between the shape of the edge connected domain where each welding edge pixel point is located and the shape of the pores of the welded pipe, and the grayscale distribution of the neighborhood, the pore edge feature value of each welding edge pixel point is obtained, that is, the possibility of each welding edge pixel point belonging to the pore defect edge.

[0077] Preferably, the method for obtaining the pore edge characteristic value includes:

[0078] The circumscribed rectangle of each edge connected domain is used as the reference circumscribed rectangle; the perimeter of the maximum inscribed ellipse of the reference circumscribed rectangle is used as the standard shape eigenvalue of each edge connected domain; the major axis of the maximum inscribed ellipse is the same as the long side length of the reference circumscribed rectangle, and the minor axis of the maximum inscribed ellipse is the same as the short side length of the reference circumscribed rectangle. The difference between the area of ​​each edge connected domain and the standard shape eigenvalue is used as the pore feature reference difference of each edge connected domain; for edge connected domains, since edge connected domains are composed of edge pixels, the area of ​​the corresponding edge connected domain is approximately equal to the perimeter, so the standard shape eigenvalue representing the perimeter of the maximum inscribed ellipse of the reference circumscribed rectangle is subtracted from the area of ​​the edge connected domain to represent the deviation of each edge connected domain from the ellipse corresponding to the ideal state of the pore. The larger the corresponding deviation, that is, the larger the pore feature reference difference, the larger the edge difference between the edge connected domain and the pore shape, the more likely the pixel point of the corresponding edge connected domain is not the edge of the pore defect connected domain, and the smaller the corresponding pore shape eigenvalue.

[0079] According to the pore feature reference difference and the perimeter of the reference circumscribed rectangle, the pore shape characteristic value of each edge connected domain is obtained, the pore feature reference difference is positively correlated with the pore shape characteristic value, and the perimeter of the reference circumscribed rectangle is negatively correlated with the pore shape characteristic value. Preferably, the method for obtaining the pore shape characteristic value includes:

[0080] The normalized value of the negative correlation mapping value of the ratio between the pore feature reference difference and the perimeter of the reference circumscribed rectangle is used as the pore shape characteristic value of each edge connected domain. Since the size of the pores may be different, the corresponding areas of different edge connected domains are different. Therefore, in order to avoid the difference in the dimensions of the calculated pore shape characteristic values ​​caused by pores of different sizes, the value of the pore feature reference difference is restricted by the perimeter of the corresponding reference circumscribed rectangle as the denominator, so that the obtained pore shape characteristic value is more accurate. The negative correlation mapping is because the larger the pore feature reference difference, the greater the shape difference between the corresponding edge connected domain and the pore defect edge, the less the corresponding welding edge pixel point conforms to the characteristics of the pore defect edge pixel point, and the smaller the corresponding pore shape characteristic value.

[0081] Due to the concave characteristics of the pore defect, the corresponding pore defect edge appears in the image as a brighter edge and darker inside the pore, that is, the grayscale difference in the neighborhood range corresponding to the pixel point of the pore defect edge is large. Therefore, in the welded grayscale image of the welded pipe, the variance of the grayscale values ​​of all pixels in the preset neighborhood window of each welding edge pixel point is used as the pore grayscale feature value of each welding edge pixel point. The larger the variance of the grayscale values ​​of all pixels in the corresponding preset neighborhood window, the greater the grayscale difference in the neighborhood range corresponding to the welding edge pixel point, and the more it conforms to the characteristics of the pore defect area, that is, the larger the pore grayscale feature value. In the embodiment of the present invention, the preset neighborhood window is set to 5×5, and the implementer can also use windows of other sizes according to the specific implementation environment, such as 7×7, 9×9, etc., which will not be further elaborated here.

[0082] The pore shape feature value is further combined with the pore grayscale feature value to obtain the pore edge feature value required by the embodiment of the present invention to characterize the possibility of the edge belonging to the pore defect. The embodiment of the present invention obtains the pore edge feature value of each welding edge pixel point according to the pore shape feature value and the pore grayscale feature value of the edge connected domain where each welding edge pixel point is located, and the pore shape feature value and the pore grayscale feature value are both positively correlated with the pore edge feature value.

[0083] Preferably, the method of obtaining the pore edge feature value of each welding edge pixel point according to the pore shape feature value and the pore grayscale feature value of the edge connected domain where each welding edge pixel point is located comprises:

[0084] Since the larger the pore shape eigenvalue and the larger the pore grayscale eigenvalue, the greater the possibility that the corresponding pixel point belongs to the edge of a pore defect, the embodiment of the present invention uses the normalized value of the product of the pore shape eigenvalue and the pore grayscale eigenvalue of the edge connected domain where each welding edge pixel point is located as the pore edge eigenvalue of each welding edge pixel point.

[0085] In the embodiment of the present invention, each welding edge pixel point is sequentially used as the first welding edge pixels, then The method for obtaining the pore edge feature value of each welding edge pixel point is expressed in the formula as follows:

[0086]

[0087] in, For the The pore edge feature value of the welding edge pixel point, For the The area of ​​the edge connected domain where the welding edge pixel points are located, For the The standard shape feature value of the edge connected domain where the welding edge pixel points are located; For the The perimeter of the reference circumscribed rectangle of the edge connected domain where the welding edge pixel points are located; For the The grayscale characteristic value of the pores at the welding edge pixel point, that is, The variance of the grayscale values ​​of all pixels in the preset neighborhood window of the welding edge pixel; For the The pore shape characteristic value of the edge connected domain where the welding edge pixel point is located. is the absolute value symbol, is an exponential function with a natural constant as base, It should be noted that, in addition to the product, the implementer may also obtain the pore edge feature value according to the pore shape feature value and the pore gray feature value by other methods other than the product, such as normalizing after addition, etc., which will not be further elaborated here.

[0088] Step S3: performing edge detection according to the pore edge feature value to obtain the pore defect area; and performing welding quality detection of the welded pipe according to the pore defect area.

[0089] According to the purpose of the embodiment of the present invention, it is further necessary to replace the gray value with the calculated pore edge feature value used to characterize the possibility that the pixel point belongs to the pore defect edge pixel point for edge detection, so that the obtained pore defect area is more accurate. Therefore, the embodiment of the present invention performs edge detection based on the pore edge feature value to obtain the pore defect area.

[0090] Preferably, the method for obtaining the pore defect area includes:

[0091] The preset edge feature value is used as the pore edge feature value of other pixel points other than the welding edge pixel points in the welded pipe welding grayscale image, and the preset edge feature value is less than or equal to the pore edge feature value of all welding edge pixel points; preferably, the preset edge feature value is set to 0. Since the pore edge feature value represents the possibility that the pixel point belongs to the pore defect edge pixel point, and the pixel points other than the welding edge pixel points do not have the possibility of belonging to the pore defect edge pixel point, and for the integrity of the edge detection process, the pore edge feature value of other pixel points other than the welding edge pixel points in the welded pipe welding grayscale image is set to 0, and the implementer can also adjust the preset edge feature value according to the specific implementation environment.

[0092] Further, according to the pore edge feature values ​​of all pixels in the welded gray image of the welded pipe, edge detection is performed using the Canny algorithm to obtain the pore defect edge; the connected domain surrounded by all pore defect edges is used as the pore defect area. Based on the traditional Canny algorithm, the gray value of each pixel is replaced with the corresponding pore edge feature value to perform Canny edge detection, and the pore defect edge required by the embodiment of the present invention and the pore defect area corresponding to the pore defect edge can be obtained. It should be noted that the Canny algorithm is a prior art well known to those skilled in the art and will not be further defined or elaborated herein.

[0093] Finally, the welding quality of the welded pipe is inspected according to the pore defect area. Preferably, the method for inspecting the welding quality of the welded pipe according to the pore defect area includes:

[0094] When the cumulative sum of the number of pixels in all pore defect areas in the grayscale image of the welded pipe is greater than the preset abnormal threshold, there is a quality problem in the welded pipe welding; when the cumulative sum of the number of pixels in all pore defect areas in the grayscale image of the welded pipe is less than or equal to the preset abnormal threshold, there is no quality problem in the welded pipe welding. In the embodiment of the present invention, the preset abnormal threshold is set to 20, and the cumulative sum of the number of pixels in all pore defect areas represents the total area of ​​the pore defect areas in the welded pipe welding image. The larger the total area of ​​the corresponding pore defect areas, the more abnormal it is. The implementer can also adjust the size of the preset abnormal threshold according to the specific implementation environment, which will not be further elaborated here.

[0095] In summary, the present invention first obtains welding edge pixels according to the distinguishing characteristics of the welding area of ​​the welded pipe compared to the background area and the gradient regular distribution of edge pixels in the welded pipe welding grayscale image, and further calculates the pore edge feature value of each welding edge pixel according to the edge shape characteristics and grayscale distribution characteristics of the welded pipe welding pores; further, the obtained pore edge feature value is used instead of the grayscale value to perform edge detection, and a more accurate pore defect area is segmented, so that the accuracy of the welded pipe welding quality detection is higher.

[0096] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0097] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A method for detecting the welding quality of welded pipes based on defect recognition. It is characterized in that The method comprises: Acquire the pipe welding grayscale image of the pipe welding area; According to the gradient distribution of edge pixels in the welded pipe welding grayscale image, the welded edge pixels are obtained; the connected domain composed of the welded edge pixels is used as the edge connected domain; according to the similarity between the shape of the edge connected domain where each welded edge pixel is located and the shape of the welded pipe welding pores, as well as the grayscale distribution of the neighborhood, the pore edge feature value of each welded edge pixel is obtained; Perform edge detection according to the pore edge feature value to obtain a pore defect area; perform welding quality detection of the welded pipe according to the pore defect area; The method for obtaining the pore edge characteristic value comprises: The circumscribed rectangle of each edge connected domain is used as a reference circumscribed rectangle; the perimeter of the maximum inscribed ellipse of the reference circumscribed rectangle is used as the standard shape feature value of each edge connected domain; the major axis of the maximum inscribed ellipse is the same as the long side length of the reference circumscribed rectangle, and the minor axis of the maximum inscribed ellipse is the same as the short side length of the reference circumscribed rectangle; The difference between the area of ​​each edge connected domain and the standard shape characteristic value is used as the pore characteristic reference difference of each edge connected domain; the pore shape characteristic value of each edge connected domain is obtained according to the pore characteristic reference difference and the perimeter of the reference circumscribed rectangle, wherein the pore characteristic reference difference is positively correlated with the pore shape characteristic value, and the perimeter of the reference circumscribed rectangle is negatively correlated with the pore shape characteristic value; In the welded pipe welding grayscale image, the variance of the grayscale values ​​of all pixels in a preset neighborhood window of each weld edge pixel is used as the pore grayscale feature value of each weld edge pixel; According to the pore shape characteristic value and the pore gray characteristic value of the edge connected domain where each welding edge pixel point is located, the pore edge characteristic value of each welding edge pixel point is obtained, and the pore shape characteristic value and the pore gray characteristic value are both positively correlated with the pore edge characteristic value; The method for obtaining the pore defect area comprises: The preset edge feature value is used as the pore edge feature value of other pixel points other than the welding edge pixel points in the welded pipe welding grayscale image, and the preset edge feature value is less than or equal to the pore edge feature value of all welding edge pixel points; edge detection is performed through the Canny algorithm according to the pore edge feature value of all pixel points in the welded pipe welding grayscale image to obtain the pore defect edge; and the connected domain surrounded by all pore defect edges is used as the pore defect area.

2. A method for detecting the welding quality of welded pipes based on defect recognition according to claim 1, It is characterized in that The method for obtaining the welding edge pixel points comprises: Obtain the grayscale gradient values ​​of all edge pixels in the welded pipe welding grayscale image; take the same grayscale gradient value as a grayscale gradient level; obtain the welding response degree of each grayscale gradient level according to the position distribution law of all edge pixels in each grayscale gradient level and the grayscale value change law; Arrange all grayscale gradient levels in descending order of corresponding grayscale gradient values ​​to obtain a grayscale gradient level sequence; in the grayscale gradient level sequence, take the difference between the welding response degree of each grayscale gradient level and the welding response degree of the corresponding next grayscale gradient level as the response decrease degree of each grayscale gradient level; take the grayscale gradient level with a response decrease degree greater than a preset decrease threshold as the reference grayscale gradient level; take all edge pixel points corresponding to the reference grayscale gradient level with the largest grayscale gradient value as welding edge pixel points; The method for obtaining the welding response degree includes: Each grayscale gradient level is taken as the target grayscale gradient level in turn, and the maximum bounding rectangle corresponding to all edge pixels corresponding to the target grayscale gradient level is taken as the target bounding rectangle; all pixels in the target bounding rectangle are taken as reference pixels; Traverse the target circumscribed rectangle through a straight line perpendicular to the long side of the target circumscribed rectangle to obtain all the long-axis traversal lines corresponding to the target grayscale gradient level; traverse the target circumscribed rectangle through a straight line perpendicular to the short side of the target circumscribed rectangle to obtain all the short-axis traversal lines corresponding to the target grayscale gradient level; The grayscale values ​​of all reference pixel points on each long-axis traversal straight line are curve-fitted along the extension direction of the long-axis traversal straight line to obtain the long-axis grayscale change curve of each long-axis traversal straight line; the reference pixel points corresponding to the extreme points in the long-axis grayscale change curve are used as the long-axis extreme points of each long-axis traversal straight line; on the long-axis grayscale change curve, the grayscale difference between each long-axis extreme point and the next long-axis extreme point is used as the grayscale reference difference of each long-axis extreme point; the distance between each long-axis extreme point and the next long-axis extreme point on the corresponding long-axis traversal straight line is used as the reference distance of each long-axis extreme point; according to the grayscale reference difference of all long-axis extreme points on the long-axis traversal straight line and the reference distance of all long-axis extreme points, the local response degree of each long-axis traversal straight line is obtained; According to the method for obtaining the local response degree of each long-axis traversal straight line, the local response degree of each short-axis traversal straight line is obtained; The mean of the local response degrees of all the long-axis traversal lines corresponding to the target grayscale gradient level is taken as the long-axis response degree of the target grayscale gradient level; the mean of the local response degrees of all the short-axis traversal lines corresponding to the target grayscale gradient level is taken as the short-axis response degree; A normalized value of a maximum value between the long-axis response degree and the short-axis response degree is used as a welding response degree of a target grayscale gradient level.

3. A method for detecting the welding quality of welded pipes based on defect recognition according to claim 1, It is characterized in that The method for detecting the welding quality of the welded pipe according to the pore defect area comprises: When the cumulative sum of the number of pixels in all the pore defect areas in the welded pipe welding grayscale image is greater than the preset abnormal threshold, there is a quality problem in the welded pipe welding; When the cumulative sum of the number of pixels in all the pore defect areas in the welded pipe welding grayscale image is less than or equal to the preset abnormal threshold, there is no quality problem in the welded pipe welding.

4. A method for detecting the welding quality of welded pipes based on defect recognition according to claim 2, It is characterized in that The method for obtaining the local response degree of each long-axis traversal line according to the grayscale reference difference of all long-axis extreme value points on the long-axis traversal line and the reference distance of all long-axis extreme value points includes: The product of the negative correlation mapping value of the mean value of the grayscale reference difference of all the long axis extreme value points on each long axis traversal line and the negative correlation mapping value of the mean value of the reference distance of all the long axis extreme value points is taken as the local response degree of each long axis traversal line.

5. A method for detecting the welding quality of welded pipes based on defect recognition according to claim 1, It is characterized in that The method for obtaining the pore shape characteristic value comprises: The normalized value of the negative correlation mapping value of the ratio between the pore feature reference difference and the perimeter of the reference circumscribed rectangle is used as the pore shape feature value of each edge connected domain.

6. A method for detecting the welding quality of welded pipes based on defect recognition according to claim 1, It is characterized in that The method for obtaining the pore edge feature value of each welding edge pixel point according to the pore shape feature value of the edge connected domain where each welding edge pixel point is located and the pore grayscale feature value comprises: The normalized value of the product of the pore shape characteristic value of the edge connected domain where each welding edge pixel point is located and the pore grayscale characteristic value is used as the pore edge characteristic value of each welding edge pixel point.

7. A method for detecting welding quality of welded pipes based on defect recognition according to claim 1, It is characterized in that The preset edge feature value is set to 0.