A welding seam image preprocessing method for improving edge sampling precision

By performing grayscale conversion, contrast enhancement, and Sobel edge detection on weld seam images, combined with grayscale mapping and height compensation, the problems of information loss and noise in weld seam edge sliding sampling are solved, achieving high-precision edge feature extraction and intelligent analysis.

CN115761252BActive Publication Date: 2026-05-29CHINA NAT PETROLEUM CORP +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA NAT PETROLEUM CORP
Filing Date
2021-08-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies suffer from information loss and noise misidentification issues when sliding sampling at weld edges, affecting the accuracy of weld edge feature extraction.

Method used

After grayscale processing and contrast enhancement, edge feature maps are obtained using the Sobel edge detection method. Through grayscale mapping and welding noise elimination, height compensation and adjustment are performed by combining the geometric relationship between the weld edge position and the sliding window sampling frame to ensure complete acquisition of edge information.

Benefits of technology

It improves the sampling accuracy of weld seam edges, reduces noise interference, enhances the accuracy of feature extraction, provides high-quality edge feature maps for subsequent artificial intelligence recognition, and improves recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0003234781820000051
    Figure BDA0003234781820000051
  • Figure BDA0003234781820000052
    Figure BDA0003234781820000052
  • Figure BDA0003234781820000053
    Figure BDA0003234781820000053
Patent Text Reader

Abstract

The application discloses a kind of weld image preprocessing methods for improving edge sampling precision, belong to computer image processing and artificial intelligence field.It includes: step one, weld image is carried out gray processing and contrast enhancement, as enhanced picture;Edge detection is carried out to enhanced picture, and edge feature map is obtained;Step two, the edge feature map obtained in step one is carried out gray mapping and weld material noise elimination, and edge feature binary graph is obtained;Step three, based on the geometric relation of weld edge position and sliding window sampling frame, the height of weld photo is adaptively adjusted, and the complete collection of edge information is realized when sliding window sampling is carried out.The method is suitable for computer intelligent edge recognition and macro parameter analysis of steel pipe double-sided submerged arc weld, and the complete collection of edge information can be realized when superpixel sampling is carried out, and the sampling precision of weld edge in sliding window sampling process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer image processing and artificial intelligence, and relates to a method for preprocessing weld seam images to improve edge sampling accuracy. Background Technology

[0002] Oil and gas pipelines are generally made of submerged arc welded steel pipes. The welding quality of the submerged arc weld is directly related to the safe operation of the pipeline. Defects that may exist in the weld will affect the operational safety of the pipeline and create potential safety hazards. The welding quality of the weld can be characterized by its macroscopic parameters. For double-sided submerged arc welds, the macroscopic parameters mainly include weld height, weld width, weld deviation, and penetration depth. Standards such as API 5L-2018 "Steel Pipelines" and GB / T 9711-2011 "Steel Pipes for Oil and Gas Industry Pipeline Transportation" have specified the calculation methods for these parameters.

[0003] Previously, macroscopic parameters of double-sided submerged arc welds (DAWs) in steel pipes were mainly obtained through manual calculations based on standards after collecting photographs. In recent years, with the development of computer image processing technology and artificial intelligence (AI), the analysis of macroscopic parameters of DAWs has also begun to undergo an "intelligent" process. Before calculating macroscopic parameters, it is necessary to sample and identify the features of the weld edge. The geometry and weld structure of DAWs are complex and diverse. To improve accuracy, local sampling can be used to collect information from the original image. Sliding window sampling is a simple and effective method. This method uses a small sampling window to slide along the weld image at a certain step size and captures the image information within the window as the sampling result. After the sampling window traverses the entire image, the original image is transformed into a series of discrete sampling patches for further feature extraction. The AI ​​model or image processing algorithm then identifies the features contained in each sampling patch, achieving the extraction of the entire weld edge features. Due to the different scales of DAWs and the varying distances between the edge feature regions and the image edges, incomplete sampling at the edge positions is prone to occur during sliding window sampling, leading to the loss of local feature information. In addition, image quality, weld material structure, and heat-affected zone of the base material can easily interfere with edge feature extraction, mainly resulting in noise and misidentification.

