A visual recognition-based circular weld defect detection method

By using visual recognition technology combined with two-dimensional and three-dimensional image processing, rapid and accurate detection of weld defects in lithium batteries has been achieved. This solves the problem of significant human influence, improves detection speed and accuracy, and simplifies data storage.

CN115100127BActive Publication Date: 2025-11-21HANGZHOU ANMAISHENG INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210664452.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-13
Publication Date
2025-11-21
Estimated Expiration
2042-06-13

AI Technical Summary

Technical Problem

The inspection of lithium battery welds is greatly affected by human factors, resulting in slow inspection speed, low accuracy, and difficulty in saving inspection data.

Method used

A vision-based recognition method is adopted, using an area scan camera to acquire two-dimensional images of the weld and a three-dimensional line scan camera to acquire three-dimensional images of the weld. Weld defects are identified by two-dimensional and three-dimensional vision recognition algorithms, respectively, replacing manual inspection.

Benefits of technology

It achieves rapid and accurate weld defect detection, reduces the influence of human factors, has a detection speed of up to 0.5 seconds, an accuracy of 0.1 mm, good data stability, and is easy to save.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115100127B_ABST
    Figure CN115100127B_ABST
Patent Text Reader

Abstract

The application provides a kind of circular weld defect detection method based on visual identification, comprising the following steps: S1, obtains the two-dimensional image and three-dimensional image of circular weld;S2, based on two-dimensional visual identification algorithm, whether there is first class defect according to two-dimensional image, if yes, then S4 is carried out, if not, then S3 is carried out;S3, based on three-dimensional visual identification algorithm, whether there is second class defect according to three-dimensional image, if yes, then S4 is carried out, if not, then it is judged that circular weld is qualified;S4, it is judged that circular weld exists defect, and the corresponding defect type is output.The application uses area array camera to collect the two-dimensional image of weld, uses three-dimensional linear array camera to collect the three-dimensional image of weld, respectively two-dimensional image and three-dimensional image are processed by algorithm, corresponding defect detection result is obtained, instead of artificial detection, detection speed is fast, precision is high, while detection data stability is strong, data is saved simply, it is convenient to trace back.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of weld defect detection, and in particular to a circular weld defect detection method based on visual recognition. BACKGROUND

[0002] The current lithium battery weld detection is mainly based on manual visual inspection, supplemented by touch and caliper measurement to detect the weld size. The gap detection is mainly based on visual inspection, supplemented by feeler gauge detection, and the detection cycle of a single weld is about 2 seconds. The excess height hole protrusion is mainly based on visual inspection, supplemented by caliper measurement of depth, width and height, and the detection cycle of a single weld is about 2 seconds. The weld width defect, weld offset, discoloration and non-welding are currently detected by manual visual inspection supplemented by caliper measurement. The production line has a high production speed, and there are more than 100 welds per single weld detection, with a detection cycle of about 1 to 2 minutes. It is not possible to measure each weld by caliper. The current production line can effectively identify the defects of the welds with obvious defects through manual visual inspection, but it is difficult to effectively identify the defects of the welds with non-obvious defects. For example, the gap detection requires that the gap be between 0 and 0.3 mm to be qualified. When detecting the gap, the inspector needs to bend down and observe the gap at an angle, and continuously observe hundreds of gaps. This requires a high level of physical strength and concentration from the inspector. In summary, manual visual inspection is slow and has low detection accuracy. In addition, manual visual inspection is greatly affected by human factors, and the stability of the detection results is poor. It is difficult to save the detection data. SUMMARY

[0003] The present application solves the problem of the lithium battery weld detection being greatly affected by human factors, and proposes a circular weld defect detection method based on visual recognition. A two-dimensional image of the weld is collected using a face array camera, a three-dimensional image of the weld is collected using a three-dimensional line array camera, the two-dimensional image and the three-dimensional image are processed by algorithms respectively, and the corresponding defect detection results are obtained, replacing manual detection. The detection speed is fast, the accuracy is high, the detection data is stable, the data is easy to save, and the data is easy to trace.

[0004] To achieve the above-mentioned purpose, the following technical scheme is proposed:

[0005] A circular weld defect detection method based on visual recognition, comprising the following steps:

[0006] S1, acquiring a two-dimensional image and a three-dimensional image of a circular weld;

