Method, processor and storage medium for locating the center line of a girth weld
Through pseudo-color image processing and vertical projection technology, the problems of metal interference and defect intermittent in the centerline positioning of the ring weld are solved, and more accurate and high-precision positioning is achieved, which is suitable for complex ring weld images.
Patent Information
- Application Number
- CN202111550257.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-12-17
AI Technical Summary
The prior art is difficult to overcome metal interference, intermittent effects caused by ring weld defects and image gain effects when positioning the center line of the ring weld, resulting in inaccurate positioning.
By obtaining a pseudo-color image of the magnetic leakage detection signal image in the local area of the ring weld, the color probability to which the pixel belongs is determined based on the color tone and saturation of the pixel, and the pixel belongs to the target color. Then, the foreground image is extracted based on the first color and the second color, and a vertical projection is performed to count the sum of brightness values of each column of pixels, and the position of the centerline of the ring weld is determined.
Overcome metal interference, ring weld defects and image gain influences, ensure the accuracy of the centerline positioning of the ring weld, improve positioning accuracy, and is suitable for ring weld images with varying wall thickness, defects and intermittent signal images. .
Smart Images

Figure CN114219932B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of image processing, and in particular to a method, a processor and a storage medium for locating a center line of a girth weld. Background Art
[0002] Magnetic flux leakage detection refers to the formation of a leakage magnetic field on the surface of a ferromagnetic material due to defects on the surface or near the surface of the test piece after the material is magnetized. People can detect the changes in the leakage magnetic field and then find defects. The leakage magnetic field means that when there are defects in the material that cut the magnetic lines of force, the defects on the surface of the material or the changes in the tissue state will cause the magnetic permeability to change. Since the magnetic permeability of the defect is very small and the magnetic resistance is very large, the magnetic flux in the magnetic circuit will be distorted, and the direction of the magnetic induction line will change. In addition to some magnetic flux directly passing through the defect or the inside of the material to bypass the defect, some magnetic flux will leak to the air above the surface of the material, bypass the defect through the air and then enter the material, thus forming a leakage magnetic field on the surface of the material.
[0003] At present, magnetic flux leakage internal detection technology has been widely used in the field of oil and gas pipeline inspection. Using magnetic flux leakage signal images to analyze pipeline defects is one of the important ways to realize big data mining of pipeline internal detection. Locating the centerline of the girth weld in the magnetic flux leakage image is a key step in the subsequent detection, analysis and positioning of girth weld defects, patch failure images and spiral weld intersections. Summary of the invention
[0004] In order to overcome the deficiencies in the prior art, embodiments of the present invention provide a method, a processor, and a storage medium for locating a centerline of a girth weld.
[0005] In order to achieve the above object, the first aspect of the present invention provides a method for locating the center line of a girth weld, comprising:
[0006] Acquire a pseudo-color image of the magnetic flux leakage internal detection signal image of the local area of the girth weld;
[0007] Determine the probability of pixels belonging to various colors based on the hue and saturation of the pixels in the pseudo-color image;
[0008] Assign pixels to the target color based on probability;
[0009] extracting a first foreground image from the pseudo color image based on the first color and the second color;
[0010] Performing vertical projection on the first foreground image to obtain a first projection curve, where the first projection curve is used to count the sum of brightness values of each column of pixels in the first foreground image;
[0011] The position of the center line of the girth weld is determined according to the first horizontal coordinate corresponding to the peak value of the first projection curve.
[0012] In the embodiment of the present invention, the target colors include: blue, cyan, green, red and yellow, the first color includes blue, and the second color includes cyan.
[0013] In an embodiment of the present invention, determining the position of the centerline of the girth weld according to the first horizontal coordinate corresponding to the peak value of the first projection curve includes:
[0014] Scanning the first projection curve from a first direction to determine a first position on the first projection curve that is higher than a first threshold,
[0015] Mark the horizontal coordinate of the first position as the leftmost coordinate of the girth weld;
[0016] Scanning the first projection curve from a second direction to determine a first second position on the first projection curve that is higher than a first threshold;
[0017] determining the horizontal coordinate of the second position as the rightmost coordinate of the girth weld;
[0018] The average of the leftmost and rightmost coordinates is determined as the location of the girth weld centerline.
[0019] In an embodiment of the present invention, the method further includes:
[0020] Obtaining a grayscale image of a magnetic flux leakage internal detection signal image;
[0021] Binarizing the grayscale image based on the second threshold to obtain a high-brightness foreground image;
[0022] Binarizing the grayscale image based on a third threshold to obtain a low-brightness foreground image, wherein the third threshold is less than the second threshold;
[0023] According to the gradient value of the pixel in the grayscale image, the right horizontal gradient foreground image is obtained;
[0024] Performing an OR operation on the high brightness foreground image, the low brightness foreground image, and the right horizontal gradient foreground image to achieve superposition fusion and obtain a fused image;
[0025] Perform vertical projection on the fusion graph to obtain a second projection curve;
[0026] Determine a second horizontal coordinate corresponding to the peak value of the second projection curve;
[0027] The position of the center line of the girth weld is determined according to the average value of the first horizontal coordinate and the second horizontal coordinate.
[0028] In an embodiment of the present invention, obtaining a right-facing horizontal gradient foreground image according to the gradient values of pixels in the grayscale image includes:
[0029] Subtract the brightness value of the pixel at a preset distance to the left of the current pixel from the brightness value of the current pixel to obtain the right horizontal gradient value of the current pixel;
[0030] When the right horizontal gradient value is higher than a fourth threshold, the current pixel is set as the foreground;
[0031] When the right horizontal gradient value is not higher than the fourth threshold, the current pixel is set as the background.
[0032] In an embodiment of the present invention, the method further includes:
[0033] When the width and height of the connected domain in the first foreground image both meet the preset girth weld experience threshold, it is determined to be a girth weld without defects;
[0034] extracting a second foreground image from the pseudo-color image based on the third color and the fourth color;
[0035] When the width and height of the connected domain in the second foreground image both meet the preset girth weld experience threshold, it is determined to be a defective girth weld;
[0036] When a connected domain of the foreground image extracted based on any one of the first color, the second color, the third color and the fourth color has a width greater than a preset value, it is determined to be a variable wall thickness ring weld.
[0037] In the embodiment of the present invention, the third color includes red, and the fourth color includes yellow.
[0038] In the embodiment of the present invention, determining the probability that a pixel belongs to various colors according to the hue and saturation of the pixel in the pseudo-color image includes:
[0039] Extract pixel samples of various colors in pseudo-color images;
[0040] The HSV color model is used to express each pixel in the pixel sample;
[0041] Use Gaussian Mixture Model (GMM) to describe the distribution of hue and saturation of each color;
[0042] The probability of a pixel belonging to each color is determined based on the distribution law.
[0043] In the embodiment of the present invention, determining the probability that a pixel belongs to each color includes:
[0044] Determine a first probability that the pixel is blue;
[0045] determining a second probability that the pixel is cyan;
[0046] Determine the third probability that the pixel is green;
[0047] Determine the fourth probability that the pixel is red;
[0048] Determine the fifth probability that the pixel is yellow;
[0049] Assigning the pixel to a target color according to probability includes:
[0050] The largest one among the first probability, the second probability, the third probability, the fourth probability and the fifth probability is determined, and a color corresponding to the largest one is determined as a target color of the pixel.
[0051] A second aspect of the present invention provides a processor configured to execute the above method for locating the center line of a girth weld.
[0052] A third aspect of the present invention provides a machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the above-mentioned method for locating the center line of a girth weld.
[0053] In an embodiment of the present invention, a pseudo-color image of a magnetic flux leakage detection signal image of a local area of a girth weld is obtained; the probability that a pixel belongs to various colors is determined according to the hue and saturation of the pixel in the pseudo-color image; the pixel is attributed to a target color according to the probability; in the pseudo-color image, a first foreground image is extracted based on the first color and the second color; the first foreground image is vertically projected to obtain a first projection curve, and the first projection curve is used to count the sum of the brightness values of all pixels in each column; the position of the center line of the girth weld is determined according to the first horizontal coordinate corresponding to the peak value on the first projection curve. The interference of the influence of metal objects interfering with the magnetic flux leakage detection signal, the intermittent influence caused by the defects of the girth weld, and the image gain influence on the identification and positioning of the center line of the girth weld is overcome, the accuracy of the positioning of the center line of the girth weld is ensured, the positioning accuracy of the identified center line of the girth weld can be improved, the identification and positioning of the center line of the girth weld based on the screenshot of the magnetic flux leakage detection signal of the oil and gas pipeline is realized, and the center line positioning of the girth weld image with variable wall thickness and defects and intermittent signal images can be adapted. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0055] Figure 1 A flow chart of a method for locating a center line of a girth weld according to an embodiment of the present invention is schematically shown;
[0056] Figure 2A schematic diagram schematically shows a first foreground image according to an embodiment of the present invention;
[0057] Figure 3 A schematic diagram of a first projection curve implemented according to the present invention is schematically shown;
[0058] Figure 4 Schematically shows a schematic diagram of marking the center line of a girth weld according to an embodiment of the present invention;
[0059] Figure 5 A grayscale diagram of a magnetic flux leakage internal detection signal image according to an embodiment of the present invention is schematically shown;
[0060] Figure 6 A high brightness foreground image according to an embodiment of the present invention is schematically shown;
[0061] Figure 7 A low brightness foreground image according to an embodiment of the present invention is schematically shown;
[0062] Figure 8 Schematically shows a right-facing horizontal gradient foreground image according to an embodiment of the present invention;
[0063] Fig. 9 Schematically showing a schematic diagram of a foreground connected domain of a defective girth weld implemented according to the present invention;
[0064] Fig.10 A schematic diagram of a foreground connected domain of a variable wall thickness girth weld according to an embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0065] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0066] It should be noted that if the implementation methods of the present application involve directional indications (such as up, down, left, right, front, back...), such directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0067] In addition, if there are descriptions involving "first", "second", etc. in the implementation methods of this application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various implementation methods can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0068] Figure 1 A flow chart of a method for locating a center line of a girth weld according to an embodiment of the present invention is schematically shown. Figure 1 As shown, in one embodiment of the present invention, a method for locating the center line of a girth weld is provided, comprising the following steps:
[0069] Step 101, obtaining a pseudo-color image of a magnetic flux leakage internal detection signal image of a local area of a girth weld;
[0070] Step 102, determining the probability of the pixel belonging to each color according to the hue and saturation of the pixel in the pseudo-color image;
[0071] Step 103, attributing the pixel to the target color according to probability;
[0072] Step 104, extracting a first foreground image from the pseudo color image based on the first color and the second color;
[0073] Step 105, vertically projecting the first foreground image to obtain a first projection curve, where the first projection curve is used to count the sum of brightness values of each column of pixels in the first foreground image;
[0074] Step 106 , determining the position of the centerline of the girth weld according to the first horizontal coordinate corresponding to the peak value of the first projection curve.
[0075] First, each pixel in the pseudo-color image is subjected to color classification, and each pixel corresponds to a target color. In one embodiment, the target color includes five colors: blue, cyan, green, red and yellow. The color of each pixel in the pseudo-color image is determined to be one of the five colors: blue, cyan, green, red and yellow.
[0076] The first foreground image is extracted based on the first color and the second color. In one embodiment, the first color is blue and the second color is cyan. The foreground and the background are represented by black and white, so that the foreground image is a binary image with only two colors, black and white. After each pixel in the pseudo-color image is color-classified, the pixels belonging to blue and cyan are determined as white, and the pixels belonging to green, red and yellow are determined as black, so that the first foreground image is obtained. Figure 2 A schematic diagram of a first foreground image according to an embodiment of the present invention is schematically shown. Figure 2 As shown. Figure 2 In the figure, the vertical white connected domain can be understood as the region of the ring weld (marked as 10), and the oblique white connected domain can be understood as the region of the spiral weld (marked as 11) or other interference factors.
[0077] The first foreground image is vertically projected to obtain a first projection curve, which is used to count the sum of the brightness values of all pixels in each column. Then, in the first projection curve, the approximate left and right boundaries of each connected domain are located to obtain its approximate circumscribed rectangle. Figure 3 Schematically shows a schematic diagram of a first projection curve implemented according to the present invention. Figure 3 As shown, the total brightness value of the pixels in the column where the ring weld is located is the largest, and the position of the center line of the ring weld is determined according to the first horizontal coordinate corresponding to the peak value on the first projection curve. The definition of the vertical projection Proj(j) refers to the following formula:
[0078]
[0079] In the above formula, i is the row number where the current pixel is located, j is the column number where the current pixel is located, H is the height value of the current image, and I(i,j) is the brightness value of the current pixel.
[0080] In one embodiment, determining the position of the center line of the girth weld according to the first horizontal coordinate corresponding to the peak value on the first projection curve includes: (1) using the empirical threshold Proj_th = H / 3*255, where H is the image height value, filtering the first projection curve, and setting the values on the first projection curve lower than Proj_th (first threshold) to 0; (2) scanning from left to right (first direction) to find the first position higher than Proj_th on the first projection curve, recorded as Xleft, as the leftmost coordinate of the girth weld; (3) scanning from right to left (second direction) to find the first position higher than Proj_th on the first projection curve, recorded as Xright, as the rightmost coordinate of the girth weld; (4) the horizontal coordinate Xmid of the center line of the girth weld is: Xmid = (Xleft+Xright) / 2. Figure 4A schematic diagram of marking the center line of the girth weld according to an embodiment of the present invention is shown schematically. Figure 4 As shown, Figure 4 The straight line mark 12 in FIG. 1 is the center line position of the girth weld.
[0081] As an optional implementation, a grayscale image may be used to perform complementary correction, which specifically includes the following steps:
[0082] (1) In addition to obtaining a pseudo-color image of the magnetic flux leakage internal detection signal image of the local area of the girth weld, a grayscale image of the magnetic flux leakage internal detection signal image is also obtained. Figure 5 The grayscale image of the magnetic flux leakage detection signal image according to the embodiment of the present invention is schematically shown. Figure 5 .
[0083] (2) Set a high brightness threshold (second threshold), the range of the high threshold can be 220-240, and for example, the high threshold can be set to 230. Binarize the grayscale image, and pixels above the high threshold are foreground, otherwise they are background. In this way, a high brightness foreground image is obtained. Figure 6 A high brightness foreground image according to an embodiment of the present invention is schematically shown, see Figure 6 .
[0084] (3) Set a low brightness threshold (third threshold), the range of the low threshold can be 45-55, and for example, the low threshold can be set to 50. Binarize the grayscale image, and the pixels below the low threshold are foreground, otherwise they are background. In this way, a low brightness foreground image is obtained. Figure 7 A low brightness foreground image according to an embodiment of the present invention is schematically shown. Figure 7 .
[0085] (4) Subtract the brightness value of the pixel at a distance of 3 (the distance 3 is only used as an example) to the left of the current pixel from the brightness value of the current pixel to obtain the right horizontal gradient value of the current pixel. If the right horizontal gradient value of the current pixel is higher than the fourth threshold (horizontal gradient threshold), the current pixel is set as the foreground, otherwise the current pixel is set as the background. In this way, the right horizontal gradient foreground image is obtained. Figure 8 The right-facing horizontal gradient foreground image according to an embodiment of the present invention is schematically shown. Figure 8 The fourth threshold value may range from 15 to 25. For example, the fourth threshold value may be set to 20.
[0086] (5) Perform an OR operation on the high-brightness foreground image, the low-brightness foreground image, and the right-facing horizontal gradient foreground image to achieve superposition fusion and obtain a fused image.
[0087] (6) vertically projecting the fused graph to obtain a second projection curve, and determining a second horizontal coordinate corresponding to a peak value on the second projection curve;
[0088] (7) A first horizontal coordinate is obtained based on the pseudo-color image, and a second horizontal coordinate is obtained based on the grayscale image. The average of the first horizontal coordinate and the second horizontal coordinate is used as the final positioning result of the center line of the girth weld. In this way, complementary correction can be performed using the grayscale image, further improving the accuracy of the positioning of the center line of the girth weld.
[0089] In one embodiment, the method further comprises:
[0090] When the width and height of the connected domain in the first foreground image both meet the preset girth weld experience threshold, it is determined to be a girth weld without defects;
[0091] In the pseudo color image, a second foreground image is extracted based on the third color and the fourth color;
[0092] When the width and height of the connected domain in the second foreground image both meet the preset girth weld experience threshold, it is determined to be a defective girth weld;
[0093] When a connected domain of the foreground image extracted based on any one of the first color, the second color, the third color and the fourth color has a width greater than a preset value, it is determined to be a variable wall thickness ring weld.
[0094] The first color may be blue, the second color may be cyan, the third color may be red, and the fourth color may be yellow. In the pseudo-color image of the magnetic flux leakage detection signal image, the blue and cyan pixels are detected to extract the foreground connected domain (the pixels belonging to blue and cyan are determined as white, and the pixels belonging to other colors are determined as black). If the foreground connected domain is slender and the width and height meet the preset girth weld experience threshold, it is judged as a normal girth weld.
[0095] If the blue and cyan foreground connected domains that meet the empirical threshold in size are not extracted, red and yellow pixels are used for detection to extract the foreground connected domain (pixels belonging to red and yellow are determined as white, and pixels belonging to other colors are determined as black). If the foreground connected domain is slender and its width and height meet the set girth weld empirical threshold, it is judged as a defective girth weld. Fig. 9 A schematic diagram of a foreground connected domain of a defective girth weld according to the present invention is shown schematically, see Fig. 9 .
[0096] If the connected domain of the foreground image extracted based on any one of the colors blue, cyan, red and yellow has a large size (width greater than a preset value), it is determined to be a variable wall thickness girth weld. Fig.10 A schematic diagram of a foreground connected domain of a variable wall thickness girth weld according to an embodiment of the present invention is shown schematically. Fig.10 As shown, it can be seen that in Fig.10 In the figure, the size of the middle white area is large, which is judged to be a variable wall thickness feature.
[0097] In step 102, the probability of the pixel belonging to each color is determined according to the hue and saturation of the pixel in the pseudo-color image; in step 103, the pixel is attributed to the target color according to the probability; steps 102 and 103 are described in detail below.
[0098] In one embodiment, determining the probability that a pixel belongs to various colors according to the hue and saturation of the pixel in the pseudo-color image includes:
[0099] Extract pixel samples of various colors in pseudo-color images;
[0100] The HSV color model is used to express each pixel in the pixel sample;
[0101] Gaussian mixture model GMM is used to describe the distribution of hue and saturation of each color;
[0102] The probability of a pixel belonging to each color is determined based on the distribution law.
[0103] Exemplarily, the local area of the ring weld position of the pseudo-color image is enlarged, and 10,000 pixel samples of each color can be extracted from the pseudo-color image, for example, 10,000 pixel samples belonging to blue are extracted, 10,000 pixel samples belonging to cyan are extracted, 10,000 pixel samples belonging to green are extracted, 10,000 pixel samples belonging to red are extracted, and 10,000 pixel samples belonging to yellow are extracted. Then the HSV color model is used to express each pixel in the pixel sample. The color parameters in the HSV color model are: hue (Hue), saturation (Saturation) and brightness (Value). The Gaussian mixture model GMM is used to describe the distribution law of the hue and saturation of each color (since the feature of brightness (V) is relatively unstable, the two features of hue (H) and saturation (S) are mainly used). In this way, according to the hue and saturation of the current pixel and the distribution law of the hue and saturation of each color, the probability that the current pixel belongs to a certain color can be determined. Refer to the following formula:
[0104]
[0105] The above formula is the calculation process of the probability that the current pixel x belongs to a certain color under the Gaussian mixture model GMM. P(x) represents the probability, K corresponds to the number of subclasses, μ is the data mean, and ∑ is the covariance.
[0106] In one embodiment, determining the probability that a pixel belongs to each color includes:
[0107] Determine a first probability that the pixel is blue;
[0108] determining a second probability that the pixel is cyan;
[0109] Determine the third probability that the pixel is green;
[0110] Determine the fourth probability that the pixel is red;
[0111] Determine the fifth probability that the pixel is yellow;
[0112] Assigning pixels to a target color based on probability involves:
[0113] The largest one among the first probability, the second probability, the third probability, the fourth probability and the fifth probability is determined, and the color corresponding to the largest one among the five probabilities is determined as the target color of the pixel. In this way, color classification is performed on each pixel in the pseudo-color image.
[0114] In an embodiment of the present invention, a pseudo-color image of a magnetic flux leakage detection signal image of a local area of a ring weld is obtained; the probability of a pixel belonging to various colors is determined according to the hue and saturation of the pixel in the pseudo-color image; the pixel is attributed to a target color according to the probability; in the pseudo-color image, a first foreground image is extracted based on the first color and the second color; the first foreground image is vertically projected to obtain a first projection curve, which is used to count the sum of the brightness values of all pixels in each column; the position of the center line of the ring weld is determined according to the first horizontal coordinate corresponding to the peak value on the first projection curve. The interference of metal objects interfering with the magnetic flux leakage detection signal, the intermittent influence caused by the defects of the ring weld, and the image gain influence on the identification and positioning of the center line of the ring weld are overcome, thereby ensuring the accuracy of the positioning of the center line of the ring weld.
[0115] In the embodiment of the present invention, the recognition and positioning of the center line of the girth weld based on the screenshot of the magnetic flux leakage internal detection signal of the oil and gas pipeline is realized, and it can adapt to the center line positioning of the girth weld with variable wall thickness, girth weld with defects and intermittent signal image. The present invention relates to the image recognition and analysis technology of the detection signal in the long-distance oil and gas pipeline. It is an intelligent recognition and analysis method for the girth weld characteristics based on the magnetic flux leakage internal detection signal image, which can improve the positioning accuracy of the center line of the identified girth weld, avoid the interference of metal objects, defects, fractures and variable wall thickness, automatically calculate the best image gain, and improve the adaptability of the algorithm. The embodiment of the present invention provides an image recognition technology to realize the positioning of the center line of the girth weld in the magnetic flux leakage internal detection signal image of the pipeline.
[0116] An embodiment of the present invention provides a processor, which is configured to execute any one of the methods for locating the center line of a girth weld in the above embodiments.
[0117] Specifically, the processor may be configured to:
[0118] Acquire a pseudo-color image of the magnetic flux leakage internal detection signal image of the local area of the girth weld;
[0119] Determine the probability of pixels belonging to various colors based on the hue and saturation of the pixels in the pseudo-color image;
[0120] Assign pixels to the target color based on probability;
[0121] extracting a first foreground image from the pseudo color image based on the first color and the second color;
[0122] Performing vertical projection on the first foreground image to obtain a first projection curve, where the first projection curve is used to count the sum of brightness values of each column of pixels in the first foreground image;
[0123] The position of the center line of the girth weld is determined according to the first horizontal coordinate corresponding to the peak value of the first projection curve.
[0124] In an embodiment of the present invention, the processor is configured to:
[0125] The target colors include: blue, cyan, green, red, and yellow, the first color includes blue, and the second color includes cyan.
[0126] In an embodiment of the present invention, the processor is configured to:
[0127] Determining the position of the centerline of the girth weld according to the first horizontal coordinate corresponding to the peak value of the first projection curve includes:
[0128] Scanning the first projection curve from a first direction to determine a first position on the first projection curve that is higher than a first threshold;
[0129] determining the horizontal coordinate of the first position as the leftmost coordinate of the girth weld;
[0130] Scanning the first projection curve from a second direction to determine a first second position on the first projection curve that is higher than a first threshold;
[0131] determining the horizontal coordinate of the second position as the rightmost coordinate of the girth weld;
[0132] The average of the leftmost and rightmost coordinates is determined as the location of the girth weld centerline.
[0133] In this embodiment of the present invention, the processor is further configured to:
[0134] Obtaining a grayscale image of a magnetic flux leakage internal detection signal image;
[0135] Binarizing the grayscale image based on the second threshold to obtain a high-brightness foreground image;
[0136] Binarizing the grayscale image based on a third threshold to obtain a low-brightness foreground image, wherein the third threshold is less than the second threshold;
[0137] According to the gradient value of the pixel in the grayscale image, the right horizontal gradient foreground image is obtained;
[0138] Performing an OR operation on the high brightness foreground image, the low brightness foreground image, and the right horizontal gradient foreground image to achieve superposition fusion and obtain a fused image;
[0139] Perform vertical projection on the fusion graph to obtain a second projection curve;
[0140] Determine a second horizontal coordinate corresponding to the peak value of the second projection curve;
[0141] The position of the center line of the girth weld is determined according to the average value of the first horizontal coordinate and the second horizontal coordinate.
[0142] In an embodiment of the present invention, the processor is configured to:
[0143] According to the gradient value of the pixel in the grayscale image, the right horizontal gradient foreground image is obtained, including:
[0144] Subtract the brightness value of the pixel at a preset distance to the left of the current pixel from the brightness value of the current pixel to obtain the right horizontal gradient value of the current pixel;
[0145] When the right horizontal gradient value is higher than a fourth threshold, the current pixel is set as the foreground;
[0146] When the right horizontal gradient value is not higher than the fourth threshold, the current pixel is set as the background.
[0147] In this embodiment of the present invention, the processor is further configured to:
[0148] When the width and height of the connected domain in the first foreground image both meet the preset girth weld experience threshold, it is determined to be a girth weld without defects;
[0149] extracting a second foreground image from the pseudo-color image based on the third color and the fourth color;
[0150] When the width and height of the connected domain in the second foreground image both meet the preset girth weld experience threshold, it is determined to be a defective girth weld;
[0151] When a connected domain of the foreground image extracted based on any one of the first color, the second color, the third color and the fourth color has a width greater than a preset value, it is determined to be a variable wall thickness ring weld.
[0152] In an embodiment of the present invention, the processor is configured to:
[0153] The third color includes red, and the fourth color includes yellow.
[0154] In an embodiment of the present invention, the processor is configured to:
[0155] Determining the probability of a pixel belonging to various colors based on the hue and saturation of the pixel in the pseudo-color image includes:
[0156] Extract pixel samples of various colors in pseudo-color images;
[0157] The HSV color model is used to express each pixel in the pixel sample;
[0158] Gaussian mixture model GMM is used to describe the distribution of hue and saturation of each color;
[0159] The probability of a pixel belonging to each color is determined based on the distribution law.
[0160] In an embodiment of the present invention, the processor is configured to:
[0161] Determining the probability of a pixel belonging to each color involves:
[0162] Determine a first probability that the pixel is blue;
[0163] determining a second probability that the pixel is cyan;
[0164] Determine the third probability that the pixel is green;
[0165] Determine the fourth probability that the pixel is red;
[0166] Determine the fifth probability that the pixel is yellow;
[0167] Assigning the pixel to a target color according to probability includes:
[0168] The largest one among the first probability, the second probability, the third probability, the fourth probability and the fifth probability is determined, and a color corresponding to the largest one is determined as a target color of the pixel.
[0169] An embodiment of the present invention provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned method for locating the center line of a girth weld.
[0170] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0171] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0172] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0174] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0175] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0176] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0177] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0178] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for locating the centerline of a girth weld, characterized in that: include: Acquire a pseudo-color image of the magnetic flux leakage internal detection signal image of the local area of the girth weld; Determining the probability of the pixel belonging to each color according to the hue and saturation of the pixel in the pseudo-color image; Attributing the pixel to a target color according to the probability, wherein the target color includes: blue, cyan, green, red and yellow; Determine the pixels belonging to the first color and the second color as white, and extract the white pixels from the pseudo-color image to obtain a first foreground image, wherein the first color includes blue and the second color includes cyan; Performing vertical projection on the first foreground image to obtain a first projection curve, where the first projection curve is used to count the sum of brightness values of each column of pixels in the first foreground image; The position of the center line of the girth weld is determined according to the first horizontal coordinate corresponding to the peak value of the first projection curve.
2. The method according to claim 1, characterized in that Determining the position of the centerline of the girth weld according to the first horizontal coordinate corresponding to the peak value of the first projection curve includes: Scanning the first projection curve from a first direction to determine a first position on the first projection curve that is higher than a first threshold; Determine the horizontal coordinate of the first position as the leftmost coordinate of the girth weld; Scanning the first projection curve from a second direction to determine a first second position on the first projection curve that is higher than a first threshold; Determining the horizontal coordinate of the second position as the rightmost coordinate of the girth weld; An average value of the leftmost coordinate and the rightmost coordinate is determined as the position of the centerline of the girth weld.
3. The method according to claim 1, characterized in that Also includes: Acquire a grayscale image of the magnetic flux leakage internal detection signal image; Binarizing the grayscale image based on a second threshold value to obtain a high-brightness foreground image; Binarizing the grayscale image based on a third threshold to obtain a low-brightness foreground image, wherein the third threshold is less than the second threshold; Obtain a rightward horizontal gradient foreground image according to the gradient values of the pixels in the grayscale image; Performing an OR operation on the high-brightness foreground image, the low-brightness foreground image, and the right-direction horizontal gradient foreground image to achieve superposition fusion and obtain a fused image; Performing vertical projection on the fusion graph to obtain a second projection curve; Determining a second horizontal coordinate corresponding to a peak value of the second projection curve; The position of the center line of the girth weld is determined according to an average value of the first horizontal coordinate and the second horizontal coordinate.
4. The method according to claim 3, characterized in that The step of obtaining a rightward horizontal gradient foreground image according to the gradient values of pixels in the grayscale image comprises: Subtracting the brightness value of a pixel at a preset distance to the left of the current pixel from the brightness value of the current pixel to obtain a rightward horizontal gradient value of the current pixel; When the rightward horizontal gradient value is higher than a fourth threshold, setting the current pixel as a foreground; When the rightward horizontal gradient value is not higher than a fourth threshold, the current pixel is set as the background.
5. The method according to claim 1, characterized in that Also includes: When the width and height of the connected domain in the first foreground image both meet the preset girth weld experience threshold, the girth weld is determined to be defect-free; extracting a second foreground image from the pseudo-color image based on a third color and a fourth color; When the width and height of the connected domain in the second foreground image both meet the preset girth weld experience threshold, determining it as a defective girth weld; When a connected domain of the foreground image extracted based on any one of the first color, the second color, the third color and the fourth color has a width greater than a preset value, it is determined to be a variable wall thickness ring weld.
6. The method according to claim 5, characterized in that The third color includes red, and the fourth color includes yellow.
7. The method according to claim 1, characterized in that Determining the probability that the pixel belongs to various colors according to the hue and saturation of the pixel in the pseudo-color image includes: Extracting pixel samples of various colors from the pseudo-color image; Using the HSV color model to express each pixel in the pixel sample; Gaussian mixture model GMM is used to describe the distribution of hue and saturation of each color; The probability that the pixel belongs to each color is determined based on the distribution law.
8. The method according to claim 1, characterized in that Determining the probability that the pixel belongs to each color includes: Determining a first probability that the pixel is blue; determining a second probability that the pixel is cyan; determining a third probability that the pixel is green; determining a fourth probability that the pixel is red; determining a fifth probability that the pixel is yellow; The attributing the pixel to the target color according to the probability comprises: A maximum one among the first probability, the second probability, the third probability, the fourth probability and the fifth probability is determined, and a color corresponding to the maximum one is determined as a target color of the pixel.
9. A computing device, characterized in that include: A processor configured to execute the method for locating the center line of a girth weld according to any one of claims 1 to 8.
10. A machine-readable storage medium having instructions stored thereon, characterized in that: The instructions are used to enable a machine to execute the method for locating a center line of a girth weld according to any one of claims 1 to 8.
Citation Information
Patent Citations
Welding seam image identification method, computer device and computer readable storage medium
CN108280829A
Defect detector based on image recognition
JP1994027036A