[0004] To reduce noise and misidentification, preprocessing of the original weld image is necessary. To address this issue, Xu Hao et al., in their paper "Research on Weld Image Recognition Preprocessing Based on Machine Vision," proposed a weld centerline image preprocessing method based on an improved dark channel prior to extract a clear weld centerline and avoid deviations during the welding process by the welding robot. However, this method is not specifically designed for edge extraction and macroscopic parameter calculation of double-sided submerged arc welds, nor is it intended to improve the sampling accuracy of weld edges during sliding window sampling. Summary of the Invention

[0005] To overcome the shortcomings of the existing technology and solve the problems of edge sliding sampling information loss, noise and misidentification in the extraction of edge features of double-sided submerged arc welds of steel pipes by computer image processing or artificial intelligence algorithms, the present invention aims to provide a weld image preprocessing method to improve edge sampling accuracy. This method is suitable for computer intelligent edge recognition and macroscopic parameter analysis of double-sided submerged arc welds of steel pipes. This method can realize the complete acquisition of edge information during sliding window sampling, and improve the sampling accuracy of weld edges during the sliding window sampling process.

[0006] To achieve the above objectives, the present invention employs the following technical solution:

[0007] This invention discloses a weld seam image preprocessing method to improve edge sampling accuracy, comprising the following steps:

[0008] Step 1: Perform grayscale processing and contrast enhancement on the weld image to obtain the enhanced image; perform edge detection on the enhanced image to obtain an edge feature map; Step 2: Perform grayscale mapping and welding material noise removal on the edge feature map obtained in Step 1 to obtain a binary edge feature map; Step 3: Based on the geometric relationship between the weld edge position and the sliding window sampling frame, adaptively adjust the height of the weld image on the binary edge feature map obtained in Step 2 to achieve complete acquisition of edge information during sliding window sampling.

[0009] Preferably, in step one, edge detection is performed on the weld image to obtain an edge feature map, which includes the following steps: grayscale processing and contrast enhancement are performed on the weld image photo to be processed to obtain an enhanced image; edge detection is performed on the enhanced image using the Sobel edge detection method to obtain an edge feature map.

[0010] Preferably, in step two, grayscale mapping and welding noise removal are performed on the edge feature map obtained in step one to obtain a binary edge feature map. This includes the following steps: calculating the grayscale distribution function of the enhanced image obtained in step one, and determining the specified level quantile of the grayscale distribution function; based on the intensity distribution of the Sobel edge detection values, and according to the detection value distribution function of the pixels in the edge feature map, determining the specified level quantile of the Sobel edge detection values; performing grayscale mapping on the edge feature map obtained in step one according to the obtained specified level quantile to obtain a mapped grayscale map; performing pixel subtraction on the obtained mapped grayscale map and the enhanced image obtained in step one to obtain an edge feature map; and performing grayscale statistics and binarization on the obtained edge feature map to obtain a binary edge feature map.

[0011] More preferably, the level quantiles of the gray-scale distribution function at 0.1, 0.5, and 0.9 are determined.

[0012] More preferably, the level quantiles of the Sobel edge detection values ​​at 0.5 and 0.99 are determined.

[0013] More preferably, after subtracting the original grayscale image from the edge grayscale image by pixels, binarization is performed using a grayscale quantile of 0.6 as the threshold to obtain a high-purity edge binary image.

[0014] Preferably, grayscale mapping is performed on the edge feature map obtained in step one. The specific operation includes mapping the detection value of each pixel in the edge feature map to a grayscale space of 0 to 255.

[0015] Preferably, in step three, the edge feature binary image obtained in step two is subjected to height compensation and adaptive adjustment of the weld photo height based on the geometric relationship between the weld edge position and the sliding window sampling frame. This includes the following steps: establishing a pixel coordinate system and converting the pixel row and column indices into two-dimensional coordinates; obtaining the highest and lowest pixel coordinates of the weld based on the edge feature binary image, and calculating the height adjustment amount based on the photo height; and zeroing or cropping the original image in the height direction based on the height adjustment amount.

[0016] Compared with the prior art, the present invention has the following beneficial effects:

[0017] This invention discloses a weld image preprocessing method to improve edge sampling accuracy. Based on image processing technology, it preprocesses acquired photographs of double-sided submerged arc welds on steel pipes. The image height is dynamically adjusted according to the relationship between the photograph size and the position of the weld structure within the photograph, avoiding the loss of image edge information during superpixel sampling in feature extraction and improving the integrity of the image edge region in the feature extraction results. The resulting edge grayscale image can further distinguish the artificial intelligence recognition results, improving recognition accuracy and providing a foundation for obtaining high-quality weld edge feature maps and further intelligent analysis of weld parameters. Attached Figure Description