[0007] S2, judging whether there is a first type of defect based on a two-dimensional visual recognition algorithm according to the two-dimensional image, if yes, proceeding to S4, if no, proceeding to S3;

[0008] S3, judging whether there is a second type of defect based on a three-dimensional visual recognition algorithm according to the three-dimensional image, if yes, proceeding to S4, if no, determining that the circular weld is qualified;

[0009] S4, judging that the circular weld has defects and outputting corresponding defect types.

[0010] The method can detect defects of the circular weld, each weld detection beat can be controlled within 0.5 seconds, the detection speed is fast, the camera can meet the requirement of 0.1 mm detection precision after calibration by the calibration plate, the detection precision is high, the method is executed by the computer, the computer can work without sleep and fatigue, and the detection data stability is good, the picture data can be saved to the computer through the method, the data saving is simple, and data tracing in the later period is convenient. The weld machine vision detection can replace manual work and reduce labor cost.

[0011] As preferred, the first type of defects includes unweld defects, discoloration defects, welding offset defects and width defects, and the second type of defects includes gap defects, convex point defects, excess height defects and concave hole defects. The present application detects eight types of defects in combination with the disadvantages of manual visual inspection, respectively meets eight detection requirements, the detection results do not affect each other, and the stability of the detection data is ensured.

[0012] As preferred, the S2 specifically includes the following steps:

[0013] S201, pre-processing a two-dimensional image of the circular weld, and obtaining a weld outer contour line according to the pre-processed two-dimensional image;

[0014] S202, judging whether the weld outer contour line can be obtained, if not, performing S4 to judge and output that the circular weld has an unweld defect; if yes, the weld outer contour line encloses a weld outer contour area, a weld inner contour area is obtained from the weld outer contour area, a center hole area is extracted from the weld inner contour area, the weld outer contour area is subtracted from the weld inner contour area to obtain a weld area, and S203 is performed;

[0015] S203, performing discoloration detection on the weld area to judge whether there is a discoloration defect, if not, performing S204, and if yes, performing S4 to judge and output that the circular weld has a discoloration defect;

[0016] S204, judging whether the distance between the center of the weld outer contour line and the center of the center hole area is greater than a set value, if not, performing S205, and if yes, performing S4 to judge and output that the circular weld has a welding offset defect;

[0017] S205, using a polar coordinate transformation method of a region to expand the weld area into a rectangular area, obtaining a maximum width of the rectangular area, judging whether the maximum width is greater than an upper limit value, if yes, performing S4 to judge and output that the circular weld has a width defect, and if not, performing S3.

[0018] As preferred, the S201 specifically comprises the following steps:

[0019] Step 211, calculate the bright area in the two-dimensional image by using a dynamic threshold algorithm, select the maximum area of the bright area, and perform convex transformation on the maximum area to obtain a patch area;

[0020] Step 212, intercept the black circular ring in the patch area, locate the inner circular ring area and the outer circular ring area through the black circular ring, and convert the contour line of the inner circular ring area into a region type;

[0021] Step 213, use dynamic threshold segmentation to obtain the dark area in the inner circular ring, take the boundary of the obtained dark area, and perform circular fitting transformation on the boundary area to generate a fitting circle as the outer contour line of the weld, and the area surrounded by the outer contour line of the weld is the outer contour area of the weld;

[0022] Step 214, first take the dynamic threshold segmentation of the two-dimensional image of the circular weld to obtain the maximum bright area to obtain a partial inner contour area; perform template matching on the center hole of the two-dimensional image to obtain the center hole area of the circular weld; finally, take the union of the partial inner contour area and the center hole area to obtain the inner contour area of the weld;

[0023] Step 215, subtract the weld inner contour area obtained in step 214 from the weld outer contour area obtained in step 213 to obtain the weld area.

[0024] As preferred, the S203 specifically comprises the following steps:

[0025] Intercept the original color picture of the weld area, decompose the RGB three-channel image, respectively threshold segment the RGB three-channel image, set the threshold range and area range of blackening, when the RGB three-channel image is contained in the same area at the same time and the area meets the set range, the corresponding area is identified as a blackening area; count the blackening area, and judge whether the number of blackening areas is greater than or equal to 1, if yes, proceed to S4, judge and output that there is a discoloration defect, if not, proceed to S204.

[0026] As preferred, the S3 specifically comprises the following steps:

[0027] S301, pre-process the three-dimensional image of the circular weld, obtain the patch area according to the pre-processed three-dimensional image, determine the preliminary position of the weld and the position of the outer plane of the weld according to the patch area, and then level the three-dimensional image to obtain a leveled image;

[0028] S302, the height of the baffle plate around the center hole in the baffle plate area and the height of the pole plate inside the center hole are calculated, the height of the baffle plate is subtracted from the height of the pole plate, and then the thickness of the baffle plate is subtracted to obtain gap data, whether the gap data is greater than a set value is judged, if yes, S4 is performed, and it is judged and output that there is a gap defect, if not, S303 is entered;

[0029] S303, whether there is a convex point higher than a set value in the flat position outside is calculated, if yes, S4 is performed, and it is judged and output that there is a convex point defect, if not, S304 is performed;

[0030] S304, whether there is an area with a height greater than 1mm of the baffle plate plane in the preliminary position of the weld is calculated, if yes, S4 is performed, and it is judged and output that there is a residual height defect, if not, S305 is performed;

[0031] S305, whether there is an area lower than a set depth threshold of the baffle plate plane in the preliminary position of the weld is calculated, if yes, S4 is performed, and it is judged and output that there is a pit hole defect, if not, it is judged that the circular weld is qualified.

[0032] Preferably, the S301 specifically comprises the following steps:

[0033] S311, the bright area in the three-dimensional image is calculated by using a dynamic threshold algorithm, and the baffle plate area is located;

[0034] S312, the image height change data is obtained by taking the derivative of the graph in the baffle plate area, and the circular ring area in the baffle plate is located by threshold segmentation;

[0035] S313, the baffle plate hole position information and the height information of the hole inside the plane are obtained, and the baffle plate center hole position is located;

[0036] S314, the weld position and the flat position outside the weld are preliminarily located through the baffle plate hole position information and the circular ring area;

[0037] S315, the inclined three-dimensional image is adjusted to a horizontal position to obtain a leveled image.

[0038] The beneficial effects of the present application are:

[0039] 1, the present application combines the shortcomings of manual visual inspection, detects eight types of defects, respectively meets eight detection requirements, the detection results do not affect each other, and the stability of the detection data is ensured;

[0040] 2, the width measurement gap measurement, excess height measurement, pit hole measurement, welding deviation measurement, color change measurement, these detection items have no clear detection boundary, manual measurement of the edge of these detection items is difficult to be accurate; like the simplest welding deviation measurement, the starting point and the ending point are the centers of the contour circle, manual visual measurement is difficult to accurately position the center of the circle, only an approximate center of the circle can be estimated, the accuracy of the eccentricity data cannot be guaranteed. The present application uses a visual recognition algorithm to quantitatively measure, ensuring the accuracy of the width measurement, gap measurement, excess height measurement, pit hole measurement, welding deviation measurement, and color change measurement;

[0041] 3, data saving, computer storage data has a natural advantage over manual saving, from the data integrity, manual recording only records defect measurement data, qualified product data is too much to record, and there is no time to record. The computer records all the data, including the initial image, the calculation image, the calculation data, the production module code, the production time, etc., the data traceability is greatly improved. BRIEF DESCRIPTION OF DRAWINGS

[0042] Figure 1 is a method flowchart of the embodiment;

[0043] Figure 2 is a two-dimensional image patch region schematic diagram of the embodiment;

[0044] Figure 3 is a black ring schematic diagram of the embodiment;

[0045] Figure 4 is a schematic diagram of the outer contour line of the weld;

[0046] Figure 5 is a schematic diagram of the inner contour region of the weld;

[0047] Figure 6 is a schematic diagram of the center coordinates of the outer contour line of the weld and the center coordinates of the polar hole;

[0048] Figure 7 is a schematic diagram of the weld region of the embodiment;

[0049] Figure 8 is a three-dimensional image patch region schematic diagram of the embodiment;

[0050] Figure 9 is a schematic diagram of the outer contour line of the ring;

[0051] Figure 10 is a schematic diagram of the inner hole region of the embodiment;

[0052] Figure 11 is a schematic diagram of the ring region of the embodiment. DETAILED DESCRIPTION

[0053] Embodiment:

[0054] The embodiment provides a circular weld defect detection method based on visual recognition, referring to Figure 1 , comprising the following steps:

[0055] S1, acquiring a two-dimensional image and a three-dimensional image of the circular weld; a 2D camera shoots a 2D image of the weld, a 3D camera shoots a 3D image of the weld, and an algorithm program reads the 2D image and the 3D image;

