A Method for Calibrating Weld Areas in X-ray Images of Small-diameter Tubes

By combining the grayscale variable and fit function with Otsu method segmentation and edge detection operator, the problem of automatic calibration of the weld area of the small-diameter tube X-ray image is solved, and the rapid and accurate determination of weld position is achieved, which is suitable for program implementation.

CN115965605BActive Publication Date: 2025-08-05SHAANXI YANCHANG PETROLEUM JINSHI DRILLING EQUIP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211732490.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2025-08-05
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

The lack of efficient automatic calibration method for small-diameter tube X-ray image weld area in the prior art, resulting in difficulty in assessing welding quality.

Method used

By defining the grayscale variable and fit function, combining Otsu method segmentation and edge detection operators, weld areas can be quickly determined, avoid noise and image interference, and accurately positioning of weld positions can be achieved.

Benefits of technology

It realizes the rapid and accurate determination of the x-ray image weld area of the small diameter tube, reduces the impact of noise and image interference, and is suitable for program implementation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115965605B_ABST
    Figure CN115965605B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for calibrating the weld area of a small-diameter pipe X-ray image. A new function is proposed based on the characteristics of the small-diameter pipe X-ray image to determine the approximate position of the weld area, avoiding the influence of various noises and letters and numbers in the image on recognition. Mathematically analyzed, because the present invention aims at the characteristics of the small-diameter pipe weld image and uses an analytical formula to match the position of the arrow in the actual X-ray image, the approximate position of the weld can be quickly determined, and the function calculation is simple. Therefore, it has the characteristic of fast speed during traversal search. At the same time, the proposed function determines the similarity through the image angle and has the advantage of strong anti-interference ability. When accurately determining the weld position, a new left and right edge detection operator and method are proposed. The proposed method is suitable for program implementation and has been practically verified. The present invention provides a new scientific idea for calibrating the position of the small-diameter pipe X-ray weld.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of X-ray weld defect detection, and particularly relates to a method for calibrating the weld area of a small-diameter pipe X-ray image. Background Art

[0002] Welding of small-diameter pipes is the most widely used technology in various oil and gas devices. The evaluation of welding quality mostly uses X-ray imaging, and then determines whether there are defects and the type of defects according to the ray image. In the automatic determination process using computer technology, the first step is to determine the weld area in the ray image. However, the X-ray image of small-diameter pipes is much more complex than the X-ray image of general circumferential welds, and there is currently a lack of an efficient method for automatically calibrating the weld area of small-diameter pipe X-ray images. Summary of the Invention

[0003] In order to solve the above problems existing in the prior art, the present invention provides a method for calibrating the weld area of a small-diameter pipe X-ray image. The technical problems to be solved by the present invention are realized through the following technical solutions:

[0004] The present invention provides a method for calibrating the weld area of a small-diameter pipe X-ray image, including:

[0005] Step 1: According to the small-diameter pipe X-ray image, define a gray variable gray for characterizing the gray value of the pixel point (i, j) of the small-diameter pipe X-ray image ij , 1 ≤ i ≤ Height, 1 ≤ j ≤ Width, where Height represents the height of the small-diameter pipe X-ray image, and Width represents the width of the small-diameter pipe X-ray image;

[0006] Step 2: According to the small-diameter pipe arrow image template, define the binary small-diameter pipe arrow image template as gray_m mn , 1 ≤ m ≤ m_Height, 1 ≤ n ≤ m_Width, where m_Height represents the height of the arrow template image in the small-diameter pipe image, and m_Wdith represents the width of the arrow template image in the small-diameter pipe image;

[0007] Step 3: Use the Otsu method to segment the small-diameter pipe X-ray image to obtain the segmented small-diameter pipe X-ray image, and use pgray ij to represent the gray value of the pixel point of the segmented small-diameter pipe X-ray image, 1 ≤ i ≤ Height, 1 ≤ j ≤ Width, Height is the height of the small-diameter pipe X-ray image, and Width is the width of the small-diameter pipe X-ray image;

[0008] Step 4: According to the segmented small-diameter pipe X-ray image and the binary small-diameter pipe arrow image template, construct a fitness function fit pq as follows:

[0009]

[0010] Among them, 1≤p≤Height-m_Height, 1≤q≤Width-m_Width;

[0011] Step 5: According to the fit function fit pq , calculate the fit function fit pq The pixel point corresponding to the minimum value is recorded as mini and minj;