[0018] Figure 1 This is a flowchart of the weld image preprocessing method for improving edge sampling accuracy according to the present invention;

[0019] Figure 2 This is a schematic diagram of the weld seam pixel coordinate system;

[0020] Figure 3 This is a comparison chart of the sliding sampling effect before and after adaptive padding of the image;

[0021] Figure 4 This is a Sobel edge detection result image;

[0022] Figure 5 This is a grayscale image of the weld after grayscale mapping processing;

[0023] Figure 6 This is a comparison image between the input image and the preprocessed output image; where (a) is the input image and (b) is the output image. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] A method for preprocessing weld seam images to improve edge sampling accuracy, the process of which is as follows: Figure 1 As shown.

[0027] The processing method mainly includes the following steps:

[0028] Step 1: Perform grayscale conversion and contrast enhancement on the weld seam image to obtain the enhanced image; perform edge detection on the enhanced image to obtain edge feature maps. The grayscale conversion and contrast enhancement of the weld seam image to be processed makes the difference between the weld material and the base material more obvious, denoted as [missing information]. 0 Image I, with width W0 and height H0 respectively, is the enhanced image. The Sobel edge detection method is used to detect edges in the enhanced image, yielding an edge feature map, denoted as . 0 The calculation process of G. Sobel edge detection method is shown in equations (1) to (3):

[0029]

[0030]

[0031]

[0032] in, Represents convolution. 0 G ij Edge feature map 0 The detection value of each pixel in G, where W1 and H1 are the width and height of the edge feature map, respectively.

[0033] Step 2: Perform grayscale mapping and welding noise removal on the edge feature map obtained in Step 1 to obtain a binary edge feature map;

[0034] Includes: calculating the enhanced image obtained in step one. 0 The gray distribution function of I, g( 0 I) Calculate the specified level quantile of the grayscale distribution function; based on the intensity distribution of the Sobel edge detection values, calculate the specified level quantile of the Sobel edge detection values ​​according to the detection value distribution function of each pixel in the edge feature map; based on the obtained specified level quantile, process the edge feature map obtained in step one. 0 G is subjected to grayscale mapping to obtain a mapped grayscale image. The obtained mapped grayscale image is then subtracted from the enhanced image obtained in step one by pixel subtraction to obtain a high-purity edge feature map. The obtained high-purity edge feature map is then subjected to grayscale statistics and binarization to obtain a binary edge feature map; this achieves the noise elimination processing of welding materials.

[0035] Specifically, calculation 0 The gray distribution function of I, g( 0 I) Find its 0.1, 0.5 and 0.9 quantiles g. 0.1 ( 0 I), g 0.5 ( 0 I) and g 0.9 ( 0 I). Based on the above three quantiles, the edge feature map 0 G performs grayscale mapping, converting the detection value of each pixel in the edge feature map. 0 G ij Mapped to a grayscale space of 0 to 255.

[0036] The specific steps of grayscale mapping are as follows: a) Calculate the detection value of each pixel in the edge feature map. 0 G ij Distribution function F( 0 G), find its 0.5 and 0.99 quantiles F. 0.5 ( 0 G) and F 0.99 ( 0 G). Calculate edge feature map 0 Maximum detection value of G0 G max b) According to g 0.1 ( 0 I), g 0.5 ( 0 I), g 0.9 ( 0 I) and 0 G max Calculate according to formula (4) 0 The mapped grayscale value of each detected value in G. In equation (4) 1 G ij To map grayscale, 1 G is 0 The grayscale mapping of G.

[0037] Specifically, 1 G and I0 are subtracted by pixels according to equation (5) to obtain the edge feature map. 2 G.

[0038]

[0039]

[0040] In equation (5), 0 I ij for 0 The grayscale value of each pixel in I. 2 G performs grayscale statistics, and selects the quantile of a certain level (choose according to the actual contrast of the weld photo, a value of 0.5 to 0.8 is recommended) as the threshold. 2 G is binarized to obtain a high-purity binary image of edge features. 3 G has a width of W3 and a height of H3. 3 G can serve as a guiding feature map for artificial intelligence image recognition models, guiding the AI ​​image recognition models to distinguish recognition results and further improve accuracy.

[0041] Step 3: Based on the edge feature binary map obtained in Step 2, and based on the geometric relationship between the weld edge position and the sliding window sampling frame, calculate the height completion amount of the image, perform height compensation (cropping) on ​​the original image and adaptive adjustment of the height of the weld image photo, so as to achieve complete acquisition of edge information during sliding window sampling.