[0056] S2, judging whether a first type of defect exists according to the two-dimensional image based on a two-dimensional visual recognition algorithm, if yes, performing S4, and if not, performing S3; the first type of defect includes an unwelded defect, a discoloration defect, a misalignment defect and a width defect.

[0057] S2 specifically comprises the following steps:

[0058] S201, pre-processing the two-dimensional image of the circular weld, acquiring a weld outer contour line according to the pre-processed two-dimensional image, the weld outer contour line surrounding a weld outer contour region, acquiring a weld inner contour region from the weld outer contour region, and extracting a center hole region from the weld inner contour region, and subtracting the weld inner contour region from the weld outer contour region to obtain a weld region; S201 specifically comprises the following steps:

[0059] S211, calculating a bright area in the two-dimensional image by using a dynamic threshold algorithm, selecting a maximum area of the bright area, performing convexity transformation on the maximum area to obtain a patch area; using a dynamic threshold in Halcon to calculate the bright area in the 2D image, selecting the maximum area, performing convexity transformation on the obtained maximum area, thereby obtaining the area where the patch is located, referring to the area framed by A in Figure 2 ;

[0060] S212, intercepting a black circular ring in the patch area, positioning to an inner circular ring region and an outer circular ring region through the black circular ring, and converting the contour line of the inner circular ring region into a region type;

[0061] S213, using dynamic threshold segmentation to acquire a dark area in the inner circular ring, taking the boundary of the obtained dark area, and performing circular fitting transformation on the boundary region to generate a fitting circle as the weld outer contour line, referring to Figure 4The outer contour line of the weld is shown in the middle C, and the area surrounded by the outer contour line of the weld is the outer contour area of the weld; specifically, the area of the gasket obtained by S212 is intercepted, and the black circular ring in the picture is matched by using the template matching function, so as to locate the circular ring area, and the contour line of the inner circular ring is converted into the area type. The inner circular ring area obtained is intercepted, and the dark area inside the inner circular ring is obtained by using the dynamic threshold method. The boundary of the obtained dark area is taken, and the boundary area is subjected to circular fitting transformation. The fitting circle is the outer contour line of the weld, and the center of the fitting circle is the center of the outer contour.

[0062] S214, first take the dynamic threshold segmentation of the two-dimensional image of the circular weld, take the largest bright area, and obtain the partial inner contour area; template matching is performed on the center hole of the two-dimensional image to obtain the center hole area of the circular weld; finally, the union of the partial inner contour area and the center hole area is taken to obtain the inner contour area of the weld, for reference Figure 5 The inner contour area of the weld is shown in the middle D. Specifically, the weld image is obtained by intercepting the image with the outer contour circle; first, take the dynamic threshold segmentation of the weld, take the largest bright area, and thus obtain the partial inner contour; then, template matching is performed on the center hole of the weld image to obtain the center hole area of the weld; finally, the union of the partial inner contour area and the center hole area is taken to obtain the inner contour area of the weld. The center coordinates of the pole hole are obtained

[0063] The center hole area obtained by S214 is eroded by 10 pixels, and the image in the center hole is obtained. Template matching is performed on the center hole image to match the pole hole area in the center hole image. The pole hole is a reverse-dipped circular truncated cone, and the side wall of the circular truncated cone is inclined. In the image, it is displayed as a black circular ring. The outer circular ring diameter of the pole hole is slightly smaller than that of the center hole. Sometimes the pole hole and the center hole are also eccentric. Therefore, after obtaining the pole hole by template matching, secondary matching needs to be performed according to the matching result. If the outer contour line of the pole hole is obtained by template matching, the center coordinates of the pole hole are obtained by fitting a circle to the outer contour line of the pole hole. If the template matching of the pole hole has no result, sub-pixel contour extraction is performed on the pole hole image. The first contour line with a length of 60 pixels to 500 pixels is selected. Then, the second contour line with a circular radius of 50 to 100 is selected by fitting a circle to the first contour line. Finally, the average gray scale of the inner edge region and the outer edge region of the second contour line is taken, and the third contour line with an inner edge average gray scale smaller than an outer edge average gray scale is selected. The third contour line is the outer contour line of the pole hole. The center coordinates of the third contour line, i.e., the center coordinates of the pole hole, are obtained by fitting a circle to the third contour line.