[0012] Step 6: Based on pixel points mini and minj, perform vertical left edge detection and vertical right edge detection on the segmented small-diameter tube X-ray image to obtain the left boundary of the weld and the right boundary of the weld;

[0013] Step 7: Based on the left boundary of the weld and the right boundary of the weld, a boundary is drawn on the X-ray image of the small-diameter pipe to obtain a small-diameter pipe weld area.

[0014] In one embodiment of the present invention, step 5 includes: calculating pixel point mini and pixel point minj by traversal according to the following formula:

[0015] fit mini,minj =min(fit pq )st 1≤p≤Height-m_Height, 1≤q≤Width-m_Width.

[0016] In one embodiment of the present invention, in step 6, vertical left edge detection is performed on the segmented small-diameter tube X-ray image based on pixel point mini and pixel point minj to obtain the left boundary of the weld, including:

[0017] Step a: Use the following formula to detect the vertical left edge.

[0018]

[0019] Step b: Definition

[0020] Step c: According to the following formula, calculate the left boundary j_left of the weld by traversing.

[0021] sum j_left =max(sum_left j )1≤j≤minj.

[0022] In one embodiment of the present invention, in step 6, according to pixel points mini and minj, the vertically right edge of the segmented small-diameter pipe X-ray image is detected to obtain the right boundary of the weld, including:

[0023] Step a: Use the following formula to perform vertical right edge detection.

[0024]

[0025] Step b: Define

[0026] Step c: According to the following formula, calculate the right boundary j_right of the weld by traversing, sum j_right = max(sum_right j ) 1 ≤ j ≤ minj.

[0027] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0028] The method for calibrating the weld area of the small-diameter pipe X-ray image of the present invention proposes a new function to determine the approximate position of the weld area according to the characteristics of the small-diameter pipe X-ray image, avoiding the influence of various noises and letters and numbers in the image on recognition. Mathematically analyzed, because the present invention aims at the characteristics of the small-diameter pipe weld image and uses an analytical formula to match the position of the arrow in the actual X-ray image, the approximate position of the weld can be quickly determined, the function calculation is simple, so it has the characteristic of being fast during traversal search. At the same time, the proposed function determines the similarity through the image angle and has the advantage of strong anti-interference ability. When accurately determining the weld position, a new left and right edge detection operator and method are proposed, and the proposed method is suitable for program implementation.

[0029] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given and described in detail in conjunction with the accompanying drawings as follows. Brief Description of the Drawings

[0030] Figure 1 is a flowchart of a method for calibrating the weld area of a small-diameter pipe X-ray image provided by an embodiment of the present invention;

[0031] Figure 2 is the small-diameter pipe X-ray image of Embodiment 1;

[0032] Figure 3 is a small-diameter pipe arrow image template provided by an embodiment of the present invention;

[0033] Figure 4It is the X-ray image of the small-diameter pipe in Example 1 after Otsu segmentation;

[0034] Figure 5 It is the calibration diagram of the weld area in Example 1;

[0035] Figure 6 It is the X-ray image of the small-diameter pipe in Example 2;

[0036] Figure 7 It is a template of the arrow image of the small-diameter pipe provided by the embodiment of the present invention;

[0037] Figure 8 It is the X-ray image of the small-diameter pipe in Example 2 after Otsu segmentation;

[0038] Figure 9 It is the calibration diagram of the weld area in Example 2. Detailed implementation manners

[0039] In order to further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following combines the accompanying drawings and specific implementation manners to detail a method for calibrating the weld area of the X-ray image of a small-diameter pipe proposed according to the present invention.

[0040] The foregoing and other technical contents, features, and effects of the present invention can be clearly presented in the following detailed description in conjunction with the accompanying drawings. Through the description of the specific implementation manners, a more in-depth and specific understanding of the technical means and effects adopted by the present invention to achieve the predetermined purpose can be obtained. However, the accompanying drawings are only for reference and explanation, and are not used to limit the technical solution of the present invention.

[0041] In the description of the present invention, unless otherwise specified, "a plurality of" means two or more. In the description of the present invention, it should be noted that unless otherwise clearly specified and limited, the term "binary small-diameter pipe arrow image template" should be understood in a broad sense. For example, the arrow can be to the left or to the right, and the arrow image template can be of any size. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood in specific situations.

[0042] Example 1

[0043] Please refer to Figure 1 , Figure 1 It is a flowchart of a method for calibrating the weld area of the X-ray image of a small-diameter pipe provided by the embodiment of the present invention. As shown in the figure, the method for calibrating the weld area of the X-ray image of the small-diameter pipe in this embodiment includes:

[0044] Step 1: According to the X-ray image of the small-diameter pipe, define a gray variable gray for characterizing the gray value of the pixel point (i, j) of the X-ray image of the small-diameter pipeij where \(1\leq i\leq Height\) and \(1\leq j\leq Width\), and \(Height\) represents the height of the x-ray image of the small-diameter pipe, and \(Width\) represents the width of the x-ray image of the small-diameter pipe;

[0045] Step 2: Define the binary template of the small-diameter pipe arrow image as gray_m according to the small-diameter pipe arrow image template mn where \(1\leq m\leq m\_Height\) and \(1\leq n\leq m\_Width\), and \(m\_Height\) represents the height of the arrow template image in the small-diameter pipe image, and \(m\_Wdith\) represents the width of the arrow template image in the small-diameter pipe image;

[0046] Step 3: Segment the x-ray image of the small-diameter pipe using the Otsu method to obtain the segmented x-ray image of the small-diameter pipe, and use pgray ij to represent the gray value of the pixel points of the segmented x-ray image of the small-diameter pipe, where \(1\leq i\leq Height\) and \(1\leq j\leq Width\), \(Height\) is the height of the x-ray image of the small-diameter pipe, and \(Width\) is the width of the x-ray image of the small-diameter pipe;

[0047] Step 4: Construct a fitness function fit according to the segmented x-ray image of the small-diameter pipe and the binary template of the small-diameter pipe arrow image pq as follows:

[0048]

[0049] where \(1\leq p\leq Height - m\_Height\) and \(1\leq q\leq Width - m\_Width\);

[0050] Step 5: According to the fitness function fit pq , calculate the pixel points corresponding to the minimum value of the fitness function fit pq , and denote these pixel points as mini and minj;

[0051] In an optional implementation, according to formula (2), calculate the pixel points mini and pixel point minj by traversing:

[0052] fit mini,minj = min(fit pq ) s.t \(1\leq p\leq Height - m\_Height\) and \(1\leq q\leq Width - m\_Width\) (2);

[0054] Step 6: Perform vertical left edge detection and vertical right edge detection on the segmented x-ray image of the small-diameter pipe according to the pixel points mini and pixel point minj to obtain the left boundary and right boundary of the weld;

[0055] In an optional implementation, based on pixel points mini and minj, perform vertical left-edge detection on the segmented x-ray image of the small-diameter pipe to obtain the left boundary of the weld, including:

[0056] Step a: Use formula (3) to perform vertical left-edge detection.

[0057]

[0058] Step b: Define

[0059] Step c: According to formula (4), calculate the left boundary j_left of the weld through traversal.

[0060] sum j_left = max(sum_left j ) 1 ≤ j ≤ minj (4).

[0061] In an optional implementation, based on pixel points mini and minj, perform vertical right-edge detection on the segmented x-ray image of the small-diameter pipe to obtain the right boundary of the weld, including:

[0062] Step a: Use formula (5) to perform vertical right-edge detection.

[0063]

[0064] Step b: Define

[0065] Step c: According to formula (6), calculate the right boundary j_right of the weld through traversal.

[0066] sum j_right = max(sum_right j ) 1 ≤ j ≤ minj (6).

[0067] Step 7: Based on the left boundary and right boundary of the weld, perform boundary drawing on the x-ray image of the small-diameter pipe to obtain the weld area of the small-diameter pipe.

[0068] Specifically, draw the left boundary j_left and right boundary j_right on the x-ray image of the small-diameter pipe, and the area between the two values is the weld area of the small-diameter pipe.

[0069] The method for calibrating the weld area of the small-diameter pipe X-ray image in this embodiment proposes a new function based on the characteristics of the small-diameter pipe X-ray image to determine the approximate position of the weld area, avoiding the influence of various noises and letters and numbers in the image on recognition. Mathematically analyzed, because the present invention aims at the characteristics of the small-diameter pipe weld image and uses an analytical formula to match the arrow position in the actual X-ray image, the approximate position of the weld can be quickly determined, and the function calculation is simple. Therefore, it has the characteristic of being fast during traversal search. At the same time, the proposed function determines the similarity through the image angle and has the advantage of strong anti-interference ability. When accurately determining the weld position, a new left and right edge detection operator and method are proposed, and the proposed method is suitable for program implementation.

[0070] Furthermore, the above method for calibrating the weld area of the small-diameter pipe X-ray image is illustrated through specific embodiments.

