Weld defect detection method and device based on background estimation and edge gradient suppression
The method enhances weld defect detection by employing background estimation and edge gradient suppression techniques to address human subjectivity and image noise, achieving precise and reliable defect identification in weld images.
Patent Information
- Application Number
- CN202210099399.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2042-01-27
AI Technical Summary
Existing weld defect detection systems rely on manual methods, leading to subjective judgments and misinterpretations due to human variability, and X-ray weld images suffer from noise, low contrast, and complex textures, making accurate defect identification challenging.
A method involving background estimation and edge gradient suppression, including steps like background subtraction, multi-directional gradient analysis, and adaptive thresholding to enhance defect detection in weld images.
Improves defect detection accuracy by reducing false positives and negatives, ensuring precise identification of defects in weld images through robust background estimation and edge suppression techniques.
Smart Images

Figure CN114926387B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a weld defect detection method and device based on background estimation and edge gradient suppression. Background Art
[0002] With the development of science and technology, welding has become an important part of advanced manufacturing and is used in many fields of industrial production. Various quality problems that occur during welding largely determine the service life of welded components. Therefore, effective detection of internal defects in welds is of great significance to ensure welding quality.
[0003] The existing weld defect and identification system mainly adopts the manual assistance method. The detection results are easily affected by human subjectivity, causing too many misjudgments and missed judgments. In addition, due to the different experience and technical quality of the observers, the final evaluation results are also different. In addition, due to the characteristics of the X-ray weld film itself, the extracted X-ray weld image has many noises, low contrast, large background fluctuations, complex weld image texture, and blurred weld edges. Summary of the invention
[0004] The object of the present invention is to provide a weld defect detection method and device based on background estimation and edge gradient suppression, so as to effectively improve the detection rate of defects in weld images.
[0005] Based on the same inventive concept, the present invention has two independent technical solutions:
[0006] 1. A weld defect detection method based on background estimation and edge gradient suppression, comprising the following steps:
[0007] Step 1: Process the weld image to obtain the weld area on the weld image;
[0008] Step 2: Estimating the background of the weld area and performing background subtraction to obtain a differential image containing defects;
[0009] Step 3: using multi-directional multi-level gradients to suppress edge misdetections of the differential image;
[0010] Step 4: Obtain a second binarized image of the difference image by an adaptive threshold segmentation method.
[0011] Furthermore, step 1 includes the following steps:
[0012] Step 1.1: Segment the weld image using the Otsu segmentation method to obtain a first binary image;
[0013] Step 1.2: Obtain the maximum connected domain of the first binary image;
[0014] Step 1.3: Based on the maximum connected domain of the first binary image, perform tilt correction on the first binary image to obtain a mask image;
[0015] Step 1.4: Use the bounding rectangle of the mask image to obtain the weld area.
[0016] Furthermore, in step 2, the background of the weld area is estimated by the following method:
[0017] Step 2.1.1: Scan the weld image column by column, and use the first binarized image spline curve to fit the grayscale curve of each column. The defects are distributed at the trough position of the curve. The minimum value of the grayscale curve is extracted by using the first-order difference; the extreme point is corrected by removing the inflection point in the second-order difference of the curve;
[0018] Step 2.1.2: Estimate the defect size based on the number of minimum points in each column and determine the size of the neighborhood window in each column;
[0019] Step 2.1.3: Compare the neighborhood window sizes of each column and select the maximum value as the determined neighborhood window size;
[0020] Step 2.1.4: Based on the determined neighborhood window, estimate the background of the weld area. The estimation model of the weld area background is:
[0021] B(x,y)=Median(ROI(x,y))
[0022] Where ROI(x,y) is the weld area, B(x,y) is the estimated background, and Median(ROI(x,y)) is the mean grayscale value of the neighborhood corresponding to the weld area ROI(x,y).
[0023] Furthermore, in step 2.1.2, when the number of minimum points is equal to 0, it means that there is no defect in the column, and the neighborhood window size is d = 0;
[0024] When the number of minimum points is equal to 1, it means that there is a defect in the column, and the neighborhood window size is d = x b -x a , if d is not an odd number, then d = x b -x a +1; where x a is the column coordinate value of the point where the curve starts to drop steeply, x b Search the column coordinate value corresponding to the top closest to the minimum point for the curve to the right;
[0025] When the number of minimum points is greater than 1, it means that there are at least two defects in the column, and the maximum neighborhood window in the neighborhood window determined by each minimum point is selected as the neighborhood window size of the column.
[0026] Furthermore, in step 2, the difference image is obtained by the following formula:
[0027] △I(x,y)=B(x,y)-ROI(x,y)
[0028] Where △I(x,y) is the difference image, ROI(x,y) is the weld area, and B(x,y) is the estimated background.
[0029] Furthermore, in step 2, the noise and edge pixels of the differential image are removed by using a morphological filtering method; during filtering, a circular structural element is first used for an opening operation, and then a strip-shaped structural element is used for an opening operation.
[0030] Furthermore, in step 3, using multi-directional multi-level gradients to suppress edge misdetection of the differential image includes the following steps:
[0031] Step 3.1: Calculate the gradient of the difference image at the neighborhood points in 8 directions:
[0032] △x i(i=0,1,2,3,4,5,6,7) =|X(m,n)-X(m i ,n i )|
[0033] Among them, i (i = 0, 1, 2, 3, 4, 5, 6, 7) represents the positive and negative eight directions of horizontal, vertical, 45 degrees and 135 degrees, X (m i ,n i ) represents the gray value of point X(m,n) in the i direction, △x i Indicates the gradient value of X(m,n) in the i direction;
[0034] Step 3.2: Calculate the gradient of the difference image at the neighborhood points in 8 directions, and find the 8-direction gradient values when k is 1, 3, and 5 respectively, where k is the gradient level;
[0035] Step 3.3: Calculate the threshold corresponding to each gradient level as a measure of gradient change. The calculation formula is as follows:
[0036] T i =m i +ασ i
[0037] In the formula, m i is the mean, σ i is the variance and α is the coefficient.
[0038] Step 3.4: Statistic the directional gradients of different gradient levels respectively. For the 8 directional gradients of the same gradient level, if more than 6 of them are greater than the threshold, the number of defect records may be increased by 1. After the three gradient statistics are completed, if the number of records is greater than or equal to 2, and the absolute value of the gradient in each direction increases with the increase of the gradient number, the area is determined to be a defect area, and the grayscale value remains unchanged, otherwise the grayscale value is set to 0.
[0039] Furthermore, in step 4, the differential image is adaptively thresholded by the following formula to obtain a second binary image:
[0040]
[0041] In the formula, I k (x, y) represents the grayscale value of the image in the k-neighborhood, Mean k (x,y) represents the mean gray value of the image in the k-neighborhood.
[0042] Furthermore, in step 4, for the second binary image, an opening operation is used to remove the short edges and pseudo missing edges of the image, and a closing operation is used to connect the image edges and fill the inside of the defect.
[0043] 2. A weld defect detection device based on background estimation and edge gradient suppression, used to execute the above method.
[0044] The present invention has the beneficial effects:
[0045] The present invention effectively improves the detection rate of defects in weld images, obtains a differential image containing defects by reverse background difference, significantly enhances the defects, and has a simple background estimation method and a fast speed, and the estimated background is as close to the original image as possible. Multi-directional multi-level gradients suppress the edge misdetection of the differential image, so that the edge misdetection area is removed and the defect is separated from the background; the second binary image of the differential image is obtained by an adaptive threshold segmentation method to ensure the defect detection rate.
[0046] The present invention segments the weld image by the Otsu segmentation method to obtain a first binary image; obtains the maximum connected domain of the first binary image; based on the maximum connected domain of the first binary image, performs tilt correction on the first binary image to obtain a mask image; and obtains the weld region by using the circumscribed rectangle of the mask image. The present invention uses the mask image to extract the weld region, reduces the amount of calculation when processing the weld image, and avoids unnecessary false detection due to interference from other regions outside the weld region.
[0047] The present invention scans the weld image column by column, uses a spline curve to fit the grayscale curve of each column, the defects are distributed at the trough position of the curve, and the grayscale curve is extracted by first-order difference; the extreme point is corrected by removing the inflection point in the second-order difference of the curve; according to the number of minimum points in each column, the defect size is estimated, and the neighborhood window size of each column is determined; the neighborhood window sizes of each column are compared, and the maximum value is selected as the determined neighborhood window size; based on the determined neighborhood window, the background of the weld area is estimated; when the number of minimum points is equal to 0, it means that there is no defect in the column, and the neighborhood window size is d=0; when the number of minimum points is equal to 1, it means that there is a defect in the column, and the neighborhood window size is d=x b -x a , if d is not an odd number, then d = x b -x a +1; where x a is the column coordinate value of the point where the curve starts to drop steeply, x b The column coordinate value corresponding to the top closest to the minimum point is searched to the right of the curve; when the number of minimum points is greater than 1, it means that there are at least two defects in the column, and the largest neighborhood window in the neighborhood window determined by each minimum point is selected as the neighborhood window size of the column. The present invention effectively controls the amount of calculation when processing weld images while ensuring the defect detection rate through the above-mentioned neighborhood window estimation method.
[0048] The present invention utilizes morphological filtering to remove noise and edge pixels of a differential image. During filtering, a circular structural element is first used for opening operation, and then a strip-shaped structural element is used for opening operation, thereby further ensuring effective filtering of noise and edge pixels of the differential image, reducing the amount of calculation for subsequent image processing, and improving the defect detection rate.
[0049] The present invention uses multi-directional multi-level gradients to suppress the edge misdetection of the differential image, including the following steps: calculating the gradient size of the differential image at the neighborhood points in 8 directions; calculating the threshold value corresponding to each gradient level, using this as a measure of gradient change, and statistically analyzing the directional gradients of different gradient levels. For the 8 directional gradients of the same gradient level, if more than 6 of the gradient values are greater than the threshold value, the number of defect records may be increased by 1; after the three gradient statistics are completed, if the number of records is greater than or equal to 2, and the absolute value of the gradient in each direction increases with the increase of the gradient number, the area is determined to be a defect area, and the gray value remains unchanged, otherwise the gray value is set to 0. The present invention effectively suppresses the edge misdetection of the differential image through the above method, and further ensures that the defect detection rate is effectively improved.
[0050] The present invention uses an opening operation to remove the short edges and pseudo missing edges of the image for the second binary image, and uses a closing operation to connect the image edges and fill the inside of the defect, thereby further ensuring the accuracy of the defect segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flow chart of the weld defect detection method based on background estimation and edge gradient suppression of the present invention;
[0052] Figure 2 is an 8-directional gradient map;
[0053] Figure 3 Extract process maps for the weld area;
[0054] Figure 4 To extract defect process diagram;
[0055] Figure 5 It is the gray value distribution map after differential image, morphological filtering saliency detection and multi-directional multi-level gradient edge suppression;
[0056] Figure 6 The original image of the weld and the inspection result image. DETAILED DESCRIPTION
[0057] The present invention is described in detail below in conjunction with the various embodiments shown in the accompanying drawings, but it should be noted that these embodiments are not limitations of the present invention, and any equivalent transformations or substitutions in functions, methods, or structures made by ordinary technicians in the field based on these embodiments are all within the scope of protection of the present invention.
[0058] Embodiment 1:
[0059] Weld defect detection method based on background estimation and edge gradient suppression
[0060] like Figure 1 As shown, the following steps are included:
[0061] Step 1: Process the weld image to obtain the weld area on the weld image.
[0062] The implementation includes the following steps:
[0063] Step 1.1: Scan the weld X-ray film taken by the X-camera to convert it into a weld image; segment the weld image using the Otsu segmentation method to obtain a first binary image B.
[0064] Step 1.2: Obtain the maximum connected component of the first binarized image.
[0065] Traverse the entire image, mark each connected domain with a different color and count the number of each color, that is, the number of pixels contained in the connected domain. Save the maximum number of colors in variable A, determine the number of each color, assign black to all pixels in the connected domain whose number is less than variable value A, and mark the pixels whose number of colors is equal to variable A as white, and the maximum connected domain L can be obtained.
[0066] Step 1.3: Based on the maximum connected domain of the first binary image, perform tilt correction on the first binary image to obtain a mask image.
[0067] The tilt angle is obtained by using the minimum circumscribed rectangle of the maximum connected domain, and then the rotation angle is calculated. The tilt correction is achieved by using affine transformation. The binary image after tilt correction is the mask image M. Figure 3 (a) The image correction angle is 1.32 degrees. The weld area extraction results are shown in Figure 3 (b) as shown.
[0068] Step 1.4: Obtain the weld area H using the circumscribed rectangle of the mask image.
[0069] Step 2: Estimate the background of the weld area and perform background subtraction to obtain a differential image containing defects.
[0070] Background difference is to subtract the background image from the original image, while inverse background difference is to subtract the original image from the background image. The present invention needs to re-estimate the background for each image, and the estimation method is simple and fast, and the estimated background is as close to the original image as possible. In order to make the estimated background closer to the original image, the weld area of the present invention adopts median filtering to estimate the background. In the process of median background estimation, the selection of the neighborhood window size is crucial, which greatly affects the speed of operation, the effect of background simulation and the fidelity after subsequent defect segmentation. When the selected neighborhood window is too small, the defects in the weld image are not completely filtered out, and the obtained background will contain some defects, which will cause distortion of the defects after segmentation; when the selected neighborhood window is too large, the simulated weld background image will no longer reflect the properties of the original weld image, and the processing time is also longer. After determining the size of the median filter neighborhood window, the weld area can be estimated by background. Figure 4 (a) Figure 3 (b) Background of weld area estimation.
[0071] When implemented, background estimation specifically includes the following steps:
[0072] Step 2.1.1: Scan the weld image column by column, and use the first binarized image B-spline curve to fit the grayscale curve of each column. The defects are distributed at the trough position of the curve. The minimum value of the grayscale curve is extracted by first-order difference; the extreme point is corrected by removing the inflection point in the second-order difference of the curve;
[0073] Step 2.1.2: Estimate the defect size based on the number of minimum points in each column and determine the size of the neighborhood window in each column.
[0074] When the number of minimum points is equal to 0, it means that there is no defect in the column, and the neighborhood window size is d = 0;
[0075] When the number of minimum points is equal to 1, it means that there is a defect in the column, and the neighborhood window size is d = x b -x a , if d is not an odd number, then d = x b -x a +1; where x a is the column coordinate value of the point where the curve starts to drop steeply, x b Search the column coordinate value corresponding to the top closest to the minimum point for the curve to the right;
[0076] When the number of minimum points is greater than 1, it means that there are at least two defects in the column, and the maximum neighborhood window in the neighborhood window determined by each minimum point is selected as the neighborhood window size of the column.
[0077] Step 2.1.3: Compare the neighborhood window sizes of each column and select the maximum value as the determined neighborhood window size;
[0078] Step 2.1.4: Based on the determined neighborhood window, estimate the background of the weld area. The estimation model of the weld area background is:
[0079] B(x,y)=Median(ROI(x,y))
[0080] Where ROI(x,y) is the weld area, B(x,y) is the estimated background, and Median(ROI(x,y)) is the mean grayscale value of the neighborhood corresponding to the weld area ROI(x,y).
[0081] The difference image is obtained by the following formula:
[0082] △I(x,y)=B(x,y)-ROI(x,y)
[0083] Where △I(x,y) is the difference image, ROI(x,y) is the weld area, and B(x,y) is the estimated background.
[0084] The morphological filtering method is used to remove noise and edge pixels of the differential image. When filtering, the circular structure element is first used for opening operation, and then the long strip structure element is used for opening operation.
[0085] Since the background image is reconstructed, the established background cannot reflect the changes in the local area, and false detection will occur, most of which are caused by the fluctuation of the boundary. In order to eliminate false detection and improve the quality of the obtained image, the present invention uses an opening operation to perform secondary processing on the defective area, and eliminates and separates the pixels representing noise and edges in the original image without significantly changing the area of the original image. It can be seen from the extracted defect image that the defect types include circular defects such as pores and linear defects such as cracks. Therefore, the circular structural element is first used for opening operation, and then the strip-shaped structural element is used for opening operation.
[0086] The circular and long strip custom structural elements are:
[0087]
[0088] Step 3: Use multi-directional multi-level gradients to suppress false edge detections of the differential image.
[0089] Considering the difference in gradient between the defect area and the edge false detection area, multi-direction judgment is used to remove the edge false detection area of the differential image. Since the false detection area may be 1 to several pixels, multi-pole gradient judgment is used to adapt to different sizes.
[0090] The implementation includes the following steps:
[0091] Step 3.1: Calculate the gradient of the difference image at the neighborhood points in 8 directions:
[0092] △x i(i=0,1,2,3,4,5,6,7) =|X(m,n)-X(m i ,n i )|
[0093] Among them, i (i = 0, 1, 2, 3, 4, 5, 6, 7) represents the positive and negative eight directions of horizontal, vertical, 45 degrees and 135 degrees, X (m i ,n i ) represents the gray value of point X(m,n) in the i direction, △x i Indicates the gradient value of X(m,n) in the i direction;
[0094] Step 3.2: Calculate the gradient of the difference image at the neighborhood points in 8 directions, and find the 8-direction gradient values when k is 1, 3, and 5, where k is the gradient level;
[0095] Step 3.3: Calculate the threshold corresponding to each gradient level as a measure of gradient change. The calculation formula is as follows:
[0096] T i =m i +ασ i
[0097] In the formula, m i is the mean, σ i is the variance and α is the coefficient.
[0098] Step 3.4: Statistic the directional gradients of different gradient levels respectively. For the 8 directional gradients of the same gradient level, if more than 6 of them are greater than the threshold, the number of defect records may be increased by 1. After the three gradient statistics are completed, if the number of records is greater than or equal to 2, and the absolute value of the gradient in each direction increases with the increase of the gradient number, the area is determined to be a defect area, and the grayscale value remains unchanged, otherwise the grayscale value is set to 0.
[0099] Step 4: Obtain a second binarized image of the difference image by an adaptive threshold segmentation method.
[0100] Since the grayscale value of the defects extracted by background estimation does not change significantly, they can be highlighted through adaptive threshold segmentation.
[0101] After adaptive threshold segmentation, there are some pseudo defects and fractures at the edges or inside of defects, which need to be filtered out and filled in. When there are cracks and incomplete penetration defects in the weld image, edge connection is required. The opening operation removes short edges and pseudo missing edges, and the closing operation performs edge connection. Figure 4 (c) is the defect adaptive threshold segmentation map. Figure 5 (a)-(c) are the gray value distribution diagrams after differential image, morphological filtering saliency detection and multi-directional multi-level gradient edge suppression, respectively.
[0102] The second binary image is obtained by adaptively thresholding the difference image using the following formula:
[0103]
[0104] In the formula, I k (x, y) represents the grayscale value of the image in the k-neighborhood, Mean k (x,y) represents the mean gray value of the image in the k-neighborhood.
[0105] When the estimated background is close enough to the defect-free image, the grayscale value of the intact area in the differential image is basically 0, which effectively avoids the problem of difficulty in defect detection in the weld area due to uneven background.
[0106] For the second binary image, an opening operation is used to remove the short edges and pseudo missing edges of the image, and a closing operation is used to connect the image edges and fill the inside of the defect.
[0107] Figure 6(a1) is the original image of the weld with crack defects, (a2) is the result image after defect detection of (a1), the white area is the defect area, and (a3) is the gray value distribution image after edge suppression of the differential image of (a1).
[0108] Figure 6 (b1) is the original image of the weld with incomplete penetration defect, (b2) is the result image after defect detection of (b1), the white area is the defect area, and (b3) is the gray value distribution image of (b1) after edge suppression of the differential image.
[0109] Figure 6 (c1) is the original image of the weld with incomplete penetration + porosity defects, (c2) is the result image after defect detection of (c1), the white area is the defect area, and (c3) is the gray value distribution image of (c1) after edge suppression of the differential image.
[0110] Embodiment 2:
[0111] Weld defect detection device based on background estimation and edge gradient suppression
[0112] The device is used to execute the above-mentioned weld defect detection method based on background estimation and edge gradient suppression.
[0113] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
[0114] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, the embodiments should be considered exemplary and non-restrictive in all respects, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present invention.
Claims
1. A weld defect detection method based on background estimation and edge gradient suppression, characterized in that: The steps include: Step 1: Process the weld image to obtain the weld area on the weld image; Step 2: Estimating the background of the weld area and performing background subtraction to obtain a differential image containing defects; Step 3: using multi-directional multi-level gradients to suppress edge misdetections of the differential image; Step 4: Obtain a second binary image of the difference image by an adaptive threshold segmentation method; Step 1 includes the following steps: Step 1.1: Segment the weld image using the Otsu segmentation method to obtain a first binary image; Step 1.2: Obtain the maximum connected domain of the first binary image; Step 1.3: Based on the maximum connected domain of the first binary image, perform tilt correction on the first binary image to obtain a mask image; Step 1.4: Obtain the weld area using the circumscribed rectangle of the mask image; In step 2, the background of the weld area is estimated by the following method: Step 2.1.1: Scan the weld image column by column, and use the first binarized image spline curve to fit the grayscale curve of each column. The defects are distributed at the trough position of the curve. The minimum value of the grayscale curve is extracted by using the first-order difference; the extreme point is corrected by removing the inflection point in the second-order difference of the curve; Step 2.1.2: Estimate the defect size based on the number of minimum points in each column and determine the size of the neighborhood window in each column; Step 2.1.3: Compare the neighborhood window sizes of each column and select the maximum value as the determined neighborhood window size; Step 2.1.4: Based on the determined neighborhood window, estimate the background of the weld area. The estimation model of the weld area background is: B(x,y)=Median(ROI(x,y)) Where ROI(x,y) is the weld area, B(x,y) is the estimated background, and Median(ROI(x,y)) is the mean grayscale value of the neighborhood corresponding to the weld area ROI(x,y).
2. The weld defect detection method based on background estimation and edge gradient suppression according to claim 1 is characterized in that: In step 2.1.2, when the number of minimum points is equal to 0, it means that there is no defect in the column, and the neighborhood window size is d = 0; When the number of minimum points is equal to 1, it means that there is a defect in the column, and the neighborhood window size is d = x b -x a , if d is not an odd number, then d = x b -x a +1; where x a is the column coordinate value of the point where the curve starts to drop steeply, x b Search the column coordinate value corresponding to the top closest to the minimum point for the curve to the right; When the number of minimum points is greater than 1, it means that there are at least two defects in the column, and the maximum neighborhood window in the neighborhood window determined by each minimum point is selected as the neighborhood window size of the column.
3. The weld defect detection method based on background estimation and edge gradient suppression according to claim 2 is characterized in that: In step 2, the difference image is obtained by the following formula: △I(x,y)=B(x,y)-ROI(x,y) Where △I(x,y) is the difference image, ROI(x,y) is the weld area, and B(x,y) is the estimated background.
4. The weld defect detection method based on background estimation and edge gradient suppression according to claim 1 is characterized in that: In step 2, the morphological filtering method is used to remove noise and edge pixels of the differential image; when filtering, the circular structure element is first used for opening operation, and then the long strip structure element is used for opening operation.
5. The weld defect detection method based on background estimation and edge gradient suppression according to claim 1 is characterized in that: In step 3, using multi-directional multi-level gradients to suppress edge misdetection of the differential image includes the following steps: Step 3.1: Calculate the gradient of the difference image at the neighborhood points in 8 directions: △x i(i=0,1,2,3,4,5,6,7) =|X(m,n)-X(m i ,n i )| Among them, i (i = 0, 1, 2, 3, 4, 5, 6, 7) represents the positive and negative eight directions of horizontal, vertical, 45 degrees and 135 degrees, X (m i ,n i ) represents the gray value of point X(m,n) in the i direction, △x i Indicates the gradient value of X(m,n) in the i direction; Step 3.2: Calculate the gradient of the difference image at the neighborhood points in 8 directions, and find the 8-direction gradient values when k is 1, 3, and 5 respectively, where k is the gradient level; Step 3.3: Calculate the threshold corresponding to each gradient level as a measure of gradient change. The calculation formula is as follows: T i =m i +as i In the formula, m i is the mean, σ i is the variance, α is the coefficient; Step 3.4: Statistic the directional gradients of different gradient levels respectively. For the 8 directional gradients of the same gradient level, if more than 6 of them are greater than the threshold, the number of defect records may be increased by 1. After the three gradient statistics are completed, if the number of records is greater than or equal to 2, and the absolute value of the gradient in each direction increases with the increase of the gradient number, the area is determined to be a defect area, and the grayscale value remains unchanged, otherwise the grayscale value is set to 0.
6. The weld defect detection method based on background estimation and edge gradient suppression according to claim 1 is characterized in that: In step 4, the differential image is adaptively thresholded and segmented using the following formula to obtain the second binary image: In the formula, I k (x, y) represents the grayscale value of the image in the k-neighborhood, Mean k (x, y) represents the mean gray value of the image in the k-neighborhood.
7. The weld defect detection method based on background estimation and edge gradient suppression according to claim 1 is characterized in that: In step 4, for the second binary image, an opening operation is used to remove the short edges and pseudo missing edges of the image, and a closing operation is used to connect the image edges and fill the inside of the defect.
8. A weld defect detection device based on background estimation and edge gradient suppression, characterized in that: Used to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Real-time weld defect detection method based on improved background difference method
CN106770318A
Welding image determination device and welding image determination method
JP2015190894A