[0064] Step 215, subtract the inner contour area of the weld obtained in step 214 from the outer contour area of the weld obtained in step 213, to obtain the weld area, for reference Figure 7The area enclosed by the middle G is a weld area.

[0065] S202, if not, S4 is performed to determine and output that the circular weld has a non-welding defect; if yes, the weld outer contour line encloses a weld outer contour area, a weld inner contour area is obtained from the weld outer contour area, and a center hole area is extracted from the weld inner contour area, the weld area is obtained by subtracting the weld inner contour area from the weld outer contour area, and S203 is performed; specifically, the weld outer contour line obtained in S213 is counted, if the number of the weld outer contour line is 0, the non-welding detection report fails, and the two-dimensional image detection directly exits from S213, if the number of the weld outer contour line is 1, it indicates that a suitable weld outer contour line is found, the non-welding detection result passes, and the detection continues to be performed;

[0066] S203, color change detection is performed on the weld area to determine whether there is a color change defect, if not, S204 is performed, if yes, S4 is performed to determine and output that the circular weld has a color change defect; S203 specifically includes the following steps:

[0067] The original color picture of the weld area is intercepted, and RGB three-channel images are decomposed, the RGB three-channel images are threshold segmented respectively, the threshold range and area range of blackening are set, when the RGB three-channel images are contained in the same area at the same time and the area of the images meets the set range, the corresponding area is identified as a blackening area; the number of the blackening area is counted to determine whether the number of the blackening area is greater than or equal to 1, if yes, S4 is performed to determine and output that there is a color change defect, if not, S204 is performed. Specifically:

[0068] The original color picture of the weld area is intercepted, and three channels are decomposed to obtain three channel images. The three channel images are threshold segmented respectively, the area with a gray value between 0 and 20 is obtained, the area obtained by the red channel is RB, the area obtained by the green channel is GB, and the area obtained by the blue channel is BB, then the intersection of the three obtained areas is defined as BlackRegions, BlackRegions is decomposed into connected domains, and the area with an area greater than 500 pixels is selected after area segmentation, the selected area is the color change area. The color change area is counted, and if the number of the color change area is greater than or equal to 1, it indicates that there is a color change defect.

[0069] S204, S204, it is determined whether the distance between the center of the weld outer contour line and the center of the center hole area is greater than a set value, if not, S205 is performed, if yes, S4 is performed to determine and output that the circular weld has a welding offset defect; specifically:

[0070] Reference Figure 6, the distance between the two points is calculated using the obtained center coordinates F of the outer contour line and the center coordinates E of the pole hole, so as to obtain the eccentric pixel distance; the eccentric pixel distance is multiplied by the pixel equivalent (0.02) to obtain the real distance between the two centers, that is, the eccentric distance. If the eccentric distance is greater than 2mm, there is a welding eccentricity defect.

[0071] S205, using the polar coordinate transformation method of the region, the weld area is unfolded into a rectangular area, and the maximum width of the rectangular area is obtained, and it is judged whether the maximum width is greater than the upper limit value, if yes, S4 is performed, and it is judged and output that the circular weld exists a width defect, if not, S3 is performed. Specifically: for the obtained weld area, polar coordinate transformation is performed, the circular ring shaped weld area is unfolded into a rectangular area along the outer contour line, the rectangular area is adjusted to the lower position using affine transformation, the long axis direction of the rectangle is rotated to the direction of row increase, and the width is calculated row by row using the travel, and the width array is obtained. The maximum value of the width array is taken, which is the maximum value of the weld. If the maximum value exceeds the width upper limit, there is a width defect.

[0072] S3, based on the three-dimensional visual recognition algorithm, whether the second type of defect exists is judged according to the three-dimensional image, if yes, S4 is performed, if not, it is judged that the circular weld is qualified; the second type of defect includes gap defect, convex point defect, excess height defect and pit hole defect. S3 specifically includes the following steps:

[0073] S301, the three-dimensional image of the circular weld is preprocessed, the patch area is obtained according to the preprocessed three-dimensional image, the preliminary position of the weld and the position of the plane outside the weld are determined according to the patch area, and the three-dimensional image is leveled to obtain the leveled image; S301 specifically includes the following steps:

[0074] S311, the bright area in the three-dimensional image is calculated by using the dynamic threshold algorithm, and the patch area is located; refer to the area shown in the H frame in Figure 8 .