[0071] Embodiment 1

[0072] The small-diameter pipe X-ray image is as Figure 2 shown, Height = 795, Width = 1261.

[0073] The template of the small-diameter pipe arrow image after binarization is as Figure 3 shown, m_Height = 101, m_Width = 70.

[0074] Step 1: Define the grayscale variable gray ij , 1 ≤ i ≤ Height, 1 ≤ j ≤ Width, where Height is the height of the small-diameter pipe X-ray image and Width is the width of the small-diameter pipe X-ray image. The variable gray ij is used to represent the grayscale value of the pixel point (i, j).

[0075] Step 2: Define the template gray_m of the small-diameter pipe arrow image after binarization mn , 1 ≤ m ≤ m_Height, 1 ≤ n ≤ m_Width, where m_Height is the height of the arrow template image in the small-diameter pipe image and m_Wdith is the width of the arrow template image in the small-diameter pipe image.

[0076] Step 3: Use the Otsu method to segment the small-diameter pipe X-ray image. The processing result is as Figure 4 shown. The grayscale value of the pixel point after segmentation is represented by pgray ij , 1 ≤ i ≤ 795, 1 ≤ j ≤ 1261, where 795 is the height of the small-diameter pipe X-ray image and 1261 is the width of the small-diameter pipe weld X-ray image.

[0077] Step 4: Construct the fitness function fit as shown in formula (1) pq, 1 ≤ p ≤ 795 - 101, 1 ≤ q ≤ 1261 - 70.

[0078] Step Five: Calculate fit = 24 degrees, mini = 416, and minj = 776 by traversing according to the following formula.

[0079] fit mini,minj = min(fit pq ) s.t 1 ≤ p ≤ 795 - 101, 1 ≤ q ≤ 1261 - 70 (7);

[0080] Step Six: Use the following formula to perform vertical left edge detection.

[0081]

[0082] Step Seven: Define

[0083] Step Eight: Calculate the left boundary of the weld seam j_left = 107 by traversing according to the following formula.

[0084] sum j_left = max(sum_left j ) 1 ≤ j ≤ 776 (9);

[0085] Step Nine: Use the following formula to perform vertical right edge detection.

[0086]

[0087] Step Ten: Define

[0088] Step Eleven: Calculate the right boundary of the weld seam j_right = 370 by traversing according to the following formula.

[0089] sum j_right = max(sum_right j ) 1 ≤ j ≤ 776 (11);

[0090] Step Twelve: Draw the left boundary j_left = 107 and the right boundary j_right = 370 on the x-ray image of the small-diameter pipe. The area between the two values is the weld area of the small-diameter pipe. The processing result is as Figure 5 shown.

[0091] Example 2

[0092] The X-ray circumferential weld image is as Figure 6 shown, Height = 805, Width = 1603.

[0093] The binarized arrow image template of the small-diameter pipe is asFigure 7 As shown, m_Height = 101 and m_Width = 70.

[0094] Step 1: Define the grayscale variable gray ij , where 1 ≤ i ≤ Height, 1 ≤ j ≤ Width, Height is the height of the small-diameter pipe x-ray image, Width is the width of the small-diameter pipe x-ray image, and the variable gray ij is used to represent the grayscale value of the pixel point (i ,j ).

[0095] Step 2: Define the template gray_m of the arrow image of the small-diameter pipe after binarization mn , where 1 ≤ m ≤ m_Height, 1 ≤ n ≤ m_Width, m_Height is the height of the arrow template image in the small-diameter pipe image, and m_Wdith is the width of the arrow template image in the small-diameter pipe image.

[0096] Step 3: Segment the small-diameter pipe x-ray image using the Otsu method. The processing result is as Figure 8 shown. The grayscale value of the pixel point after segmentation is represented by pgray ij , where 1 ≤ i ≤ 805, 1 ≤ j ≤ 1603, 805 is the height of the small-diameter pipe x-ray image, and 1603 is the width of the small-diameter pipe x-ray image.

[0097] Step 4: Construct the fitness function fit as shown in formula (1) pq , where 1 ≤ p ≤ 805 - 101, 1 ≤ q ≤ 1603 - 70.

[0098] Step 5: According to the following formula, calculate fit = 31 degrees, mini = 248, and minj = 1276 by traversing.

[0099] fit mini,minj = min(fit pq ) s.t 1 ≤ p ≤ 805 - 101, 1 ≤ q ≤ 1603 - 70 (12);

