A method for mapping weld defect areas based on circle positioning
By using a circular positioning method with a dual-camera system, combining 2D and 3D cameras for weld defect detection, the problem of low detection accuracy with a single camera is solved, and high-precision defect area mapping and identification are achieved.
Patent Information
- Application Number
- CN202210167172.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-23
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-02-23
AI Technical Summary
In the existing technology, the detection of weld defects by a single camera or multiple cameras has the problem of low accuracy, especially due to the pixel ratio error of different cameras.
A dual-camera system is adopted, using a 2D camera for initial positioning and a 3D camera for defect area mapping. The detection accuracy is improved through circle fitting and feature extraction, including image preprocessing, circle center coordinate calculation and feature value judgment.
It achieves accurate detection of weld defects, and improves the accuracy of defect identification through mapping and verification processing of a dual-camera system.
Smart Images

Figure CN114581385B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of defect detection, and in particular to a welding seam defect region mapping method based on circle positioning. BACKGROUND
[0002] With the development of computer technology and the wide application of computer vision principles, the use of computer image processing technology for real-time positioning of products in industrial automation is becoming increasingly popular. In industry and manufacturing, there are a large number of tasks such as size detection and defect detection of products. The introduction of automatic detection methods of machine vision can greatly reduce the detection labor intensity of workers, has high detection precision and speed, and can effectively ensure the qualification rate of products. However, the use of single camera imaging for defect detection lacks review processing, and some defects in reality cannot be detected on a single image, often relying on multiple cameras to collect different images for detection; and for the same product, there is a certain proportion error in the pixel proportion of different camera imaging, resulting in low detection accuracy. SUMMARY
[0003] The present application solves the problem of low accuracy in the prior art whether using a single camera or multiple cameras for defect detection, and proposes a welding seam defect region mapping method based on circle positioning, which uses double cameras for detection and can accurately map different imaging regions to each other, thereby improving the accuracy of welding seam defect detection.
[0004] To achieve the above object, the following technical scheme is proposed:
[0005] A welding seam defect region mapping method based on circle positioning, comprising the following steps:
[0006] S1, a plurality of 2D images and 3D point cloud images of the welding seam region with defects are collected to form an image data set, and the image data set is used to train the defect region mapping angle error range and distance pixel error range;
[0007] S2, image preprocessing is performed on the 2D image and 3D point cloud image to be detected to obtain effective 2D image and 3D point cloud image;
[0008] S3, circle fitting processing is performed on the effective 2D image and 3D point cloud image to obtain the center coordinates and radius of the effective 2D image and 3D point cloud image;
[0009] S4, the center coordinates of the suspected defect region on the 2D image are obtained, and the angle Angle between the suspected defect center and the 2D image center and the distance between the suspected defect center and the 2D image center are calculated;
[0010] S5, the center coordinates of the circle, the radius and the angle of the 3D point cloud image are obtained, and the initial positioning point of the suspected defect of the 3D point cloud image is obtained;
[0011] S6, the suspected defect region of the 3D point cloud image is obtained according to the angle error range, the distance pixel error range and the initial positioning point of the defect region mapping;
[0012] S7, the feature value of the suspected defect region of the 3D point cloud image is extracted, and it is judged whether the feature value is greater than the set threshold value, if yes, the product is judged as a failed product, if not, the product is judged as a qualified product.
[0013] In the present application, two cameras are used to detect the weld defects, which are 2D and 3D cameras, the 2D camera collects 2D images, and the initial positioning of the suspected defects is processed, and then the 3D point cloud image collected by the 3D camera is used for defect region mapping processing, and the suspected defect region corresponding to the 3D point cloud image is obtained, and then a series of defect features are extracted in the suspected defect region of the 3D point cloud image, and the defect is judged through the series of defect features, and the suspected defect rechecking processing is carried out, compared with the imaging of a single camera for defect detection, the accuracy of defect recognition is greatly improved.
[0014] As preferred, the S1 specifically comprises the following steps:
[0015] S101, a plurality of 2D images and 3D point cloud images of weld regions with defects are collected to form an image data set;
[0016] S102, the center coordinates of the defect region are obtained by a binary algorithm;
[0017] S103, the least square method is used to fit the circle in the 2D image and the 3D point cloud image, and the center coordinates and the radius are obtained;
[0018] S104, the angle and the distance between the center of the 2D image and the center of the 3D point cloud image are calculated respectively;
[0019] S105, the angle and the distance are differentially processed to obtain the angle error range and the distance pixel error range of the defect region mapping.
[0020] As preferred, the S2 specifically comprises one or more of the following steps: enhancement processing, image denoising processing, image segmentation processing and image difference processing of the original image.
[0021] As preferred, the S3 specifically comprises the following steps: the effective 2D image and the 3D point cloud image are subjected to circle fitting processing based on the Hough transformation principle, and the center and the radius of the effective 2D image and the 3D point cloud image are obtained.
[0022] As preferred, the S4 specifically comprises the following steps:
[0023] The suspected defect region is obtained by a binary algorithm, a suspected defect region center and an image center are connected to form a line segment L0, the line segment L0 and a horizontal diameter line L1 passing through the center form an angle Angle, and the length of the line segment L0 is the distance d of the suspected defect center and the 2D image center.
[0024] As preferred, the angle Angle is calculated according to the following formula:
[0025]
[0026] Wherein, h is the height of the defect center and the vertical line L0.
[0027] As preferred, the S5 specifically comprises the following steps:
[0028] The initial positioning point (x, y) of the suspected defect in the 3D point cloud image is calculated, wherein:
[0029] x = d1*cos(Angle);
[0030] y = d1*sin(Angle);
[0031] d1 is the distance of the suspected defect center and the 3D point cloud image center.
[0032] As preferred, the S6 specifically comprises the following steps:
[0033] Suppose that the defect region mapping angle error range is a0≤A≤a1, and the distance pixel error range is d0≤D≤d1;
[0034] The initial positioning point and the 3D point cloud image center are connected to obtain a straight line L2, according to the angle error range a0≤A≤a1, the straight line L2 is counterclockwise offset by an angle |a0| and clockwise offset by an angle a1 to obtain a preliminary angle region, according to the distance pixel range: d0≤D≤d1, the preliminary angle region is offset by d1 forward and |d0| backward along the direction of the straight line L2 to obtain the region of the suspected defect in the 3D point cloud image.
[0035] The present application has the advantages that the present application can solve the defect mapping problem of different camera images of the same product, and the mapping can be used for rechecking in different images, thereby improving the correctness of defect determination. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 It is a whole flow schematic diagram of the embodiment;
[0037] Figure 2 It is an angle Angle schematic diagram in the 2D image of the embodiment;
[0038] Figure 3 Diagram for solving the angle of the 2D image of the embodiment;
[0039] Figure 4 Primary positioning of the suspected defect of the 3D point cloud image of the embodiment;
[0040] Figure 5 Preliminary angle area of the 3D point cloud image of the embodiment;
[0041] Figure 6 Area of the suspected defect of the 3D point cloud image of the embodiment. DETAILED DESCRIPTION
[0042] Embodiment:
[0043] The embodiment provides a welding defect area mapping method based on circle positioning, referring to Figure 1 , comprising the following steps:
[0044] S1, collect 2D images and 3D point cloud images, and analyze the angle between the defect area and the center coordinates of the circle in the 2D image and the 3D point cloud image, and other related characteristics, to obtain the range of defect area mapping angle error; first, use a 2D camera and a 3D camera to collect the region to be identified, collect 1,000 2D images and 3D point cloud images with defects, to form an image dataset, and the defect features in the images are as obvious as possible. The center coordinates of the defect area are obtained by a binary algorithm, and the least square circle fitting method is used to fit the circle in these images to obtain the center coordinates and the radius, and the angles between the defect center and the center of the circle in the 2D image and the 3D point cloud image are calculated respectively. The distance is calculated based on the Euclidean distance, and the formula is as follows. The two angles and the distance are differentially processed, and the differential results of the two angles and the distance are recorded and analyzed to obtain the angle error A range: a0≤A≤a1, the distance pixel range: d0≤D≤d1, the angle and distance pixel error value range, the unit is radian, pixel respectively, and reference Table 1;
[0045]
[0046] Wherein x0, y0, x1, y1 are the suspected defect center coordinates and the image center coordinates respectively.
[0047] Table 1 Angle error value range
[0048]
[0049]
[0050] S2, the collected 2D image, 3D point cloud image is pretreated, and effective 2D, 3D point cloud image is obtained;One or more of the following is performed on the original image: enhancement processing, image denoising processing, image segmentation processing and image difference processing;
[0051] S3, the effective 2D image, 3D point cloud image is processed based on the principle of Hough transformation circle fitting, and the center and radius of the two images are obtained;
[0052] S4, the center coordinates of the suspected defect area on the 2D image are obtained, the angle Angle between the suspected defect center and the 2D image center and the distance d between the suspected defect center and the 2D image center are calculated;The suspected defect area is obtained by binary algorithm, and the suspected defect area center and the image center are connected to form a straight line L0, and the straight line L0 and the horizontal diameter line L1 passing through the center form an angle Angle, as shown in Figure 2 The angle Angle can be obtained by inverse sine function, and the formula is as follows, wherein d is the distance between the suspected defect center and the 2D image center, h is the height of the defect center and the vertical line of the straight line L0, and the units are image pixels, as shown in Figure 3
[0053]
[0054] S5, according to the 3D point cloud image center coordinates, radius and angle Angle, the initial positioning of the 3D point cloud image suspected defect is obtained;The initial positioning of the 3D point cloud image suspected defect is a point (x, y), and the coordinates x and y can be obtained by sine formula and cosine formula, and the formulas are as follows, wherein d1 is the distance between the suspected defect center and the 3D point cloud image center, which can be obtained by multiplying the distance d between the suspected defect center and the 2D image center and the pixel ratio of the two images, as shown in Figure 4
[0055] x=d1*cos(Angle)
[0056] y=d1*sin(Angle)
[0057] S6, through the range of defect area mapping angle error, the numerical range of distance pixel error and the initial positioning of the 3D point cloud image suspected defect, the region of the 3D point cloud image suspected defect is obtained;The straight line L2 is obtained by connecting the initial positioning (x, y) of the 3D point cloud image suspected defect and the 3D point cloud image center, according to the angle error range a0≤A≤a1, the straight line L2 is offset by angle |a0| counterclockwise and angle a1 clockwise, to obtain the preliminary angle region, as shown in Figure 5 According to the distance pixel range: d0≤D≤d1, the preliminary angle region is offset by d1 in the direction of straight line L2, and offset by |d0| backward, to obtain the region of the 3D point cloud image suspected defect, as shown in Figure 6 shown;
[0058] S7, extracting point cloud depth, area and other characteristic values of the suspected defect region of the 3D point cloud image, judging whether the characteristic values are greater than the set threshold value, if yes, the product is judged as a failed product, if not, the product is judged as a passed product.
Claims
1. A method for mapping a weld defect area based on circle positioning, characterized in that, The method comprises the following steps: S1, collecting a plurality of 2D images and 3D point cloud images of a weld area with defects to form an image data set, and training the image data set to obtain a defect area mapping angle error range and a distance pixel error range; S2, performing image preprocessing on the 2D image and the 3D point cloud image to be measured to obtain an effective 2D image and a 3D point cloud image; S3, performing circle fitting processing on the effective 2D image and the 3D point cloud image to obtain the center coordinates and the radius of the effective 2D image and the 3D point cloud image; S4, obtaining the center coordinates of a suspected defect area on the 2D image, calculating the angle between the suspected defect center and the 2D image center and the distance between the suspected defect center and the 2D image center; S5, obtaining the initial positioning point of the suspected defect of the 3D point cloud image according to the center coordinates, the radius and the angle of the 3D point cloud image; S6, obtaining the region of the suspected defect of the 3D point cloud image according to the defect area mapping angle error range, the distance pixel error range and the initial positioning point; S7, extracting the feature value of the suspected defect region of the 3D point cloud image, and judging whether the feature value is greater than a set threshold value, if yes, the product is judged as a failed product, and if not, the product is judged as a qualified product.
2. The method of claim 1, wherein the method is characterized by, The S1 specifically comprises the following steps: S101, collecting a plurality of 2D images and 3D point cloud images of a weld area with defects to form an image data set; S102, obtaining the center coordinates of the defect area by a binary algorithm; S103, fitting the circles in the 2D image and the 3D point cloud image by using a least square circle fitting method to obtain the center coordinates and the radius; S104, calculating the angle between the center of the defect area and the center of the circle and the distance between the center of the defect area and the center of the circle of the 2D image and the 3D point cloud image respectively; S105, performing difference processing on the angle and the distance to obtain the defect area mapping angle error range and the distance pixel error range.
3. The method of claim 1, wherein the method is characterized by: The S2 specifically comprises the following steps: one or more of the following: enhancement processing, image denoising processing, image segmentation processing and image difference processing on the original image.
4. The method of claim 1, wherein the method is characterized by, The S3 specifically comprises the following steps: performing circle fitting processing on the effective 2D image and the 3D point cloud image based on the Hough transformation principle to obtain the center and the radius of the effective 2D image and the 3D point cloud image.
5. The method of claim 1, wherein the method is characterized by: The S4 specifically comprises the following steps: Obtaining the region of the suspected defect by a binary algorithm, connecting the center of the suspected defect region and the center of the image to form a line segment L0, the line segment L0 and the horizontal diameter line L1 passing through the center of the circle form an angle Angle, and the length of the line segment L0 is the distance d between the suspected defect center and the center of the 2D image.
6. A circular positioning based weld defect area mapping method according to claim 5, characterized in that, The angle Angle is calculated according to the following formula: Wherein, h is the height of the defect center and the vertical line of L0.
7. A circular positioning based weld defect area mapping method according to claim 5, characterized in that, The S5 specifically comprises the following steps: Calculating the initial positioning point (x, y) of the suspected defect of the 3D point cloud image, wherein: x=d1*cos(Angle); y=d1*sin(Angle); d1 is the distance between the suspected defect center and the center of the 3D point cloud image.
8. The method of claim 1, wherein, The S6 specifically comprises the following steps: The defect area mapping angle error range is a0≤A≤a1; the distance pixel error range is d0≤D≤d1; The straight line L2 is obtained by connecting the initial positioning point and the center of the 3D point cloud image circle, and the preliminary angle region is obtained by offsetting the straight line L2 counterclockwise by an angle |a0| and clockwise by an angle a1 according to the included angle error range a0≤A≤a1; and the region of the suspected defect of the 3D point cloud image is obtained by offsetting the preliminary angle region forward by d1 and backward by |d0| along the direction of the straight line L2 according to the distance pixel range d0≤D≤d1.
Citation Information
Patent Citations
Wind power tower welding seam defect detection device and method based on machine vision
CN111551565A
Steel rolling plate surface defect detection method
CN113393426A