[0075] S312, in the patch area, the image height change data is obtained by taking the derivative of the graph, and the circular ring area in the patch is located by threshold segmentation, refer to the outer contour line of the I circular ring shown in Figure 9 ; the maximum and minimum gray scales of the patch area are obtained, the maximum height and the minimum height of the patch area are obtained. The maximum height is the average height value of the outer part of the patch circular ring, and the minimum height is the average height of the weld area. The height difference between the weld area and the plane area outside the patch is used to obtain the outer circular ring of the weld by threshold segmentation.

[0076] S313, get the gasket hole position information and the height information of the hole inner plane, and locate to the gasket center hole position; perform an incircle transformation on the weld outer circular ring area to obtain the incircle center and radius, and then regenerate the inner hole rough positioning circle C1 according to the incircle center and radius, wherein the incircle center is the incircle center, and the radius is half of the incircle radius. Use C1 to cut the depth image to obtain the inner hole rough positioning image Image1, calculate the maximum height Max1 and the minimum height Min1 of Image1. We use threshold segmentation on Image1, and the threshold range is set to Max1-12000~Max1-3000. The weld center hole area is generally below 7000 from the weld plane; decompose the connected domain of the area obtained after threshold segmentation, and then select the area with the largest area to obtain the inner hole area of the gasket, which is referred to in Figure 10

[0077] S314, preliminarily locate the weld position and the plane position outside the weld by the gasket hole position information and the circular ring area, which is referred to in Figure 11

[0078] S315, adjust the inclined three-dimensional image to a horizontal position to obtain the adjusted image. When the 3D image is captured, the gasket cannot be guaranteed to be in a horizontal position. Since the height of the weld, the height of the convex point and the depth of the concave hole need to be accurately calculated later, the gasket plane needs to be corrected to the horizontal direction first to facilitate the subsequent calculation. According to the obtained plane area RegionPlane, use the method of calculating the gray value matrix to obtain the gradient value Alpha in the row direction and the gradient value Beta in the column direction of the 3D image, combine the height and width of the 3D image, use a first-order polynomial to create an inclined curved surface image, and the inclination angle is Alpha, Beta; finally, use image subtraction, use the 3D original image to subtract the curved surface image just created, and the result obtained is the adjusted weld image ImagePlane.

[0079] ​​S302, calculate the height of the baffle plate around the center hole in the baffle plate area and the height of the pole plate in the center hole, subtract the height of the pole plate from the height of the baffle plate, and then subtract the thickness of the baffle plate to obtain the gap data, and determine whether the gap data is greater than a set value, if yes, proceed to S4, determine and output that there is a gap defect, if not, proceed to S303; Specifically: using the plane area RegionPlane and the leveled image ImagePlane to calculate the average height MeanHeight of the plane. Then use the obtained baffle inner hole area, and the leveled image to recalculate the average height HoleHeight of the inner hole area. Gap = (MeanHeight-HoleHeight)*hv_z-baffle thickness. The baffle thickness is 1mm. Hv_z is the pixel equivalent in the height direction. Through the above calculation formula, the gap thickness can be calculated. If the gap exceeds the maximum upper limit of the gap, it is determined that there is a gap defect.

[0080] S303, calculate whether there is a convex point higher than a set value in the plane position outside, if yes, proceed to S4, determine and output that there is a convex point defect, if not, proceed to S304; Specifically: according to the plane area RegionPlane, combined with the leveled image ImagePlane, intercept the leveled image ImageTuPoint of the plane area, perform threshold segmentation operation on the leveled image ImageTuPoint, select the area with height greater than the convex point threshold, then decompose the connected domain of the area, select the area RegionConvex with area greater than 200 pixels, calculate the number of RegionConvex, if the number is greater than 1, it indicates that there is a convex point, and the convex point detection result is that there is a convex point defect.

[0081] S304, calculate whether there is an area with height greater than 1mm of the baffle plate in the preliminary position of the weld, if yes, proceed to S4, determine and output that there is a excess height defect, if not, proceed to S305; Excess height describes the height of the weld, if the height range of the weld is set to 0-1mm, then the weld height exceeding 1mm indicates that there is excess height. According to the preliminary positioning weld area and the leveled image ImagePlane, the picture is intercepted, which is defined as ImageHF, then the ImageHF image is threshold segmented to intercept the area with height greater than 1mm. Decompose the connected domain of the obtained area, then select the area RegionYugao with area greater than 200 pixels, calculate the number of RegionYugao, if the number is greater than or equal to 1, it indicates that there is an excess height defect.

