A method for detecting the edge of a point-like adhesive and its application
By calculating the gradient angle of pixels and screening edge points using circumferential division points, and combining the gray-level co-occurrence matrix to determine the quality of the adhesive, the accuracy problem of dot-like adhesive detection in complex backgrounds is solved, achieving highly automated and highly accurate online detection.
Patent Information
- Application Number
- CN202211668966.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-12-23
AI Technical Summary
Existing technologies struggle to accurately segment the edges of adhesive dots in complex backgrounds when detecting them, making it easy for noise to get mixed in and leading to inaccurate detection.
By calculating the gradient angle of pixels within the ROI region, and combining the center and circumference of the circle, edge points that meet the conditions are selected. The highest frequency of directional angles in the neighborhood is used to suppress noise interference, and the quality of the glue is judged by combining the gray-level co-occurrence matrix.
Accurately detects the edges of dotted adhesive in complex backgrounds, improving the automation and accuracy of detection, and is suitable for online detection.
Smart Images

Figure CN115861273B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual measurement, and more specifically to a method for detecting the edge of dotted adhesive and its application. Background Technology
[0002] Dotted adhesives can be used to bond and seal components, and in some fields, they can replace processes such as screwing and welding, maintaining the aesthetic appearance of the workpiece's outer surface. The quality of the dotted adhesive directly affects the quality of the workpiece. Therefore, it is necessary to detect whether the dotted adhesive is defective. Existing dotted adhesive detection methods usually rely on image segmentation to measure the adhesive edge and diameter. If the adhesive is applied to a smooth and flat workpiece surface, threshold segmentation can obtain a relatively ideal adhesive edge. However, when the workpiece surface with dotted adhesive has grooves or scratches, the acquired workpiece image has a complex background and low contrast, which greatly increases the difficulty of image segmentation, easily introduces noise, and leads to inaccurate segmentation by existing methods, making it impossible to effectively determine the dotted adhesive application status. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention provides a method for edge detection of dotted adhesive, aiming to solve the quality inspection problem of dotted adhesive in complex industrial production environments. This method can reduce the interference of background noise and obtain accurate edge points, thereby further detecting the edge integrity, internal integrity, and adhesive width of the dotted adhesive, providing a basis for evaluating the coating quality of the dotted adhesive. It features high automation and high accuracy, and is suitable for online coating quality inspection.
[0004] The technical solution is as follows:
[0005] A method for detecting the edge of dotted adhesive, wherein the dotted adhesive is applied to the surface of a workpiece, an image of the workpiece after application is acquired, and the edge of the dotted adhesive is detected using the following steps:
[0006] 1) Obtain the ROI region where the dotted adhesive is located in the workpiece image, and calculate the gradient angle of each pixel in the ROI region. The gradient angle is the angle between the gradient direction after the horizontal gradient and the vertical gradient are synthesized and the horizontal direction.
[0007] The angle value obtained by taking the absolute value of the gradient angle is denoted as the direction angle A of a single pixel.
[0008] 2) Draw a circle with the geometric center of the ROI region as the center and the theoretical radius of the dotted adhesive as the radius;
[0009] Divide the circumference into N equal parts to obtain N equal division points on the circumference;
[0010] Draw a horizontal line through the center of the circle, intersecting the circumference at two points. Record one of these points as the starting point. Record the central angle of the arc between the dividing point and the starting point as the central angle of the dividing point.
[0011] If the central angle of the bisecting circle is greater than 180°, let 360° minus the central angle of the bisecting circle replace the original central angle of the bisecting circle;
[0012] 3) For each bisecting point, the following processing is performed respectively:
[0013] The neighborhood of the bisecting point is found, the angle difference between the direction angle A of each point in the neighborhood and the central angle of the bisecting circle is calculated, and it is determined whether there is an angle difference less than the threshold value I:
[0014] If so, the point with the angle difference closest to 0° is recorded as an edge point;
[0015] If not, there is no edge point in the neighborhood of the bisecting point;
[0016] 4) The number of edge points marked in step 3) is counted, and if the number is greater than a preset value B, the point-shaped glue edge in the ROI region is complete; otherwise, the point-shaped glue edge in the ROI region is incomplete.
[0017] In order to reduce the influence of noise points on the detection result, preferably, in step 1), the direction angle A of each pixel point is assigned as follows:
[0018] 0°-180° is divided into multiple angle intervals;
[0019] Determine the angle interval to which a single direction angle A belongs, and assign the maximum angle in the angle interval to which the direction angle A belongs to the direction angle A;
[0020] Find the neighborhood of a single pixel point, count the direction angles A of other pixel points in the neighborhood, and assign the direction angle A with the highest frequency to the direction angle A of the pixel point;
[0021] The same processing is performed on each pixel point to obtain the direction angle A of each pixel point.
[0022] Preferably, 0°-180° is divided into 5-10 angle intervals; a 3x3 neighborhood or a 5x5 neighborhood of a single pixel point is found; the threshold value I is 5°-180° / S, and S is the number of angle intervals.
[0023] Preferably, the horizontal gradient and the vertical gradient are calculated using the Sobel operator or the Roberts operator;
[0024] Further, in step 4), if the point-shaped glue edge in the ROI region is complete, the glue width is obtained using the edge points:
[0025] Fit all edge points to obtain the center and diameter, and record the diameter value as the glue width of the point-shaped glue.
[0026] Further, in step 4), if the point-shaped glue edge in the ROI region is complete, the internal situation of the glue is further judged by the following steps:
[0027] The minimum circumscribed rectangle of the point-shaped glue is obtained by using the center and the diameter, and is recorded as the measured glue region;
[0028] The similarity between the gray level co-occurrence matrix of the measured glue region and the gray level co-occurrence matrix of the template glue region is obtained, and if the similarity is greater than a threshold C, the glue region is normal, otherwise the glue region is abnormal; the threshold C is 0.8-0.95;
[0029] The template glue region is a minimum circumscribed rectangle region of the point-shaped glue stored in a pre-teaching process.
[0030] Further, in step 1), the ROI region where the point-shaped glue is located in the workpiece image is obtained in the following manner:
[0031] According to the point-shaped glue selection frame information stored in the pre-teaching process, the region where the point-shaped glue is located is framed in the image, which is recorded as the ROI region; the ROI region is subjected to denoising processing.
[0032] Preferably, the pre-teaching process is performed before step 1) and includes the following steps:
[0033] A workpiece with normal point-shaped glue coating is selected as a template workpiece, and the template workpiece and the workpiece to be detected are of the same model;
[0034] The template workpiece image is collected, the point-shaped glue region to be detected is manually framed, the image of the region is stored as a template image, and the frame size and frame position of the region are recorded as frame information; the frame is a square frame, and 1 / 2 of the side length is 1.2-1.5 times the theoretical radius of the point-shaped glue.
[0035] Preferably, in step 2), N is 30-360; in step 3), the threshold I is 5°-30°, and a 3x3 neighborhood or a 5x5 neighborhood of the equally divided point is searched; in step 4), the preset value B is 0.6-0.9N.
[0036] Further, if there are multiple point-shaped glues to be detected in the workpiece image, steps 1)-4) are performed on each point-shaped glue to be detected.
[0037] The method has the following characteristics:
[0038] Since the point-shaped glue is circular, and the gradient direction at the point of the circular edge points to the center of the circle, based on the principle of connecting the circumferential points based on the center of the circle parallel to the gradient direction, the method calculates the included angle between the central angle of the bisecting point and the direction angle A of the surrounding neighborhood pixel points, screens out the edge points that meet the conditions, and further analyzes the glue quality; the method can effectively suppress the interference of noise points, obtain accurate edge points, improve the accuracy of subsequent point-shaped glue quality evaluation, and is suitable for real-time detection of various types of point-shaped glue.
[0039] In addition, the method also quantizes the direction angle A of the pixel points, records the direction angle A with the highest frequency in the neighborhood as the direction angle A of the center pixel point, effectively prevents noise interference, and reduces the requirement for image quality. For the case that the image background is complex and the contrast is poor, the method can still effectively extract the edge points.
[0040] Meanwhile, when the workpiece contains multiple point-shaped glue regions to be detected, the method can simultaneously process multiple point-shaped glue ROI regions, has good real-time performance, high automation degree, and can realize online detection. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 is a schematic diagram of the bisecting point and the starting point on the circumference;
[0042] Figure 2 is a schematic diagram of dividing 0-180° into five angle intervals;
[0043] Figure 3 is a workpiece image actually collected in the specific embodiment;
[0044] Figure 4 is a schematic diagram of the workpiece image processed by using the existing threshold segmentation method;
[0045] Figure 5 is a schematic diagram of the workpiece image processed by using the method of the application. DETAILED DESCRIPTION
[0046] The technical solutions of the application will be described in detail below in combination with the drawings and specific embodiments.
[0047] A point-shaped glue edge detection method, the point-shaped glue is glued on the surface of a workpiece, and an image of the workpiece after gluing is collected, and the following steps are used to detect the edge of the point-shaped glue:
[0048] 1) Obtain the ROI region where the point-shaped glue is located in the workpiece image, and calculate the gradient angle of each pixel point in the ROI region, wherein the gradient angle is the included angle between the gradient direction after the horizontal gradient and the vertical gradient are combined and the horizontal direction;
[0049] After taking the absolute value of the gradient angle, the angle value obtained is recorded as the direction angle A of a single pixel point.
[0050] 2) such as Figure 1 As shown, a circle is drawn with the geometric center of the ROI region as the center and the theoretical radius of the dotted glue as the radius;
[0051] Divide the circumference into N equal parts to obtain N equal division points on the circumference; where N ranges from 30 to 360.
[0052] Draw a horizontal line through the center of the circle, intersecting the circumference at two points. Record one of these points as the starting point. Record the central angle of the arc between the dividing point and the starting point as the central angle of the dividing point.
[0053] If the central angle of the dividing point is greater than 180°, then subtract the central angle of the dividing point from 360° and replace the original central angle of the dividing point with the result;
[0054] 3) Perform the following processing on each equally divided point:
[0055] Find the neighborhood of the dividing point, calculate the angle difference between the direction angle A of each point in the neighborhood and the central angle of the dividing point, and determine whether there is an angle difference less than the threshold I: where the threshold I is 5° to 30°.
[0056] If it exists, the point whose angle difference is closest to 0° is recorded as the edge point;
[0057] If it does not exist, then there are no edge points in the neighborhood of the dividing point;
[0058] In practice, the 3×3 or 5×5 neighborhood of the equally divided point is searched.
[0059] 4) Count the number of edge points marked in step 3). If the number is greater than the preset value B, the edge of the dotted adhesive in the ROI area is complete; otherwise, the edge of the dotted adhesive in the ROI area is incomplete.
[0060] The preset value B ranges from 0.6 to 0.9N.
[0061] To reduce the impact of noise on the detection results, in this embodiment, in step 1), the orientation angle A of each pixel is assigned the following values:
[0062] like Figure 2 As shown, the angle range of 0° to 180° is divided into multiple equal intervals;
[0063] Determine the angle interval to which a single direction angle A belongs, and assign the maximum angle value in the angle interval to the direction angle A; when divided into 5 equal angle intervals, the maximum angle values are 36°, 72°, 108°, 144°, and 180° respectively;
[0064] Finding the neighborhood of a single pixel point, counting the direction angle A of other pixel points in the neighborhood, and assigning the highest frequency direction angle A to the direction angle A of the pixel point;
[0065] The same processing is performed on each pixel point to obtain the direction angle A of each pixel point.
[0066] In order to improve the accuracy of the detection result, it is preferred to divide 0°-180° into 5-10 angle intervals; find the 3x3 neighborhood or 5x5 neighborhood of a single pixel point; at this time, the threshold I takes a value of 5°-180° / S, and S is the number of angle intervals.
[0067] In specific implementation, the horizontal gradient and the vertical gradient are calculated using a sobel operator or a Roberts operator;
[0068]
[0069] Specifically, in step 2), the circumference is divided into N parts to obtain N equally divided points on the circumference; the following steps can be taken: taking the starting point as the first equally divided point, rotating counterclockwise along the circumference, and marking an equally divided point every 1°-12°.
[0070] In step 4), if the point-shaped glue edge in the ROI region is complete, the glue width is obtained using the edge points:
[0071] All edge points are fitted to obtain the center and diameter, and the diameter value is recorded as the glue width of the point-shaped glue.
[0072] In this embodiment, the least squares method is used to fit the edge points to obtain the center and radius.
[0073] More specifically, the following steps are further used to judge the internal situation of the glue:
[0074] The minimum circumscribed rectangle of the point-shaped glue is obtained using the center and diameter, and is recorded as the measured glue area;
[0075] The gray level co-occurrence matrix of the measured glue area is obtained, and the similarity between it and the gray level co-occurrence matrix of the template glue area is calculated; if the similarity is greater than a threshold C, the glue area is normal, otherwise the glue area is abnormal; the threshold C takes a value of 0.8-0.95;
[0076] In actual application, if the glue area is evaluated to be abnormal, the glue area is marked and the user is prompted to repair the glue.
[0077] The template glue area is the minimum circumscribed rectangle area of the point-shaped glue with normal glue application stored in the pre-teaching process.
[0078] In step 1), the ROI region where the point-shaped glue is located in the workpiece image is obtained in the following manner:
[0079] According to the point-shaped glue selection box information stored in the pre-teaching process, a region where the point-shaped glue is located is framed in the image, and is recorded as an ROI region; the ROI region is subjected to denoising processing.
[0080] The pre-teaching process is performed before step 1), and includes the following steps.
[0081] A workpiece with normal point-shaped glue coating is selected as a template workpiece, and the template workpiece and the workpiece to be detected are of the same model.
[0082] An image of the template workpiece is collected, a region to be detected is manually framed, the image of the region is stored as a template image, and the frame size and frame position of the region are recorded as frame information; the frame is a square frame, and the value of 1 / 2 of the side length of the square frame is 1.2-1.5 times the theoretical radius of the point-shaped glue.
[0083] As shown in FIG. 1, Figure 3 As shown in FIG. 2, five point-shaped glues are contained in the image, and are located on the groove holes, and are used for sealing and fixing in the later stage. 1)-4) are performed on each point-shaped glue to be detected, and the edge points of the five point-shaped glues are obtained, and the detection effect is shown in FIG. 3. Figure 5 As shown in FIG. 3, the method can obtain complete and accurate edge points, and is not easily disturbed by the background groove hole. However, the threshold segmentation method is easily disturbed by the background, as shown in FIG. 4, the segmented point-shaped glue is incomplete, is connected with the groove hole region, has many noise points, and the edge is not clear, and the accurate point-shaped glue region cannot be effectively segmented, which is not conducive to subsequent evaluation of the point-shaped glue coating quality. Figure 4 As shown in FIG. 4, the method can obtain complete and accurate edge points, and is not easily disturbed by the background groove hole. However, the threshold segmentation method is easily disturbed by the background, as shown in FIG. 4, the segmented point-shaped glue is incomplete, is connected with the groove hole region, has many noise points, and the edge is not clear, and the accurate point-shaped glue region cannot be effectively segmented, which is not conducive to subsequent evaluation of the point-shaped glue coating quality.
[0084] The method combines gradient information and the central angle of a circle to screen points meeting the edge feature, can effectively suppress the disturbance of a complex background, and has few noise points of the extracted edge points, thereby providing a strong guarantee for subsequent evaluation of the coating quality.
[0085] The foregoing description of the specific exemplary embodiments of the present application is presented for the purpose of illustration and description. The foregoing description is not intended to be exhaustive or to be limited to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teachings. The exemplary embodiments were chosen and described in order to explain the principles of the application and its practical application and to enable others skilled in the art to implement and utilize the application in various embodiments and with various modifications as are suited to the particular use contemplated. The scope of the application is to be defined by the following claims and their equivalents.
Claims
1. A method for detecting the edge of a spot of glue, the spot of glue being applied to a surface of a workpiece, an image of the workpiece after the glue has been applied being captured, the method comprising: The following steps are used to detect the point-shaped glue edge: 1) Obtain the ROI region of the point-shaped glue in the workpiece image, calculate the gradient angle of each pixel point in the ROI region, and the gradient angle is the included angle between the gradient direction synthesized by the horizontal gradient and the vertical gradient and the horizontal direction; Take the absolute value of the gradient angle to obtain the angle value, denoted as the direction angle A of a single pixel point; 2) Take the geometric center of the ROI region as the center and the theoretical radius of the point-shaped glue as the radius to make a circle; Then divide the circle into N parts to obtain N equally divided points on the circle; Draw a horizontal line through the center and intersect the circle at two points, and mark one of them as the starting point; Mark the central angle of the equally divided point corresponding to the arc between the equally divided point and the starting point as the equally divided point central angle; If the equally divided point central angle is greater than 180°, then subtract the equally divided point central angle from 360° and replace the original equally divided point central angle with the result; 3) For each equally divided point, the following processing is performed: Search for the neighborhood of the equally divided point, calculate the angle difference between the direction angle A of each point in the neighborhood and the equally divided point central angle, and determine whether there is an angle difference less than the threshold I: If so, mark the point with the angle difference closest to 0° as the edge point; If not, there is no edge point in the neighborhood of the equally divided point; 2. The method of spot gel edge detection of claim 1, wherein: 4) Count the number of edge points marked in step 3), if the number is greater than a preset value B, the point-shaped glue edge in the ROI region is complete; otherwise, the point-shaped glue edge in the ROI region is incomplete. In step 1), the direction angle A of each pixel point is assigned as follows: Divide 0°~180° into multiple angle intervals; Determine the angle interval to which a single direction angle A belongs, and assign the maximum angle in the angle interval to the direction angle A; Search for the neighborhood of a single pixel point, count the direction angles A of other pixel points in the neighborhood, and assign the direction angle A with the highest frequency to the direction angle A of the pixel point; 3. The method of spot gel edge detection of claim 2, wherein: The same processing is performed on each pixel point to obtain the direction angle A of each pixel point. Divide 0°~180° into 5~10 angle intervals; 4. The method of detecting a point-like glue edge according to claim 1 or 2, characterized in that: The horizontal gradient and the vertical gradient are calculated using a Sobel operator or a Roberts operator. .
5. The method of spot gel edge detection of claim 1, wherein: Search for a 3×3 neighborhood or a 5×5 neighborhood of a single pixel point; the threshold I is valued at 5°~180° / S, and S is the number of angle intervals. In step 4), if the point-shaped glue edge in the ROI region is complete, the glue width is obtained using the edge points:
6. The method of spot gel edge detection of claim 5, wherein: Fit all edge points to obtain the center and diameter, and mark the diameter value as the glue width of the point-shaped glue. In step 4), if the point-shaped glue edge in the ROI region is complete, further determine the internal situation of the glue using the following steps: Use the center and diameter to obtain the minimum circumscribed rectangle of the point-shaped glue, denoted as the measured glue area; Obtain the gray level co-occurrence matrix of the measured glue area, obtain the similarity between the gray level co-occurrence matrix and the template glue area, and if the similarity is greater than a threshold C, the glue area is normal, otherwise the glue area is abnormal; the threshold C is valued at 0.8~0.95; 7. The method of spot gel edge detection of claim 1, wherein: The template glue area is: the minimum circumscribed rectangle area of the point-shaped glue with normal glue application stored in the pre-teaching process. In step 1), the ROI region of the point-shaped glue in the workpiece image is obtained as follows: According to the point-like glue selection frame information stored in the pre-teaching process, a region where the point-like glue is located is framed in the image, and is recorded as an ROI region; the ROI region is subjected to denoising processing.
8. The method of spot gel edge detection of claim 6 or 7, wherein: The pre-teaching process is performed before step 1), and comprises the following steps: A workpiece with normal point-like glue coating is selected as a template workpiece, and the template workpiece and the workpiece to be detected are of the same model; An image of the template workpiece is acquired, a region to be detected of point-like glue is manually framed, the image of the region is stored as a template image, and the frame size and the frame position of the region are recorded as frame information; the frame is a square frame, and the 1 / 2 length of the side of the square frame is 1.2-1.5 times the theoretical radius of the point-like glue.
9. The method of spot gel edge detection of claim 1, wherein: In step 2, N is 30-360; in step 3, the threshold I is 5°-30°, and a 3*3 neighborhood or a 5*5 neighborhood of the equidivision point is searched; in step 4, the preset value B is 0.6-0.9N.
10. The method of spot gel edge detection of claim 1, wherein: If there are multiple point-like glues to be detected in the workpiece image, steps 1-4 are performed on each point-like glue to be detected respectively.
Citation Information
Patent Citations
Method for detecting image edge based on Bayer RGB
CN101465001A
Gluing edge point detection method
CN115187560A