[0042] This includes: establishing a pixel coordinate system and converting pixel row and column indices into two-dimensional coordinates; obtaining the highest and lowest pixel coordinates of the weld seam from the edge binary image and calculating the height adjustment based on the image height; and padding or cropping the original image in the height direction based on the height adjustment.

[0043] Specifically, using high-purity edge feature binary images 3A coordinate system is established with the bottom left corner of G as the origin, the width as the x-axis, and the height as the y-axis. The pixel index of each edge feature point is converted into pixel coordinates (u, v), as follows: Figure 2 As shown. The distribution of the x-coordinates of all feature point pixels is statistically analyzed, and their average value u is calculated. m Filter out those located in [u m -Δu,u m After calculating the maximum value of the pixel ordinate v of the edge feature points within the range of +Δu], the maximum value of the pixel ordinate is calculated. max and minimum value v min The value of Δu here depends on the image size and the position of the weld area in the image.

[0044] According to v min v max H3 and sampling width W S Determine the enhanced image obtained in step one. 0 The height adjustment amount of I is illustrated in the diagram below. Figure 3 As shown. By Figure 3 It can be seen that the top fill amount Δv of the image top The following relationship should be satisfied:

[0045] H3+Δv top -v max =S+W s (6) Where S is the superpixel sampling step size. Calculate according to equation (6). 0 The top fill amount is

[0046] Δv top =F[S+W s +v max -H3] (7) where F[·] is the floor function. Similarly, we can obtain 0 The bottom filling amount is

[0047] Δv bott =S+W s -v min (8)

[0048] In the formula, according to Δv top and Δv bott right 0 Fill both ends of I, when Δv to or Δv bott A value less than 0 indicates cropping. The fill (cropping) matrix can be represented as follows:

[0049]

[0050] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:

[0051] Example

[0052] The preprocessing of photographs of double-sided submerged arc welds on a steel pipe using the technology of this invention involves the following steps:

[0053] Step 1: Edge detection of weld photos to obtain edge feature maps.

[0054] The image to be processed is converted to grayscale and its contrast is enhanced to make the difference between the welding material and the base material more obvious. This is denoted as I0, and its width × height is 710 × 652 pixels. 2 The Sobel edge detection method is used to perform edge detection on the enhanced image, resulting in an edge feature map, denoted as . 0 G, its width × height is 710 × 652 pixels 2 ,like Figure 4 As shown.

[0055] Step 2: Perform grayscale mapping and welding noise removal on the edge feature map obtained in Step 1 to obtain a binary edge feature map;

[0056] calculate 0 The gray distribution function of I, g( 0 I) The 0.1, 0.5, and 0.9 quantiles are found to be 15.61, 171.73, and 239.39, respectively. Based on these three quantiles... 0 G performs grayscale mapping, 0 G ij Mapping to a grayscale space of 0–255. The specific steps of grayscale mapping are as follows: a) Calculate 0 G ij Distribution function F( 0 Given G), find its 0.5 and 0.99 quantiles to be 33.3 and 308.74, respectively. Calculate... 0 The maximum detection value of G is 1254; b) Calculate according to formula (4) 0 The mapped grayscale value of each detected value in G is obtained. 0 G's mapping grayscale image 1 G. will 1 G and 0 I perform pixel subtraction according to equation (5) to obtain the edge feature map. 2 G. To 2 G is subjected to grayscale statistics, and the 0.6 level quantile is used as the threshold. 2 G is binarized to obtain a binary map of edge features. 3 G, its width × height is 708 × 650 pixels. 2 ,like Figure 5 As shown.

[0057] Step 3: Based on the edge feature binary map obtained in Step 2 and the geometric relationship of the superpixel sampling box, calculate the height completion amount of the image, perform height compensation (cropping) on ​​the original image and adaptive adjustment of the height of the weld seam photo, so as to achieve complete acquisition of edge information during superpixel sampling.