[0082] S305, whether there is a region below the set depth threshold of the plate plane in the preliminary position of the weld, if yes, S4 is performed, and it is judged and output that there is a pit hole defect, if not, it is indicated that the circular weld is qualified. Specifically, the pit hole describes whether there is a region below the lower limit of the weld plane threshold on the weld. According to the weld area ImageHF, threshold segmentation is performed on ImageHF, the region RegionAokeng in which the weld height is below 1mm is calculated, the connected domain of RegionAokeng is cancelled, and then the area of the region after the cancellation of the connected domain is sorted, the region with an area greater than 200 pixels is selected, and the region is counted. If the number is greater than or equal to 1, it is indicated that there is a pit hole defect.

[0083] S4, it is judged that the circular weld has defects, and the corresponding defect type is output. The results of the above steps are combined. If any of the above steps detects defects, the total result is that there are defects, indicating that the weld is unqualified. If the detection results of the above are all no defects, the total result is no defects, indicating that the weld is qualified.

[0084] The present application uses a surface array camera to collect a two-dimensional image of the weld, and uses a three-dimensional linear array camera to collect a three-dimensional image of the weld; the two-dimensional image and the three-dimensional image are processed by algorithms respectively, through processing the two-dimensional image, the weld width defect detection result, the discoloration detection result, and the non-welding and welding deviation detection result can be obtained; through processing the three-dimensional image by algorithms, the pit hole detection result, the excess height detection result, the convex point detection result and the gap detection result can be obtained; finally, the two-dimensional image detection result and the three-dimensional image detection result are combined, only when all the detection results are qualified, the detection result of the weld is qualified, otherwise it is judged that the weld result has defects.

Claims

1. A method for detecting defects in a circular weld based on visual recognition, characterized in that, The method comprises the following steps: S1, obtaining a two-dimensional image and a three-dimensional image of a circular weld; S2, judging whether a first type of defect exists according to the two-dimensional image based on a two-dimensional visual recognition algorithm, if yes, proceeding to S4, if no, proceeding to S3; when judging, first performing convex transformation on the maximum bright area in the two-dimensional image to obtain a bead area, taking the boundary of the dark area in the black circular ring in the bead area, and performing circular fitting transformation to generate an outer contour line of the weld; S3, judging whether a second type of defect exists according to the three-dimensional image based on a three-dimensional visual recognition algorithm, if yes, proceeding to S4, if no, judging that the circular weld is qualified; when judging, first locating the bead area from the bright area in the three-dimensional image, taking the derivative of the graph to obtain image height change data, locating the circular ring area and the center hole position of the bead, thereby locating the weld position and the plane position outside the weld, and then leveling the image; S4, judging that the circular weld has a defect and outputting the corresponding defect type.

2. The method of claim 1, wherein the method further comprises: The first type of defect includes an unwelded defect, a discoloration defect, a welding offset defect and a width defect, and the second type of defect includes a gap defect, a convex point defect, a excess height defect and a concave pit hole defect.

3. The method of claim 2, wherein the method further comprises: The S2 specifically comprises the following steps: S201, pre-processing the two-dimensional image of the circular weld, and obtaining an outer contour line of the weld according to the pre-processed two-dimensional image; S202, judging whether the outer contour line of the weld can be obtained, if no, proceeding to S4, judging and outputting that the circular weld has an unwelded defect; if yes, the outer contour line of the weld encloses an outer contour area of the weld, the inner contour area of the weld is obtained from the outer contour area of the weld, and the center hole area is extracted from the inner contour area of the weld, the outer contour area of the weld is subtracted from the inner contour area of the weld to obtain a weld area, and S203 is performed; S203, performing discoloration detection on the weld area, judging whether a discoloration defect exists, if no, proceeding to S204, if yes, proceeding to S4, judging and outputting that the circular weld has a discoloration defect; S204, judging whether the distance between the center of the outer contour line of the weld and the center of the center hole area is greater than a set value, if no, proceeding to S205, if yes, proceeding to S4, judging and outputting that the circular weld has a welding offset defect; S205, using a polar coordinate transformation method of a region to expand the weld area into a rectangular area, obtaining the maximum width of the rectangular area, judging whether the maximum width is greater than an upper limit value, if yes, proceeding to S4, judging and outputting that the circular weld has a width defect, if no, proceeding to S3.