[0100] Step 6: Use the following formula to perform vertical left edge detection.

[0101]

[0102] Step 7: Define

[0103] Step 8: Calculate the left boundary of the weld j_left = 732 by traversing according to the following formula.

[0104] sum j_left = max(sum_left j) 1 ≤ j ≤ 1276 (14);

[0105] Step Nine: Use the following formula to perform vertical right edge detection.

[0106]

[0107] Step Ten: Define

[0108] Step Eleven: Calculate the right boundary of the weld seam j_right = 926 by traversing according to the following formula.

[0109] sum j_right = max(sum_right j ) 1 ≤ j ≤ 1276 (16);

[0110] Step Twelve: Draw the left boundary j_left = 732 and the right boundary j_right = 926 on the x-ray image of the small-diameter pipe. The area between the two is the weld area of the small-diameter pipe. The processing result is as Figure 9 shown.

[0111] It should be noted that in this article, the terms "include", "comprise" or any other variant are intended to cover non-exclusive inclusion, so that an article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of another identical element in the article or device including the said element.

[0112] The above content is a further detailed description of the present invention in combination with specific preferred embodiments. It cannot be determined that the specific implementation of the present invention is only limited to these descriptions. For those of ordinary skill in the technical field to which the present invention pertains, without departing from the concept of the present invention, several simple deductions or substitutions can be made, and all should be regarded as belonging to the protection scope of the present invention.

Claims

1. A method for calibrating weld area in X-ray images of small-diameter pipes, characterized in that: include: Step 1: Based on the small-diameter tube X-ray image, define the grayscale variable gray used to characterize the grayscale value of the pixel point (i, j) of the small-diameter tube X-ray image ij , 1≤i≤Height, 1≤j≤Width, where Height represents the height of the small-diameter tube X-ray image and Width represents the width of the small-diameter tube X-ray image; Step 2: Based on the small-diameter tube arrow image template, define the binary small-diameter tube arrow image template as gray_m mn , 1≤m≤m_Height, 1≤n≤m_Width, where m_Height represents the height of the arrow template image in the small-diameter tube image, and m_Wdith represents the width of the arrow template image in the small-diameter tube image; Step 3: Use Otsu's method to segment the small diameter tube X-ray image to obtain the segmented small diameter tube X-ray image, and use pgray ij Represents the pixel grayscale value of the segmented small-diameter tube X-ray image, 1≤i≤Height, 1≤j≤Width, Height is the height of the small-diameter tube X-ray image, Width is the width of the small-diameter tube X-ray image; Step 4: Construct the fit function fit based on the segmented small diameter tube X-ray image and the binary small diameter tube arrow image template pq as follows: Among them, 1≤p≤Height-m_Height, 1≤q≤Width-m_Width; Step 5: According to the fit function fit pq , calculate the fit function fit pq The pixel point corresponding to the minimum value is recorded as mini and minj; Step 6: Based on pixel point mini and pixel point minj, perform vertical left edge detection and vertical right edge detection on the segmented small-diameter tube X-ray image to obtain the left boundary and right boundary of the weld; including: According to the pixel points mini and minj, the vertical left edge detection is performed on the segmented small diameter tube X-ray image to obtain the left boundary of the weld, including: Step a: Use the following formula to detect the vertical left edge. Step b: Definition Step c: According to the following formula, calculate the left boundary j_left of the weld by traversing. sum j_left =max(sum_left j )1≤j≤minj; According to the pixel points mini and minj, the vertical right edge detection is performed on the segmented small diameter tube X-ray image to obtain the right boundary of the weld, including: Step a: Use the following formula to detect the vertical right edge. Step b: Definition Step c: According to the following formula, calculate the right boundary of the weld j_right by traversing. sum j_right =max(sum_right j )1≤j≤minj; Step 7: Based on the left boundary of the weld and the right boundary of the weld, a boundary is drawn on the X-ray image of the small-diameter pipe to obtain a small-diameter pipe weld area.

2. The method for calibrating weld area in X-ray images of small-diameter pipes according to claim 1, characterized in that: Step 5 includes: calculating pixel point mini and pixel point minj by traversal according to the following formula: fit mini,minj =min(fit pq )s.t 1≤p≤Height-m_Height,1≤q≤Width-m_Width。

Citation Information

Patent Citations

  • Monitoring probe for welding seam in continuous welding, and welding seam monitoring system and method

    CN106583961A

  • Search method for weld joint area of radiographic inspection image of welded joint of small-diameter pipe

    CN111489310A