[0058] by 3 A coordinate system is established with the bottom left corner of node G as the origin, the width as the x-axis, and the height as the y-axis. The pixel index of each edge feature point is converted to pixel coordinates (u, v). The distribution of the x-coordinates of all feature points is statistically analyzed, and their average value is calculated to be 354.5. Edge feature points located within the range [354.5-150, 354.5+150] are selected, and their maximum and minimum y-coordinate values ​​are calculated to be 620 and 34, respectively. Let W... S =32, and the top and bottom height adjustment amounts of the input image are calculated to be 44 and 22 respectively according to equations (6) to (8). Based on the height adjustment amounts, a 708×44 matrix of zero elements is filled at the top of the input image; a 708×22 matrix of zero elements is filled at the bottom of the input image to obtain the preprocessed output result, as shown below. Figure 6 As shown.

[0059] In summary, this invention proposes a weld image preprocessing method to improve edge sampling accuracy in the sliding window sampling process of computer-aided intelligent feature extraction of double-sided submerged arc welds in steel pipes. This method first performs edge detection on the weld image to obtain an edge feature map; then, it performs grayscale mapping on the edge feature map, transforming it into a mapped grayscale map. Pixel subtraction is performed between the mapped grayscale map and the original image to obtain a high-purity edge feature map; grayscale statistics and binarization are then performed on the obtained high-purity edge feature map to obtain a binary edge feature map; finally, the height completion amount of the image is calculated based on the geometric relationship between the binary edge feature map and the superpixel sampling box, and the original image is height-compensated (cropped) to achieve complete edge information acquisition during superpixel sampling.

[0060] The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.

Claims

1. A method for preprocessing weld seam images to improve edge sampling accuracy, characterized in that, Includes the following steps: Step 1: Perform grayscale conversion and contrast enhancement on the weld image to obtain the enhanced image; Edge detection is performed on the enhanced image to obtain edge feature maps. 0 G; Step 2: Process the edge feature map obtained in Step 1. 0 G performs grayscale mapping and welding noise removal to obtain a binary image of edge features; In step two, the edge feature map obtained in step one is processed. 0 G performs grayscale mapping and solder noise removal to obtain a binary image of edge features, including the following steps: Step 1 calculates the grayscale distribution function of the enhanced image and determines the specified level quantile of the grayscale distribution function; based on the intensity distribution of Sobel edge detection values, and according to the edge feature map... 0 The distribution function of the detected pixel values ​​in G is used to calculate the specified level quantile of the Sobel edge detection values; based on the obtained specified level quantile, the edge feature map obtained in step one is processed. 0 G is subjected to grayscale mapping to obtain a mapped grayscale image; the obtained mapped grayscale image is then subtracted from the enhanced image obtained in step one by pixel to obtain the edge feature map. 2 G, for the obtained edge feature map 2 G is subjected to grayscale statistics and binarization to obtain a binary image of edge features; Step 3: Based on the geometric relationship between the weld edge position and the sliding window sampling frame, the height of the weld image is adaptively adjusted to achieve complete acquisition of edge information during sliding window sampling. In step three, the edge feature binary image obtained in step two is used to perform height compensation and adaptive adjustment of the weld image height based on the geometric relationship between the weld edge position and the sliding window sampling frame. This includes the following steps: Establish a pixel coordinate system and convert the pixel row and column indices into two-dimensional coordinates; The highest and lowest pixel coordinates of the weld are obtained from the binary image of the edge features, and the height adjustment amount is calculated based on the height of the weld image. The weld image is zeroed or cropped in the height direction based on the height adjustment amount.

2. The weld image preprocessing method for improving edge sampling accuracy according to claim 1, characterized in that, In step one, edge detection is performed on the weld image to obtain edge feature maps. 0 G includes the following steps: using the Sobel edge detection method to detect edges in the enhanced image and obtain edge feature maps. 0 G.

3. The weld image preprocessing method for improving edge sampling accuracy according to claim 1, characterized in that, Find the level quantiles of the gray-scale distribution function at 0.1, 0.5, and 0.

9.

4. The weld image preprocessing method for improving edge sampling accuracy according to claim 1, characterized in that, Find the level quantiles of the Sobel edge detection values ​​at 0.5 and 0.

99.

5. The weld image preprocessing method for improving edge sampling accuracy according to claim 1, characterized in that, After subtracting the original grayscale image from the edge grayscale image by pixels, the image is binarized with a threshold of 0.6 grayscale quantile to obtain a high-purity edge binary image.

6. The weld image preprocessing method for improving edge sampling accuracy according to claim 1, characterized in that, The edge feature map obtained in step one 0 G performs grayscale mapping, and the specific operations include: mapping edge feature maps... 0 The detection value of each pixel in G is mapped to a grayscale space of 0~255.