Method, device and storage medium for detecting defects of a circular arc edge of an object
Through the combination of segmented circular fitting and robust regression algorithm, the problem of difficulty in detecting defects in arc-shaped objects in the prior art is solved, and high-precision defect detection in the case of image distortion or defect subtleties is achieved.
Patent Information
- Application Number
- CN202110333802.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-29
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2041-03-29
AI Technical Summary
The prior art is difficult to detect defects of arc-shaped objects such as soft texture and easy deformation with high precision when image distortion or defects are fine.
The idea of segmented circular fitting is adopted to divide the arc edges of the object into arc segments, and the arc segments are circle-fitted based on a robust regression algorithm to compare the differences between the arc segments and the circular model to determine whether there are defects.
High-precision defect detection of arc-shaped edges is realized, and the defect position of the object to be inspected can be accurately analyzed in the case of image distortion or subtle defects.
Smart Images

Figure CN115147327B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision, and more particularly, to a method, an apparatus, and a computer-readable storage medium for detecting defects in the arcuate edges of an object. Background Art
[0002] In recent years, defect detection technologies based on computer vision processing have been widely applied in various industries, which can determine whether there are defects in a to-be-inspected object by performing image processing on a captured image of the to-be-inspected object. For example, defect detection has very important applications in industries such as manufacturing. By performing defect detection on manufactured workpieces, workpieces with a compliant appearance contour can be selected and workpieces with defective appearance contours can be removed to meet a certain qualified product rate.
[0003] However, for the defect detection of arcuate objects such as those with soft texture and easy deformation, due to factors such as possible deformation of the object, the arcuate edges of the to-be-inspected object may also be deformed or distorted in the captured image. For example, its edges do not appear as a standard circle or arc in the image. In the case of image distortion, some existing defect detection methods may not be able to well fit the standard ideal contour of the arcuate edge of the to-be-inspected object. Furthermore, in the case where the detection accuracy requirement is high but the defect is extremely subtle, it is difficult to analyze the location of the defect of the to-be-inspected object.
[0004] Therefore, there is a need for a technology that can effectively detect defects in the arcuate edges of an object, especially effectively and accurately detect defects in the arcuate edges of objects such as those with soft texture and easy deformation. Summary of the Invention
[0005] According to one aspect of the present disclosure, there is provided a method for detecting defects in the arcuate edges of an object. The method includes: extracting the arcuate edge of the object in an image of the object; performing an arc segment division process on the arcuate edge of the object; performing circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to each of the arc segments; and comparing the difference between each of the arc segments and the corresponding circular model to determine whether there are defects in the arcuate edge of the object.
[0006] According to another aspect of the present disclosure, there is provided a device for detecting defects in the arcuate edge of an object. The device includes: a processor; and a memory. The memory stores computer program instructions, wherein when the computer program instructions are run by the processor, the processor is caused to perform the following steps: extracting the arcuate edge of the object in an image of the object; performing an arc segment division process on the arcuate edge of the object; performing circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to each of the arc segments; and comparing the difference between each of the arc segments and the corresponding circular model to determine whether there are defects in the arcuate edge of the object.
[0007] According to yet another aspect of the present disclosure, there is provided a device for detecting defects in the arcuate edge of an object. The device includes: an edge extraction unit configured to extract the arcuate edge of the object in an image of the object; an arc segment division unit configured to perform an arc segment division process on the arcuate edge of the object; a segmented circular fitting unit configured to perform circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to each of the arc segments; and a defect detection unit configured to compare the difference between each of the arc segments and the corresponding circular model to determine whether there are defects in the arcuate edge of the object.
[0008] According to still another aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer program instructions, wherein the computer program instructions, when executed, implement the following steps: extracting the arcuate edge of the object in an image of the object; performing an arc segment division process on the arcuate edge of the object; performing circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to each of the arc segments; and comparing the difference between each of the arc segments and the corresponding circular model to determine whether there are defects in the arcuate edge of the object.
[0009] According to the defect detection techniques provided in the above various aspects of the present disclosure, by adopting the idea of segmented circular fitting and performing circular fitting based on a robust regression algorithm, it is possible to perform more refined fitting on the contour of the object to be inspected, so that even in the case where there may be image distortion or the defects are subtle, high-precision defect detection of the arcuate edge of the object to be inspected can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] These and / or other aspects and advantages of the present disclosure will become clearer and easier to understand from the following detailed description of the embodiments of the present disclosure in conjunction with the accompanying drawings, wherein:
[0011] Figure 1A physical diagram of a rubber sealing ring workpiece for which the defect detection technology of the present disclosure can be used to detect arc-shaped edge defects is shown.
[0012] Figure 2 A flowchart of a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0013] Figure 3 A schematic diagram of an image obtained by photographing a sealing rubber ring when the object to be inspected is a sealing rubber ring in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0014] Figure 4 A schematic diagram of extracting the arc-shaped edge of an object to be inspected in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0015] Figure 5 A schematic diagram of dividing an arc-shaped edge of an object into arc segments in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0016] Figure 6 A schematic diagram of performing first and second arc segment division processing on an arc-shaped edge in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0017] Figure 7 A schematic flowchart of a method for circular fitting of any one of the divided arc segments in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0018] Figure 8 A schematic diagram of the result of circular fitting of any one of the divided arc segments in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0019] Figure 9 A schematic diagram of comparing the differences between each arc segment and the corresponding circular model in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0020] Figure 10 A magnified detailed view display of the defect position after detecting the defect in the arc-shaped edge in a method for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0021] Figure 11 A schematic hardware block diagram of a device for detecting defects in an arc-shaped edge of an object according to an embodiment of the present disclosure is shown.
[0022] Figure 12A schematic structural block diagram of a device for detecting defects in a circular arc edge of an object according to an embodiment of the present disclosure is shown. Detailed implementation manners
[0023] To enable those skilled in the art to better understand the present disclosure, the present disclosure will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0024] First, a brief overview of the basic idea of the defect detection technology for the circular arc edge of an object in the present disclosure is given. For a to-be-inspected object with a circular arc edge, considering that the edge of the to-be-inspected object may be deformed in the captured image, and thus it may be difficult to fit the standard ideal contour of its edge and other problems, the defect detection technology in the present disclosure adopts the idea of segmented circular fitting, divides the circular arc edge of the to-be-inspected object into arc segments for processing, and then processes each divided arc segment as a unit. Then, for any divided arc segment, a circular fitting method based on robust regression can be used for circular fitting to determine the circular model corresponding to the arc segment, so as to be able to perform circular fitting on each arc segment more accurately. Finally, after obtaining the corresponding circular model for each arc segment, the difference between the arc segment and the circular model fitted for the arc segment can be compared, and thus whether there are defects in the circular arc edge of the to-be-inspected object can be determined according to the compared difference. In other words, in the embodiments of the present disclosure, defect detection is performed on the to-be-inspected object based on the idea of segmented circular fitting, and a circular fitting method based on robust regression is adopted in the segmented circular fitting process, which can perform more refined fitting on the contour of the to-be-inspected object, so that even in the case where there may be deformation or the defect is subtle, high-precision defect detection of the circular arc edge of the to-be-inspected object can be achieved.
[0025] Here and in the following, for the convenience of description, taking the detection of edge defects of a rubber sealing ring and the defect manifestation form being a notch at the edge as an example, the defect detection technology of the present disclosure is described. For example, Figure 1 A physical diagram of a rubber sealing ring workpiece commonly used in the industrial field is shown, and its edge can be detected to determine whether there is a notch at the edge. However, this is only an example and not a limitation to the present disclosure. The defect detection technology of the present disclosure has a wide range of application scenarios, and it can be used for defect detection of any object with a circular arc edge, such as an object with a complete 360-degree circular contour, an object with an incomplete 360-degree circular contour, and an object with a partial circular arc contour and a partial linear contour. Therefore, the defect detection technology of the present disclosure can detect the circular or circular arc edge (or a part of the edge) of the to-be-inspected object to determine whether there are defects.
[0026] It should be noted that, in the embodiments of the present disclosure, an edge may refer to a circular or arc-shaped line that constitutes the contour of an object to be inspected, or a dividing line between a foreground object and a background in an image to be processed. Throughout the claims and / or the specification, the term "edge" may be used interchangeably with "contour", and the term "circular" may be used interchangeably with "arc-shaped" in some cases. Additionally, in the embodiments of the present disclosure, the manifestation forms of defects to be detected are not limited to notches on the edge of the object to be inspected, but may also be other appearance irregular defects on the arc-shaped edge of the object to be inspected. The following will introduce in detail the method and device for detecting defects on the arc-shaped edge of an object according to the present disclosure with reference to the accompanying drawings and examples.
[0027] First, refer to Figures 2 - 10 to describe the method for detecting defects on the arc-shaped edge of an object according to an embodiment of the present disclosure. The defect detection method of the present disclosure can perform visual processing on an image taken of the object to be inspected, so as to detect whether there are defects at the arc-shaped edge of the object to be inspected. In the embodiments of the present disclosure, the object to be inspected can be photographed in any suitable manner. For example, the camera can be used to photograph the object at an angle perpendicular to the object to be inspected, so that the contour of the object appears in the photographed image in a shape closer to a circular or arc-shaped shape. Optionally, in order to better extract the arc-shaped edge of the object to be inspected, a backlight can be set behind the object to be inspected to improve the contrast of its arc-shaped edge in the photographed image. In addition, the photographed image of the object to be inspected can also be obtained in various ways. For example, real-time images can be taken of it during a certain process in the manufacturing process and real-time defect detection can be performed to sort the products, or a certain number of images of the object to be inspected can be taken in advance and product sampling inspection can be performed during a subsequent period, etc. The present disclosure is not limited thereto.
[0028] Figure 2 shows a flowchart of the method for detecting defects on the arc-shaped edge of an object according to an embodiment of the present disclosure. As Figure 2 shown, in step S101, the arc-shaped edge of the object is extracted from the image of the object. In this step S101, the arc-shaped edge can be extracted by performing computer vision processing on an image containing the arc-shaped contour of the object. The following will describe, with reference to Figures 3 to 4 an example of the schematic processing for extracting the arc-shaped edge of the object from the image of the object to be inspected.
[0029] Figure 3 shows a schematic diagram of an image obtained by photographing an object to be inspected in the case where the object to be inspected is a sealed rubber ring in the method for detecting defects on the arc-shaped edge of an object according to an embodiment of the present disclosure. As Figure 3As shown, there is a notch at the upper left corner of the inner circular edge of the sealing rubber ring. Embodiments of the present disclosure can detect this notch to determine whether there are defects in the arc-shaped edge of the sealing rubber ring. It can be understood that the image to be processed can be obtained by taking a real-time photograph of the object to be inspected or by acquiring a pre-taken image of the object to be inspected. It should be noted that although the inner circular edge of the sealing rubber ring is used as an example in the present disclosure to describe the defect detection process, embodiments of the present disclosure can also perform defect detection on the outer circular edge of the sealing rubber ring. In addition, in the case where the object to be inspected has multiple arc-shaped edges, defect detection can be performed on any one or more contours, and the present disclosure is not limited thereto.
[0030] Figure 4 Fig. shows a schematic diagram of extracting the arc-shaped edge of an object to be inspected in a method for detecting defects in the arc-shaped edge of an object according to an embodiment of the present disclosure. In embodiments of the present disclosure, various methods can be used to extract the arc-shaped edge of the object to be inspected. As a schematic example, edge extraction algorithms such as the Canny operator and the Laplacian operator can be used to process the image to extract the arc-shaped edge of the object to be inspected from the image. As Figure 4 shown, the inner circular edge of the sealing rubber ring can be extracted through the various edge extraction operators described above. It can be understood that the specific applications of the above-mentioned edge extraction operators are well-known in the art and will not be elaborated here.
[0031] As discussed above, since the object to be inspected may be a soft and deformable arc-shaped object, the object to be inspected may be deformed when being photographed, resulting in the deformation or distortion of its arc-shaped edge in the captured image. In addition, the imaging system of the photographing device may also introduce distortion in the captured image. Due to various factors such as the material of the object to be inspected and / or the imaging system, the edge presented by the object to be inspected in the captured image may not be presented in a standard circular or standard arc shape, but there is a certain degree of distortion. In view of this situation, some existing circular fitting methods may not be able to well fit the ideal standard shape of the entire edge of the object, and thus it is impossible to analyze the location of the defect area based on this. In response to this, the inventors of the present disclosure have noticed that although it may be difficult to accurately fit the ideal edge shape with the entire arc-shaped edge as a unit, if local segmented fitting is performed with relatively short arc segments as units, a fitting result closer to the segmented arc can be obtained. Therefore, the influence of distortion on the fitting process is relatively small. In view of this, different from some existing defect detection methods that perform circular fitting with the entire arc-shaped edge of the object to be inspected as a unit, the idea of segmented circular fitting is proposed in the present disclosure. By dividing the extracted arc-shaped edge into arc segments and performing circular fitting with the divided arc segments as units, the influence of the existence of distortion on the fitting process can be reduced, so as to obtain relatively accurate local fitting results for each divided arc segment.
[0032] It should be noted that the idea of using segmented circular fitting in this application can obtain accurate fitting results for both the case where the original image has no distortion and the case where the original image has distortion. Among them, for the case where the original image has no distortion, the centers and radii of the circular models generated by fitting for each arc segment may be relatively close; for the case where the original image has distortion, after segmented circular fitting, circular models corresponding to each arc segment can still be obtained, but the centers and radii of each circular model may be different (for example, each circular model cannot form concentric circles, etc.). In other words, the existence of distortion only causes differences in parameters such as the centers and radii obtained by local fitting for each segmented arc, but generally, a relatively fitting circular model can still be obtained, rather than the problem that it is difficult to obtain a globally accurate model with the entire edge as a unit in the existing methods. The following returns Figure 2 , and an example of the schematic processing of dividing the extracted arc-shaped edge into arc segments is specifically described.
[0033] In step S102, the circular arc edge of the object is divided into arc segments. In this step S102, a preset division rule can be adopted to divide the extracted circular arc edge to obtain at least one arc segment. For example, historical data on defect detection of the circular arc edges of the same or similar types of objects can be considered, and the statistical result of the size of the defect area reflected by the historical data can be used as the basis for arc segment division. As a schematic example, the average arc length of the defect area of the circular arc edge of the object can be determined according to the historical data related to the defect area of the circular arc edge of the object. Then, the circular arc edge of the object is divided into arc segments according to the average arc length, and the division rule can be set such that each divided arc segment is greater than the average arc length determined according to the historical data, so that the length of any divided arc segment can cover the possible defect area. The following combines Figure 5 to describe an example of a schematic process for dividing the extracted circular arc edge into arc segments.
[0034] Figure 5 shows a schematic diagram of dividing the circular arc edge of an object into arc segments in a method for detecting defects in the circular arc edge of an object according to an embodiment of the present disclosure. As Figure 5 shown, the extracted arc edge can be divided into four equal parts at the corresponding break points (as shown by the mark "×" in Figure 5 ) to obtain arc segments 1 to arc segments 4, and the length of each divided arc segment should be greater than the average arc length determined according to the historical defect detection data. From Figure 5 the division result, it can be seen that the defect on the circular arc edge of the object to be inspected is divided into arc segment 1. It should be noted that the above-mentioned division of the extracted circular arc edge into four equal parts is only a schematic example, and the present disclosure does not limit the number and method of dividing the extracted circular arc edge. For example, the present disclosure can also divide the extracted circular arc edge into other numbers of arc segments, or can also not perform equal division processing on the extracted circular arc edge, but divide it so that each arc segment has a different arc length, as long as the length of each divided arc segment is greater than the average arc length to cover the possible defect area.
[0035] The inventors noticed that when dividing the extracted circular arc edge into arc segments, there are sometimes cases where the defective area is divided into two different arc segments. In this case, since the defect is divided into two arc segments, the differences between the two arc segments obtained after division and the circular model obtained by fitting may not be significant enough, which is not conducive to defect detection. In view of this, the embodiments of the present disclosure can perform multiple different arc segment division processes on the extracted arc segments, so that different arc segment division results can be obtained for the circular arc edge of the object to be inspected in different division processes, thereby reducing the probability that the defective area is divided into two different arc segments. Specifically, in order to perform multiple different arc segment division processes on the circular arc edge to obtain different division results, the division of the extracted circular arc edge according to the determined average arc length may include: first, performing a first arc segment division process on the circular arc edge to divide the circular arc edge into a first plurality of arc segments; then still performing a second arc segment division process on the circular arc edge to divide the circular arc edge into a second plurality of arc segments different from the first plurality of arc segments. Thereby, the first plurality of arc segments and the second plurality of arc segments obtained by the two arc segment divisions can both be used as the arc segments to be fitted, so as to avoid the problem that it is difficult to detect defects when the defective area is divided into different arc segments. Various arc segment division rules can be adopted to make the first division process and the second division process of the circular arc edge of the object to be inspected obtain a plurality of different arc segments from each other. For the sake of completeness of description, the following will be combined with Figure 6 Describe an example of a schematic process for performing two arc segment divisions on the extracted circular arc edge.
[0036] Figure 6 FIG. shows a schematic diagram of performing a first arc segment division process and a second arc segment division process on a circular arc edge in a method for detecting defects in a circular arc edge of an object according to an embodiment of the present disclosure. First, a first arc segment division process can be performed on the circular arc edge to divide the circular arc edge into a first plurality of arc segments at a first plurality of breakpoints. For example, as shown on the left side of Figure 6 , a four-equal division method can be adopted for the first arc segment division process to divide the circular arc edge into four arc segments at the corresponding first breakpoints (such as indicated by the mark "×" in Figure 6 ).
[0037] Then, the first plurality of breakpoints can be rotated by a predetermined angle clockwise or counterclockwise to determine the rotated second plurality of breakpoints, and the circular arc edge can be divided into a second plurality of arc segments at the second plurality of breakpoints. Preferably, the rotation angle should be greater than the angle corresponding to the average arc length of the defective area to ensure that at least one of the two arc segment division processes can obtain effective arc segments. For example, as shown in Figure 6As shown in the upper right, the corresponding first break point (such as Figure 6 indicated by the mark "×" in Figure 6 ) can be rotated clockwise by a predetermined angle to determine the corresponding second break point (such as Figure 6 indicated by the mark "△" in ), and the circular arc edge is divided into four arc segments at the corresponding second break point. It can be understood that the method of rotating the first break point to determine the second break point described above is only an exemplary example. In the embodiments of the present disclosure, other methods can also be used to reselect the second break point, as long as the division at the second break point can obtain a division result different from the first circular arc segment division process. In addition, it should be noted that the first plurality of break points can be arranged equidistantly or non-equidistantly on the extracted circular arc edge, and the second plurality of break points can also be arranged equidistantly or non-equidistantly on the extracted circular arc edge, and the number of the second break points and the number of the first break points can be arbitrarily selected and can be the same or different from each other. It can be seen that in the first circular arc segment division process, the defective area is divided into two arc segments, while in the second circular arc segment division process, the defective area is divided into the same arc segment, so as to at least ensure that an effective arc segment can be obtained in one division process, and avoid the problem of increased detection difficulty caused by the defective area being divided into two arc segments.
[0038] It can be understood that in addition to reselecting the break point to perform the second circular arc segment division process, different division results can also be generated by rotating the extracted edge. For example, the circular arc edge can be rotated clockwise or counterclockwise by a predetermined angle, and the rotated circular arc edge is still divided into the second plurality of arc segments at the first plurality of break points. For example, as Figure 6 shown in the lower right, the circular arc edge can be rotated clockwise or counterclockwise by a predetermined angle, and the circular arc edge of the object to be inspected is still divided into four arc segments at the original first break point (such as Figure 6 indicated by the mark "×" in ). Preferably, the rotation angle should also be greater than the angle corresponding to the average arc length of the defective area to ensure that at least one of the two circular arc segment division processes can obtain an effective arc segment. It can be seen that in the second circular arc segment division process, the defective area is divided into the same arc segment, so as to ensure that at least one of the two divisions can obtain an effective arc segment, and avoid the problem of increased detection difficulty caused by the defective area being divided into two arc segments.
[0039] Those skilled in the art can understand that although the above describes dividing the extracted circular arc edge into two arc segments twice, optionally, third, fourth, and more arc segment divisions can also be performed to further reduce the probability that the defective area is divided into two different arc segments. It can be understood that for the third, fourth, and more arc segment divisions, a method similar to rotating the circular arc edge or reselecting the break point discussed above can be adopted to obtain different division results.
[0040] It should be noted that the above examples describe the process of dividing the entire extracted circular arc edge into arc segments. Optionally, to save the computational burden (e.g., the computational burden of the subsequent fitting process), a rough range that may contain the defective area can be first determined from the entire circular arc edge, and the arc segment division can be performed from this rough range. For example, in the embodiments of the present disclosure, the circular arc edge can be circularly fitted based on the minimum circumscribed circle method to obtain a circular model corresponding to the circular arc edge. It can be understood that this minimum circumscribed circle method may be a fitting algorithm with relatively low fitting accuracy, which can obtain a rough circular fitting result by occupying less computational resources. Alternatively, the average value method, the least square method, etc. can be used to perform a rough fitting on the entire circular arc edge. Then, the difference between the circular arc edge and the obtained circular model can be compared to determine the non-fitting arc segments of the circular arc edge. In the embodiments of the present disclosure, multiple methods can be used to determine the non-fitting arc segments of the circular arc edge. As a schematic example, each edge point on the circular arc edge can be connected to the center of the circle obtained by rough fitting, and the intersection point of the connection line and the obtained circle can be determined to calculate the distance between the edge point and the above intersection point. Then, for the distances calculated for each edge point, a judgment is made, and the arc segment formed by the edge points whose distances exceed a predetermined threshold is used as the non-fitting arc segment in the entire circular arc edge. It can be understood that in order to make the non-fitting arc segment have an arc length capable of dividing at least one arc segment therefrom, the above predetermined threshold can be set to a relatively small value, so that the arc length of the non-fitting arc segment is greater than the average arc length determined according to historical data. Alternatively, when the determined non-fitting arc segment may be relatively short, a certain margin can be set at both ends of the determined non-fitting arc segment for expansion, so that at least one arc segment can be divided from the expanded non-fitting arc segment. Finally, the non-fitting arc segment of the circular arc edge (instead of the entire circular arc edge) can be subjected to the arc segment division process to reduce the number of arc segments obtained after division, and further reduce the computational burden caused by circularly fitting a relatively large number of arc segments.
[0041] The above describes various exemplary processing methods for dividing the circular arc edge of an object into arc segments. The following returns Figure 2, a specific example of the schematic processing of circular fitting for each of the divided arc segments after obtaining them is described.
[0042] In step S103, circular fitting is performed on each of the divided arc segments based on the robust regression algorithm to obtain respective circular models corresponding to each of the arc segments. The inventors of the present disclosure have noticed that for an object with a defect at a certain position on the circular arc edge, the edge points at the defect-free positions on the edge correspond to the inliers (also referred to as consensus values or normal points (inlier), etc.) on the standard circle, while the edge points at the defect positions on the edge correspond to the outliers (also referred to as outliers or abnormal points (outlier), etc.) outside the standard circle. Assuming that both inliers and outliers are taken into account in the fitting process, in the case of a large number of outliers, it will have a greater impact on the fitting model, resulting in the fact that the obtained circular model may not be able to reflect the standard circular contour. The robust regression algorithm is a method in statistical robust estimation, which can solve the problem of being affected by outliers in the fitting process, so that the fitting result can exclude outliers and thus more accurately reflect the standard ideal shape. In view of this, instead of making the inliers and outliers on the arc segment have the same effect on the fitting process, the present application adopts the robust regression algorithm to eliminate the influence of outliers on the fitting result, so as to obtain a more accurate fitting model to more accurately reflect the ideal standard shape of the object to be inspected. Various fitting methods based on the robust regression idea can be used to perform circular fitting on each arc segment. As a schematic example, the random sample consensus method, the Theil-Sen regression method, etc. can be used. Only for the sake of illustration completeness, the random sample consensus method is taken as an example below, in combination with Figure 7 and Figure 8 a specific example of the schematic processing of circular fitting for each of the divided arc segments is described.
[0043] Figure 7 FIG. shows a schematic flowchart of a method for circular fitting of any one of the divided arc segments based on the random sample consensus algorithm in a method for detecting defects in a circular arc edge of an object according to an embodiment of the present disclosure. In this example, based on the idea of random sampling, a part of the points can be randomly selected for circular fitting to obtain an initial fitting model, and the degree of fit between the remaining points outside the selected points and this initial fitting model is evaluated. Then, the process of randomly selecting points and the process of evaluating the remaining points can be iterated several times until there are a sufficient number of remaining points that can fit the fitting model generated in the current iteration, then it is considered that an acceptable fitting result has been obtained. Specifically, the circular fitting process for any one of the segmented arc segments can include the following steps:
[0044] (A) Randomly select three points on the arc segment as internal points. It can be understood that the three points selected in this step are the minimum number of data points required to determine the circular model parameters. Those skilled in the art can select an appropriate number of points as internal points according to the actually selected fitting model.
[0045] (B) Determine a candidate circular model according to the three selected internal points. In this step, the determined candidate circular model can be the circular formula: (x - x 0 ) 2 +(y - y 0 ) 2 =r 2 , and the parameters of the candidate circular model, such as the center coordinates (x 0 , y 0 ) and the radius r, can be determined according to the three selected internal points. It can be understood that the above circular formula is only a schematic example of the circular model. The embodiments of the present disclosure can also adopt more complex fitting models and various fitting models can have different undetermined parameters.
[0046] (C) Determine whether the remaining points on the arc segment are internal points that conform to the candidate circular model. In this step, the conformity degree of each remaining point on the arc segment with the determined candidate circular model can be judged, so as to label each remaining point as an internal point or an external point. As a schematic example, the conformity degree of each remaining point with the candidate circular model can be determined by calculating the distance. Specifically, the distance between each remaining point and the center of the candidate circular model can be calculated, the calculated distance can be compared with the radius of the candidate circular model, and each remaining point can be labeled as an internal point or an external point according to the result of the above comparison. For example, the remaining points that satisfy the condition |dist(p, p 0 ) - r| < Thld can be determined as internal points, where p 0 is the center of the candidate circular model, p is the remaining point on the arc segment, dist(p, p 0 ) represents the distance between p and p 0 , and Thld is a preset distance threshold. According to the above evaluation process, the conformity degree of each remaining point with the circular model obtained in the current iteration process can be judged, that is: whether it is an internal point that conforms to the circular model obtained in the current iteration process or an external point that does not conform to the circular model obtained in the current iteration process.
[0047] (D) Calculate the number of the remaining points that are determined as internal points.
[0048] (E) Determine whether the quantity is greater than a predetermined threshold. In this step, when the quantity is greater than the predetermined threshold, the candidate circular model is taken as the circular model obtained by fitting the arc segment, and when the quantity is not greater than the predetermined threshold, steps (A)-(E) are repeated until the quantity is greater than the predetermined threshold.
[0049] According to the circular fitting process of the embodiments of the present disclosure, through several iterations of the process of randomly selecting points and the process of evaluating the remaining points, until there are a sufficient number of points among the remaining points that can conform to the fitting model of the current iteration, it is considered that an acceptable fitting result has been obtained, and the fitting model generated in the current iteration can be taken as the circular arc model obtained by fitting the arc segment. For each of the remaining arc segments obtained by dividing the arc segment in step S102, similar processing can be adopted to respectively obtain the corresponding circular models, which will not be elaborated here.
[0050] Figure 8 The schematic diagram of the result of circular fitting for any one of the divided arc segments based on the random sample consensus algorithm in the method for detecting defects in the circular arc edge of an object according to the embodiments of the present disclosure is shown. As Figure 8 shown, the thick-line arc segment represents any arc segment that needs to be circularly fitted (as Figure 8 shown as arc segment 1), where the hollow points on the thick-line arc segment represent the outliers that do not fit the standard circular contour, and the solid points represent the inliers that fit the standard circular contour, and the thin-line circle and its center are the circular models obtained by fitting through the random sample consensus algorithm. It can be seen that after the random sample consensus algorithm eliminates the influence of the outliers on the arc segment, the circular model obtained by fitting contains most of the inliers on the arc segment, so that a circular model closer to the standard circular contour can be obtained after fitting. Since the random sample consensus method is adopted, the circular model obtained after fitting can be closer to the standard circle in the ideal case without defects, so that it is easier to detect the outliers corresponding to the defect positions by comparing the differences between the arc segment and the circular model obtained by fitting, and at the same time, the situation of misdetecting image distortion as a defect will not occur. The following returns Figure 2 , and an example of the schematic processing of comparing the differences between the two after obtaining the fitted arc model for the arc segment is described.
[0051] In step S104, the differences between each arc segment and the corresponding circular model are compared to determine whether there are defects in the arc-shaped edge of the object. In this step, since the circular model obtained by fitting excludes the influence of outliers, the circular model obtained by fitting is relatively close to the standard contour when there are no defects. Therefore, if there are large differences between the arc segment and it, it reflects that the arc segment may not have an ideal standard contour. For example, when the standard contour is circular, assuming that there are large differences between the arc segment and the circular model obtained by fitting, it may indicate that the arc segment does not have a standard contour but corresponds to a possible defect. In the embodiments of the present disclosure, various methods can be used to compare the differences between each arc segment and the corresponding circular model. As a schematic example, the method of calculating the difference in the enclosed area can be used.
[0052] Specifically, for any arc segment after division, comparing the difference between it and the corresponding circular model may include the following steps: First, calculate the area difference between the enclosed area of the arc segment and the enclosed area of the corresponding arc segment in the circular model obtained by fitting for the arc segment. Then, compare the area difference with a threshold area difference. When the area difference is greater than the area threshold difference, it is determined that there is a defect in the object with an arc-shaped edge, and the arc segment is determined as the defect area of the object with an arc-shaped edge. The following will be combined with Figure 9 to describe an example of the schematic process of comparing any arc segment with the corresponding circular model based on the comparison method of the area difference.
[0053] Figure 9 shows a schematic diagram of comparing the differences between each arc segment and the corresponding circular model to determine whether there are defects in the arc-shaped edge of the object in the method for detecting defects in the arc-shaped edge of an object according to an embodiment of the present disclosure. First, as shown in the lower left corner of Figure 9 , the two endpoints of the arc segment can be connected, and the area enclosed by the arc segment and this connection line (as shown by the shaded line) can be calculated. Then, as shown in the lower right corner of Figure 9 , the intersection points of the above connection line and the circular model obtained by fitting can be determined, and the arc segment of the circular model between the two intersection points is used as the corresponding arc segment in the circular model obtained by fitting for the arc segment. Similarly, the area enclosed by this corresponding arc segment and this connection line (as shown by the shaded line) can be calculated. Then, the difference between the above two areas can be calculated, and this difference is compared with the threshold area difference to determine whether the arc segment has a large difference from the ideal standard contour, so as to determine whether the arc segment is the defect area of the object to be inspected.
[0054] In addition, for the comparison of the differences between each arc segment and the corresponding circular model, the exclusive OR (XOR) operation can be performed pixel by pixel. Specifically, for any original pixel point in the original captured image, the exclusive OR operation formula P = A ⊕ B can be used to determine whether the pixel point has a consistent positional relationship with respect to both the arc segment and the circular model obtained by fitting (i.e., the pixel point is inside both the arc segment and the circular model, or outside both the arc segment and the circular model, or inside one of them and outside the other, etc.). The difference between the arc segment and the circular model is reflected by the positional relationship between the pixel points with fixed position coordinates and the arc segment and the circular model. For example, let A represent the position of any pixel point to be judged with respect to the arc segment, where A = 0 means the pixel is inside the arc segment and A = 1 means the pixel is outside the arc segment. Let B represent the position of the same pixel point with respect to the circular model obtained by fitting, where B = 0 means the pixel is inside the circular model and B = 1 means the pixel is outside the circular model. Through the exclusive OR operation, the positional consistency result of the fixed pixel point with respect to the arc segment and the circular model can be obtained. That is, if the two operands A and B are "different" (the relative positional relationships are different, i.e., the pixel point is inside one of them and outside the other), the exclusive OR result P is 1, otherwise it is 0. Then, after performing the exclusive OR operation on each pixel point in the original captured image, the overall difference degree between the arc segment and the fitted circular model is reflected by counting the number of pixel points with an exclusive OR result of 1. For example, an arc segment with a statistical quantity greater than a predetermined counting threshold can be determined as the defect area of the object to be inspected.
[0055] It can be understood that the above example uses the segmented arc segment of the object to be inspected as the detection granularity of the defect area. However, it can be understood that the granularity and accuracy of locating the defect part can be flexibly selected by those skilled in the art according to requirements such as calculation speed and accuracy. For example, in the above method of comparing differences by performing the exclusive OR operation pixel by pixel, the interval where the pixel points with an exclusive OR result of 1 on the arc segment of the object to be inspected are located can be used as the pixel-level detection granularity. For example, Figure 9 shows the defect area marked by a dashed square. It can be understood that those skilled in the art can also refine it to a smaller range. In addition, it should be noted that for the clarity of drawing and convenient visual observation, Figure 9 depicts a defect with a relatively large size. However, the defect detection technology of the embodiments of the present disclosure can detect more subtle defects (such as the arc length corresponding to 1° to 2°), and different accuracy levels of defect detection can be achieved by setting corresponding detection thresholds.
[0056] The inventors of the present disclosure also noticed that during the process of comparing the differences between the arc segments and the circular models obtained by fitting, some arc segments may have differences from the corresponding circular models, but the differences may not be obvious. Therefore, this situation may correspond to suspected defects. In this case, it may not be possible to make an accurate conclusion on whether there are defects in the circular edges of the object to be inspected. In view of this, the embodiments of the present disclosure also consider setting different thresholds corresponding to different degrees of difference (for example, the above-mentioned threshold area difference, counting threshold, etc.), so as to make the following conclusions based on different thresholds: it can be reliably determined that there are defects, there are suspected defects, or there are no defects. For example, the above different thresholds may include a first threshold and a second threshold, where: when the difference between each arc segment and the corresponding circular model is greater than the first threshold, it can be reliably determined that there are defects in the corresponding arc segment; when the difference between each arc segment and the corresponding circular model is less than or equal to the first threshold but greater than the second threshold, it is determined that there are suspected defects in the corresponding arc segment; when the difference between each arc segment and the corresponding circular model is less than or equal to the second threshold, it can be determined that there are no defects in the corresponding arc segment.
[0057] For the case of suspected defects, as discussed above, it may be caused by the defective part being divided into two arc segments. Therefore, in order to verify whether there are indeed defects in the object to be inspected, the detection results of this time can be discarded, and the circular edge of the object can be re-divided, and circular fitting and difference comparison are performed on each arc segment obtained by the re-division. Similarly, for the case where no defects are detected, the circular edge of the object can also be re-divided to exclude accidental factors. For example, the method described above in combination with Figure 6 can be used to re-divide the circular edge to try to exclude the influence of the defective part being divided into two arc segments. For example, different from the above combination with Figure 6 where the first and second arc segment division processes are both performed before step Figure 2 S103, in this example, only the first arc segment division process can be performed on the circular edge in Figure 2 S102, so that steps S103 and S104 perform circular fitting and difference comparison on the multiple arc segments obtained by this division, and only when it is determined that there are suspected defects (or no defects) at step S104, return to S102 to perform the second arc segment division process, and perform the processes of S103 and S104 again in a similar manner. In other words, the first arc segment division process and the second arc segment division process can be multiple consecutive division processes without intermediate judgment, or the second arc segment division process can be based on the first arc segment division process and will only be performed when no defects are detected or suspected defects are detected.
[0058] Optionally, after step S104, the method for detecting defects in the circular arc edge of an object according to an embodiment of the present disclosure may further include that, after determining that there are defects in the circular arc edge of the object and determining the defect area, the existence of the defect area may be notified to the user and the defect area may be notified. It can be understood that the above notification method may be conveyed to the user by means of visual notification, audible notification, or perceptible notification, etc., so that the user can respond to the detected defects in a timely manner. For example, when there are no defects in the circular arc edge of the object to be inspected, "OK" may be displayed on the operation interface of the operator, while when there are defects in the circular arc edge of the object to be inspected, "DEFECT" may be displayed on the operation interface, and optionally, the specific defect position of the object to be inspected may be displayed on the operation interface for the operator to further observe or make a manual judgment. For example, Figure 10 FIG. Figure 10 shows a schematic diagram of displaying an enlarged detailed view of the defect position after detecting a defect in the method for detecting defects in the circular arc edge of an object according to an embodiment of the present disclosure. The user can analyze the possible causes of the defect through this enlarged view or eliminate false detections of the machine through manual verification. Another example is that when there are no defects in the circular arc edge of the object to be inspected, a short prompt sound may be played through the speaker of the computer managed by the operator or the mobile device carried with the operator, while when there are defects in the circular arc edge of the object to be inspected, a warning prompt sound may be played through the speaker of the computer managed by the operator or the mobile device carried with the operator, and optionally, information such as the coordinate position, number, and defect area of the object to be inspected may be reported for the operator to search and verify. It can be understood that the above notification methods are only illustrative examples, and the embodiments of the present disclosure may also use other methods to immediately provide the detection results to the operator. In addition, in the automated production line detection operation without human operation, no notification may be issued, but the detection results may be recorded in the file of each product for subsequent automated sorting and rejection. The present disclosure is not limited thereto.
[0059] The method for detecting defects in the arc-shaped edge of an object according to an embodiment of the present disclosure has been described above in conjunction with the accompanying drawings. In this method, considering that the edge of the object to be inspected may be deformed in the captured image, and thus it may be difficult to fit the standard ideal contour of its edge and other problems, the defect detection technology of the present disclosure adopts the idea of segmented circular fitting, divides the arc-shaped edge of the object to be inspected into arc segments, and processes each divided arc segment as a unit. Then, for any of the divided arc segments, a circular fitting method based on robust regression can be used for fitting to determine the circular model corresponding to the arc segment, so as to be able to perform circular fitting on each arc segment more accurately. Finally, after obtaining the corresponding circular model for each arc segment, the difference between the arc segment and the circular model fitted for the arc segment can be compared, so as to determine whether there are defects in the arc-shaped edge of the object to be inspected according to the compared difference. According to the defect detection method provided by the present disclosure, by adopting the idea of segmented circular fitting and performing circular fitting based on the robust regression algorithm, more refined fitting can be performed on the contour of the object to be inspected, so that even in the case of possible image distortion or subtle defects, high-precision defect detection of the arc-shaped edge of the object to be inspected can be achieved.
[0060] Defect detection device
[0061] According to another aspect of the present disclosure, there is provided a device for detecting defects in the arc-shaped edge of an object. The following will be combined with Figure 11 be described in detail the device 1100 for detecting defects in the arc-shaped edge of an object.
[0062] Figure 11 The hardware block diagram of the device for detecting defects in the arc-shaped edge of an object according to an embodiment of the present disclosure is shown. As Figure 11 shown, the device 1100 includes a processor U1101 and a memory U1102.
[0063] The processor U1101 can be any device with processing capabilities that can implement the functions of the various embodiments of the present disclosure. For example, it can be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field programmable gate array signal (FPGA) or other programmable logic devices (PLDs), discrete gate or transistor logic, discrete hardware components or any combination thereof designed to perform the functions described herein.
[0064] The memory U1102 may include a computer system-readable medium in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may also include other removable / non-removable, volatile / non-volatile computer system memories, such as hard disk drives, floppy disks, CD-ROMs, DVD-ROMs, or other optical storage media.
[0065] In this embodiment, computer program instructions are stored in the memory U1102, and the processor U1101 can run the instructions stored in the memory U1102. When the computer program instructions are run by the processor, the processor is caused to execute the method for detecting defects in the arc-shaped edge of an object according to the embodiments of the present disclosure. The method for detecting defects in the arc-shaped edge of an object is substantially the same as that described above for Figures 2 - 10 description, and thus, to avoid repetition, will not be elaborated herein.
[0066] According to another aspect of the present disclosure, there is provided a device for detecting defects in the arc-shaped edge of an object. The following will be combined with Figure 12 to describe in detail the device 1200 for detecting defects in the arc-shaped edge of an object.
[0067] Figure 12 The structural block diagram of the device for detecting defects in the arc-shaped edge of an object according to the embodiments of the present disclosure is shown. As Figure 12 shown, the device 1200 includes an edge extraction unit U1201, an arc segment division unit U1202, a segmented circular fitting unit U1203, and a defect detection unit U1204. Each of the components can respectively execute the steps / functions of the defect detection method described above in combination with Figures 2 - 10 description. Therefore, to avoid repetition, only a brief description of the device will be given below, and the detailed description of the same details will be omitted.
[0068] The edge extraction unit U1201 can extract the arc-shaped edge of the object in the image of the object. For example, the edge extraction unit U1201 can process the image using edge extraction algorithms such as the Canny operator and the Laplacian operator to extract the arc-shaped edge of the object to be inspected from the image.
[0069] The arc segment division unit U1202 can perform arc segment division processing on the circular arc edge of the object. For example, the arc segment division unit U1202 can determine the average arc length of the defective area on the circular arc edge of the object according to the historical data related to the defective area of the circular arc edge of the object. Then, the circular arc edge of the object is divided into arc segments according to the average arc length, and the division rule can be set so that each divided arc segment is greater than the average arc length determined according to the historical data, so that the length of any divided arc segment can cover the possible defective area.
[0070] In addition, considering that the defective area may be divided into two different arc segments during the arc segment division processing, the arc segment division unit U1202 can first perform a first arc segment division processing on the circular arc edge to divide the circular arc edge into a first plurality of arc segments; then still perform a second arc segment division processing on the circular arc edge to divide the circular arc edge into a second plurality of arc segments different from the first plurality of arc segments. Thereby, the first plurality of arc segments and the second plurality of arc segments obtained from the two arc segment divisions can be used as the arc segments to be fitted, so as to avoid the problem that it is difficult to detect defects when the defective area is divided into different arc segments.
[0071] Specifically, the arc segment division unit U1202 can adopt various arc segment division rules to make the first division processing and the second division processing obtain different arc segment division results. For example, the arc segment division unit U1202 can first perform a first arc segment division processing on the circular arc edge to divide the circular arc edge into a first plurality of arc segments at the first plurality of breakpoints. Then, the arc segment division unit U1202 can rotate the first plurality of breakpoints by a predetermined angle clockwise or counterclockwise to determine the rotated second plurality of breakpoints, and divide the circular arc edge into a second plurality of arc segments at the second plurality of breakpoints. Another example is that the arc segment division unit U1202 can rotate the circular arc edge by a predetermined angle clockwise or counterclockwise, and still divide the rotated circular arc edge into a second plurality of arc segments at the first plurality of breakpoints. Preferably, the above rotation angles should be greater than the angle corresponding to the average arc length of the defective area to ensure that at least one of the two arc segment division processes can obtain effective arc segments.
[0072] In addition, for the consideration of saving the computational burden, the arc segment division unit U1202 can also perform circular fitting on the circular arc edge based on the minimum circumscribed circle method to obtain a circular model corresponding to the circular arc edge. Then, the difference between the circular arc edge and the fitted circular model can be compared to determine the non-conforming arc segment of the circular arc edge. Finally, the non-conforming arc segment of the circular arc edge can be processed for arc segment division to reduce the number of arc segments obtained after division, thereby reducing the computational burden caused by performing circular fitting on a relatively large number of arc segments.
[0073] The segmented circular fitting unit U1203 can perform circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to each of the arc segments. For example, the segmented circular fitting unit U1203 can use the random sample consensus method to perform circular fitting on each arc segment. Specifically, for the circular fitting process performed on any one of the arc segments divided by the arc segment division unit U1202, the segmented circular fitting unit U1203 can perform the following processing:
[0074] (A) Randomly select three points on the arc segment as inliers.
[0075] (B) Determine a candidate circular model according to the three selected inliers. For example, the determined candidate circular model can be the circular formula: (x - x 0 ) 2 +(y - y 0 ) 2 =r 2 , and the parameters of the candidate circular model, such as the center coordinates (x 0 , y 0 ) and the radius r, can be determined according to the three selected inliers.
[0076] (C) Determine whether the remaining points on the arc segment are inliers that conform to the candidate circular model. For example, the distance between each remaining point and the center of the candidate circular model can be calculated, the calculated distance can be compared with the radius of the candidate circular model, and each remaining point can be labeled as an inlier or an outlier according to the comparison result.
[0077] (D) Calculate the number of the remaining points that are determined to be inliers.
[0078] (E) Determine whether the number is greater than a predetermined threshold. In this step, when the number is greater than the predetermined threshold, the candidate circular model is used as the circular model fitted for the arc segment, and when the number is not greater than the predetermined threshold, steps (A)-(E) are repeated until the number is greater than the predetermined threshold.
[0079] In other words, the segmented circular fitting unit U1203 can perform several iterations on the process of randomly selecting points and the process of evaluating the remaining points until there are a sufficient number of points among the remaining points that can conform to the fitting model of the current iteration. Then, it is considered that an acceptable fitting result has been obtained, and the fitting model generated in the current iteration can be used as the circular arc model obtained by fitting the arc segment.
[0080] The defect detection unit U1204 can compare the differences between each arc segment and the corresponding circular model to determine whether there are defects in the circular arc edge of the object. For example, for any arc segment after division, the defect detection unit U1204 first calculates the area difference between the enclosed area of the arc segment and the enclosed area of the corresponding arc segment in the circular model obtained by fitting the arc segment. Then, the area difference is compared with a threshold area difference. When the area difference is greater than the area threshold difference, it is determined that the object with a circular arc edge has a defect, and the arc segment is determined as the defect area of the object with a circular arc edge. In addition, the defect detection unit U1204 can also perform difference comparison by means of exclusive OR (XOR) operation on each pixel point.
[0081] Optionally, the device 1200 may further include a notification unit (not shown). After the defect detection unit U1204 determines that there is a defect in the circular arc edge of the object and determines the defect area, the notification unit can notify the user of the existence of the defect area and notify its defect area. For example, the notification unit can use visual notification, audible notification, or perceptible notification and other methods to convey to the user, so that the user can timely respond to the detected defect.
[0082] The device for detecting defects in the circular arc edge of an object according to the embodiments of the present disclosure has been described above in conjunction with the accompanying drawings. The described device for detecting defects in the circular arc edge of an object can perform more refined fitting on the contour of the object to be detected by adopting the idea of segmented circular fitting and based on the robust regression algorithm. Thus, even in the case where there may be image distortion or the defect is subtle, high-precision defect detection of the circular arc edge of the object to be detected can be achieved.
[0083] Computer-readable storage medium
[0084] The method / device for detecting defects in the circular arc edge of an object according to the present disclosure can also be implemented by providing a computer program product including program code for implementing the method or device, or by any storage medium storing such a computer program product.
[0085] The basic principles of the present disclosure have been described in connection with specific embodiments. However, it should be noted that the advantages, benefits, effects, etc. mentioned in the embodiments of the present disclosure are only examples and not limitations. It cannot be considered that these advantages, benefits, effects, etc. are essential for each embodiment of the present disclosure. Additionally, the specific details disclosed above are only for illustrative and facilitating understanding purposes, rather than limitations. The above details do not limit the present disclosure to necessarily implement using the above specific details.
[0086] The block diagrams of the devices, apparatuses, equipment, and systems involved in the embodiments of the present disclosure are only illustrative examples and do not intend to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open-ended terms, meaning "including but not limited to", and can be used interchangeably with each other. The word "or" and "and" used herein refer to the phrase "and / or", and can be used interchangeably with it, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to", and can be used interchangeably with it.
[0087] In addition, as used herein, the "or" used in the listing of items starting with "at least one" indicates a separate listing, so that for example, the listing of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the term "exemplary" does not mean that the described examples are preferred or better than other examples.
[0088] It should also be noted that in the devices and methods of the present disclosure, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present disclosure.
[0089] For those of ordinary skill in the art, all or any part of the methods and apparatuses of the present disclosure can be implemented in any computing device (including processors, storage media, etc.) or a network of computing devices in hardware, firmware, software, or any combination thereof. The hardware can be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array signal (FPGA) or other programmable logic device (PLD), discrete gate or transistor logic, discrete hardware components, or any combination thereof, which are designed to perform the functions described herein. The general-purpose processor can be a microprocessor, but alternatively, the processor can be any commercially available processor, controller, microcontroller, or state machine. The processor can also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors cooperating with a DSP core, or any other such configuration. The software can exist in any form of tangible computer-readable storage medium. By way of example and not limitation, such a tangible computer-readable storage medium can include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other tangible medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer. As used herein, a disk includes a compact disk (CD), a laser disk, an optical disk, a digital versatile disk (DVD), a floppy disk, and a Blu-ray disk.
[0090] Various changes, substitutions, and alterations to the technologies described herein can be made without departing from the teachings defined by the appended claims. In addition, the scope of the claims of the present disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of events, means, methods, and acts described above. Current or later-developed processes, machines, manufactures, compositions of events, means, methods, or acts that perform substantially the same function or achieve substantially the same result as the corresponding aspects described herein can be utilized. Accordingly, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or acts within their scope.
[0091] The foregoing description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0092] The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the present disclosure to the form disclosed herein. Although several example aspects and embodiments have been discussed above, those of skill in the art will recognize some of their variations, modifications, alterations, additions, and subcombinations.
Claims
1. A method for detecting defects on the arcuate edge of an object, comprising: extracting the arcuate edge of the object in the image of the object; dividing the arcuate edge of the object into arc segments; performing circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to each of the arc segments; and comparing the difference between each of the arc segments and the corresponding circular model to determine whether there are defects on the arcuate edge of the object, wherein dividing the arcuate edge of the object into arc segments includes: determining the average arc length of the defective area of the arcuate edge of the object; and dividing the arcuate edge into arc segments according to the average arc length, wherein each divided arc segment is greater than the average arc length.
2. The method according to claim 1, wherein determining the average arc length of the defective area of the arcuate edge of the object includes: determining the average arc length of the defective area of the arcuate edge of the object according to historical data related to the defective area of the arcuate edge of the object.
3. The method according to claim 2, wherein dividing the arcuate edge into arc segments according to the average arc length includes: performing a first arc segment division process on the arcuate edge to divide the arcuate edge into a first plurality of arc segments; and performing a second arc segment division process on the arcuate edge to divide the arcuate edge into a second plurality of arc segments different from the first plurality of arc segments.
4. The method according to claim 3, wherein the first arc segment division process includes: dividing the arcuate edge into the first plurality of arc segments at a first plurality of breakpoints, wherein the second arc segment division process includes: rotating the arcuate edge clockwise or counterclockwise by a predetermined angle and dividing the rotated arcuate edge into the second plurality of arc segments at the first plurality of breakpoints, or rotating the first plurality of breakpoints clockwise or counterclockwise by a predetermined angle to determine a rotated second plurality of breakpoints and dividing the arcuate edge into the second plurality of arc segments at the second plurality of breakpoints.
5. The method according to claim 2, wherein dividing the arcuate edge into arc segments according to the average arc length includes: performing circular fitting on the arcuate edge based on the minimum circumscribed circle method to obtain a circular model corresponding to the arcuate edge; and comparing the difference between the arcuate edge and the obtained circular model by fitting to determine the non-conforming arc segments of the arcuate edge; and performing an arc segment division process on the non-conforming arc segments of the arcuate edge.
6. The method according to any one of claims 1-5, wherein the robust regression algorithm includes the random sample consensus algorithm, and wherein performing circular fitting on each of the divided arc segments based on the robust regression algorithm to obtain respective circular models corresponding to each of the arc segments includes: for any one of the divided arc segments: (A) randomly selecting three points on the arc segment as inliers; (B) determining a candidate circular model according to the three selected inliers; (C) Determine whether the remaining points on the arc segment are inliers that conform to the candidate circular model; (D) Calculate the number of inliers determined among the remaining points; and (E) Determine whether the number is greater than a predetermined threshold, wherein when the number is greater than the predetermined threshold, the candidate circular model is used as the circular model obtained by fitting the arc segment, and when the number is not greater than the predetermined threshold, steps (A)-(E) are repeated until the number is greater than the predetermined threshold.
7. The method according to any one of claims 1-5, wherein, comparing the differences between the respective arc segments and the corresponding circular models to determine whether there are defects in the circular edges of the object includes: For any one of the divided arc segments: Calculate the area difference between the bounding region of the arc segment and the corresponding arc segment in the circular model obtained by fitting the arc segment; and Compare the area difference with a threshold area difference, wherein when the area difference is greater than the threshold area difference, it is determined that the object has a defect and the arc segment is determined as the defect region of the circular edge of the object.
8. An apparatus for detecting defects in a circular edge of an object, comprising: a processor; and a memory storing computer program instructions, wherein when the computer program instructions are run by the processor, the processor is caused to perform the following steps: Extract the circular edge of the object in the image of the object; Perform an arc segment division process on the circular edge of the object; Perform circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to the respective arc segments; and Compare the differences between the respective arc segments and the corresponding circular models to determine whether there are defects in the circular edge of the object, wherein performing an arc segment division on the circular edge of the object includes: Determine the average arc length of the defect region of the circular edge of the object; and Perform an arc segment division on the circular edge according to the average arc length, wherein each divided arc segment is greater than the average arc length.
9. An apparatus for detecting defects in a circular edge of an object, comprising: an edge extraction unit configured to extract the circular edge of the object in the image of the object; an arc segment division unit configured to perform an arc segment division process on the circular edge of the object; a segmented circular fitting unit configured to perform circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to the respective arc segments; and a defect detection unit configured to compare the differences between the respective arc segments and the corresponding circular models to determine whether there are defects in the circular edge of the object, wherein performing an arc segment division on the circular edge of the object includes: Determine the average arc length of the defect region of the circular edge of the object; and Perform an arc segment division on the circular edge according to the average arc length, wherein each divided arc segment is greater than the average arc length.
10. A computer-readable storage medium having computer program instructions stored thereon, wherein, when the computer program instructions are executed, the following steps are implemented: extracting a circular arc edge of the object in an image of the object; performing an arc segment division process on the circular arc edge of the object; performing circular fitting on each of the divided arc segments based on a robust regression algorithm to obtain respective circular models corresponding to the respective arc segments; and comparing the difference between each of the arc segments and the corresponding circular model to determine whether there is a defect in the circular arc edge of the object, wherein performing an arc segment division on the circular arc edge of the object includes: determining an average arc length of a defect region of the circular arc edge of the object; and performing arc segment division on the circular arc edge according to the average arc length, wherein each of the divided arc segments is greater than the average arc length.
Citation Information
Patent Citations
Machine vision-based workpiece defect detection method
CN109900711A