4. The method of claim 3, wherein the method further comprises: The S201 specifically comprises the following steps: Step 211, calculating the bright area in the two-dimensional image by using a dynamic threshold algorithm, selecting the maximum area of the bright area, and performing convex transformation on the maximum area to obtain a bead area; Step 212, intercepting a black circular ring in the bead area, positioning to an inner circular ring area and an outer circular ring area through the black circular ring, and converting the contour line of the inner circular ring area into a region type; Step 213, using dynamic threshold segmentation to obtain a dark area in the inner circular ring, taking the boundary of the obtained dark area, performing circular fitting transformation on the boundary area, and generating a fitting circle as the outer contour line of the weld, the area surrounded by the outer contour line of the weld being an outer contour area of the weld; Step 214, first, the two-dimensional image of the circular weld is segmented by dynamic threshold value, the maximum bright area is taken, and a partial inner contour area is obtained; the two-dimensional image is subjected to template matching of the center hole, and a center hole area of the circular weld is obtained; finally, the partial inner contour area and the center hole area are taken as a union, and an inner contour area of the weld is obtained; Step 215, the inner contour area of the weld obtained in step 214 is subtracted from the outer contour area of the weld obtained in step 213, so that the weld area is obtained.

5. The method of claim 4, wherein the method further comprises: The S203 specifically comprises the following steps: The original color picture of the weld area is intercepted, the RGB three-channel images are decomposed, the RGB three-channel images are respectively subjected to threshold value segmentation, the blackening threshold value range and area range are set, when the RGB three-channel images are contained in the same area and the area meets the set range, the corresponding area is identified as a blackening area; the blackening area is counted, and it is judged whether the number of the blackening area is greater than or equal to 1, if yes, S4 is performed, and it is judged and output that there is a discoloration defect, if not, S204 is performed.

6. The method of claim 2, wherein the method further comprises: The S3 specifically comprises the following steps: S301, the three-dimensional image of the circular weld is preprocessed, the gasket area is obtained according to the preprocessed three-dimensional image, the preliminary position of the weld and the position of the outer plane of the weld are determined according to the gasket area, and the three-dimensional image is leveled to obtain a leveled image; according to the obtained plane area, the gradient value in the row direction and the gradient value in the column direction of the 3D image are obtained by using the method of calculating the gray value matrix, a tilted curved surface image is created by using a first-order polynomial, and the tilt angle is the gradient value in the row direction / the gradient value in the column direction; the 3D original image is subtracted from the curved surface image to obtain the leveled weld image; S302, the gasket height around the center hole in the gasket area and the pole plate height of the pole plate inside the center hole are calculated, the gasket height is subtracted from the pole plate height, and then the gasket thickness is subtracted to obtain the gap data, and it is judged whether the gap data is greater than a set value, if yes, S4 is performed, and it is judged and output that there is a gap defect, if not, S303 is performed; S303, it is judged whether there is a convex point higher than a set value in the position of the outer plane, if yes, S4 is performed, and it is judged and output that there is a convex point defect, if not, S304 is performed; S304, it is judged whether there is an area with a height greater than 1mm of the gasket plane in the preliminary position of the weld, if yes, S4 is performed, and it is judged and output that there is a residual height defect, if not, S305 is performed; S305, it is judged whether there is an area lower than a set depth threshold value of the gasket plane in the preliminary position of the weld, if yes, S4 is performed, and it is judged and output that there is a pit hole defect, if not, it is judged that the circular weld is qualified.

7. The method of claim 6, wherein the method further comprises: The S301 specifically comprises the following steps: S311, the bright area in the three-dimensional image is calculated by using a dynamic threshold value algorithm, and the gasket area is located; S312, the image height change data is obtained by taking the derivative of the graph in the gasket area, and the circular ring area in the gasket is located by threshold value segmentation; S313, the gasket hole position information and the height information of the hole inside plane are obtained, and the gasket center hole position is located. S314, the weld position and the plane position outside the weld are preliminarily located through the gasket hole position information and the annular region; S315, the inclined three-dimensional image is adjusted to a horizontal position to obtain an adjusted image.

Citation Information

Patent Citations

  • Detection method and detection device of welding seams

    CN109001224A

  • Weld joint detection method and device

    CN114354618A