A bottom hemming detection method and related device based on contour fitting comparison
Through the detection method based on contour fitting and alignment, the problem of high error judgment rate of bottom edge detection in the prior art is solved, and the detection accuracy and stability are improved.
Patent Information
- Application Number
- CN202110140293.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-02
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-02-02
AI Technical Summary
The existing bottom edge detection methods are prone to misjudgment when dealing with products with complex morphological characteristics, resulting in low detection accuracy and high misjudgment rate.
The detection method based on contour fitting and alignment is adopted. By obtaining the bottom edge image of the cylindrical workpiece, pre-processing and fitting the minimum circumference circle, the edge edge outline and inner circle are obtained, the area of interest and grayscale areas are determined, and finally, whether it is a defective area is determined by the mean of grayscale.
It improves detection accuracy, reduces the misjudgment rate, and achieves the stability of the detection effect.
Smart Images

Figure CN112927193B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of defect detection, and in particular to a bottom hemming detection method and related device based on contour fitting and comparison. Background Art
[0002] Many cylindrical products often use the process of hemming to make the internal structure tight. The hemming process mainly uses a punch to wrap the excess tail into the bottom of the cylindrical product. However, due to various reasons during the punching process, the hemming may be unqualified, which seriously affects the performance of the product.
[0003] In view of the actual posture of the product, the bottom edge image of the workpiece will have various morphological features. In order to achieve automatic sorting, image processing technology is used to select qualified products from unqualified products and reduce the occurrence of misjudgment and missed judgment.
[0004] At present, there are two main image processing methods for bottom hemming detection, one is the method based on polar coordinate expansion dynamic threshold segmentation, and the other is the method of circular scanning processing. The existing polar coordinate expansion dynamic threshold segmentation algorithm and circular scanning processing algorithm can achieve this defect detection, but due to the complex morphological characteristics of good products, such as metal shavings inside the hemming, and the hemming is affected by many dirty spots on it, many misjudgments are often made.
[0005] Therefore, how to provide a more robust bottom hemming detection method is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0006] The present application provides a bottom hemming detection method and related device based on contour fitting comparison, which achieves the beneficial effect of stabilizing the detection effect, improves the detection accuracy, and reduces the detection misjudgment rate.
[0007] In view of this, the first aspect of the present application provides a bottom edge detection method based on contour fitting comparison, the method comprising:
[0008] Acquire the bottom hemming image of the cylindrical workpiece;
[0009] Preprocessing the bottom edge binding image to determine a first region of interest;
[0010] Fitting a minimum circumscribed circle in the first region of interest;
[0011] Acquire the edge contour line according to the minimum circumscribed circle and determine the contour area;
[0012] Fitting the hemming inner circle according to the hemming contour line;
[0013] Determine a second region of interest and a border grayscale region according to the border contour line, the border inner circle and the contour region;
[0014] According to the grayscale mean value of the edge grayscale area, an error judgment is performed on the second region of interest to determine whether the second region of interest is a defective area.
[0015] Optionally, preprocessing the bottom edge image to determine the first region of interest specifically includes:
[0016] By using a grayscale mapping method, grayscale values in the bottom edge binding image that are greater than a preset fixed value are mapped to the preset fixed value to determine a first region of interest.
[0017] Optionally, fitting the minimum circumscribed circle in the first region of interest specifically includes:
[0018] Traversing all points in the first region of interest, and calculating first distances between any two points;
[0019] Connect the two points with the largest first distance to form a line segment, use the line segment as the diameter of the minimum circumscribed circle, and determine the center of the minimum circumscribed circle;
[0020] The second distances from other points to the center of the circle are calculated, and multi-point circle determination is performed with points whose second distances are greater than the radius of the minimum circumscribed circle to fit the minimum circumscribed circle.
[0021] Optionally, acquiring the edge contour line according to the minimum circumscribed circle and determining the contour area specifically includes:
[0022] Generating a plurality of rectangular areas radially around the minimum circumscribed circle;
[0023] Project all pixels in the long semi-axis direction of each rectangular area and accumulate them, and take the point with the largest adjacent accumulated step value as the contour point;
[0024] The contour points of all the rectangular areas are connected to form a border contour line to determine the contour area.
[0025] Optionally, fitting the hemming inner circle according to the hemming contour line specifically includes:
[0026] The contour points of all the rectangular areas are fitted based on the least square method, the center and radius of the bounding inner circle are determined, and the bounding inner circle is generated.
[0027] Optionally, the determining the second region of interest and the border grayscale region according to the border contour line, the border inner circle and the contour region specifically includes:
[0028] Subtract the edge contour line from the contour area to obtain a second region of interest;
[0029] The edge-binding inner circle is subtracted from the outline area to obtain the edge-binding grayscale area.
[0030] Optionally, performing misjudgment judgment on the second region of interest according to the grayscale mean value of the edge grayscale region to determine whether the second region of interest is a defective region specifically includes:
[0031] Calculate the grayscale mean of the grayscale area of the edge wrapping;
[0032] If the absolute value of the difference between the grayscale value of a pixel point in the edge grayscale area and the grayscale mean value is greater than a first preset threshold, the pixel point is recorded;
[0033] If the number of the recorded pixel points is greater than a second preset threshold, the second region of interest is determined to be a defect region, otherwise it is a false defect determination.
[0034] A second aspect of the present application provides a bottom edge detection device based on contour fitting comparison, the device comprising:
[0035] An acquisition unit, used for acquiring a bottom edge image of a cylindrical workpiece;
[0036] A preprocessing unit, used for preprocessing the bottom edge binding image to determine a first region of interest;
[0037] A first fitting unit, used for fitting the minimum circumscribed circle in the first region of interest;
[0038] A first processing unit, configured to obtain an edge contour line according to the minimum circumscribed circle and determine a contour area;
[0039] A second fitting unit is used to fit the hemming inner circle according to the hemming contour line;
[0040] A second processing unit is used to determine a second region of interest and a border grayscale region according to the border contour line, the border inner circle and the contour region;
[0041] The detection unit is used to perform misjudgment judgment on the second region of interest according to the grayscale mean value of the edge grayscale area, and determine whether the second region of interest is a defective area.
[0042] In a third aspect, the present application provides a bottom hemming detection device based on contour fitting comparison, the device comprising a processor and a memory:
[0043] The memory is used to store program code and transmit the program code to the processor;
[0044] The processor is used to execute the bottom edge detection method based on contour fitting comparison described in any one of the above aspects according to the instructions in the program code.
[0045] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program codes, and the program codes are used to execute the bottom edge detection method based on contour fitting and comparison described in any of the above aspects.
[0046] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0047] In the present application, a bottom edging detection method based on contour fitting and comparison is provided, including obtaining a bottom edging image of a cylindrical workpiece; preprocessing the bottom edging image to determine a first region of interest; fitting a minimum circumscribed circle in the first region of interest; obtaining an edging contour line according to the minimum circumscribed circle to determine a contour area; fitting an edging inner circle according to the edging contour line; determining a second region of interest and an edging grayscale area according to the edging contour line, the edging inner circle and the contour area; and performing misjudgment judgment on the second region of interest according to the grayscale mean of the edging grayscale area to determine whether the second region of interest is a defective area. The present application first selects the first region of interest through a fixed threshold and image position, then obtains the edge contour line according to the fitted minimum circumscribed circle, and determines the contour area, and finally determines the second region of interest and the edge grayscale area according to the fitted edge inner circle, the edge contour line and the contour area. The second region of interest is the part with abnormal edge binding. Since the protruding part of the edge binding belongs to the edge binding material, its grayscale value is similar. Finally, by obtaining the grayscale mean of the edge grayscale area, it is determined whether the second region of interest is a misjudgment, thereby achieving the beneficial effect of stable detection effect, improving detection accuracy, and reducing the misjudgment rate of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A method flow chart of a bottom edge detection method based on contour fitting comparison in this application;
[0049] Figure 2 It is a structural schematic diagram of a bottom hemming detection device based on contour fitting comparison in this application;
[0050] Figure 3 This is the first embodiment diagram of grayscale mapping in this application;
[0051] Figure 4 This is a second embodiment diagram of grayscale mapping in this application;
[0052] Figure 5 This is an embodiment diagram of the minimum circumscribed circle in this application;
[0053] Figure 6 This is an example diagram of a rectangular area in this application;
[0054] Figure 7 This is an example diagram of the hemming contour line in this application;
[0055] Figure 8 This is an embodiment diagram of the inner circle of the hemming in this application;
[0056] Fig. 9 This is an example diagram of the second region of interest in this application;
[0057] Fig.10 This is an example diagram of the grayscale area of the edge-wrapped area in this application;
[0058] Fig.11 This is an example diagram of a misjudged image in this application. DETAILED DESCRIPTION
[0059] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0060] The present application designs a bottom hemming detection method and related devices based on contour fitting and comparison, which achieves the beneficial effect of stabilizing the detection effect, improves the detection accuracy, and reduces the detection misjudgment rate.
[0061] For easier understanding, see Figure 1 , Figure 1 : is a method flow chart of a bottom edge detection method based on contour fitting comparison in an embodiment of the present application, such as Figure 1 As shown, specifically:
[0062] 101. Obtain a bottom edge image of a cylindrical workpiece;
[0063] It should be noted that, firstly, the bottom hemming image of the cylindrical workpiece needs to be obtained.
[0064] 102. Preprocess the bottom edge image to determine a first region of interest;
[0065] Specifically, by using a grayscale mapping method, grayscale values in the bottom edge-binding image that are greater than a preset fixed value are mapped to a preset fixed value to determine the first region of interest.
[0066] It should be noted that, by using the grayscale mapping method, grayscale values greater than a preset fixed value are mapped to a preset fixed value. The purpose of such a processing method is to make the features of the first region of interest more obvious and reduce the interference of noise, such as Figure 3 and Figure 4 As shown, Figure 3 The grayscale mapping parameters are not set properly, resulting in an interfering ring feature in the middle. Figure 4 The grayscale mapping parameters are well set, and the contrast of the inner edge features of the hemming is obvious. However, other dent features caused by the change in the curvature of the hemming are suppressed.
[0067] 103. Fitting the minimum circumscribed circle in the first region of interest;
[0068] Specifically, traverse all points in the first region of interest and calculate first distances between any two points;
[0069] Connect the two points with the largest first distance into a line segment, which is used as the diameter of the minimum circumscribed circle, and determine the center of the minimum circumscribed circle;
[0070] Calculate the second distance from other points to the center of the circle, and use the points whose second distance is greater than the radius of the minimum circumscribed circle to perform multi-point circle determination and fit the minimum circumscribed circle.
[0071] It should be noted that if Figure 5 As shown, after the first region of interest is selected by fixing the threshold and the image position, the minimum circumscribed circle in the first region of interest needs to be fitted.
[0072] 104. Obtain the edge contour line according to the minimum circumscribed circle and determine the contour area;
[0073] Specifically, a number of rectangular areas are generated radially around the minimum circumscribed circle;
[0074] Project all pixels in the long semi-axis direction of each rectangular area and accumulate them, and take the point with the largest adjacent accumulated step value as the contour point;
[0075] Connect the contour points of all rectangular areas to form a bounding contour line and determine the contour area.
[0076] It should be noted that after fitting the minimum circumscribed circle, the edge contour line is obtained according to the minimum circumscribed circle, and the contour area is determined, such as Figure 6 As shown in , the rectangular area is mainly generated radially by the surrounding circle of the fitted minimum circumscribed circle, and the step value is obtained in the rectangular area, where the point with the largest step value is the contour point. The connection of adjacent contour points forms the following Figure 7 Hemming outline shown.
[0077] 105. Fitting the inner circle of the hemming according to the hemming contour line;
[0078] Specifically, the contour points of all rectangular areas are fitted based on the least square method, the center and radius of the bounding inner circle are determined, and the bounding inner circle is generated.
[0079] It should be noted that if Figure 8 As shown, the contour points are fitted based on the least squares method to determine the center and radius of the inner circle of the hemming, and finally the inner circle of the hemming is generated.
[0080] 106. Determine a second region of interest and a border grayscale region according to the border contour line, the border inner circle, and the contour region;
[0081] Specifically, the second region of interest is obtained by subtracting the edge contour line from the contour area;
[0082] Subtract the inner circle of the border from the contour area to obtain the border grayscale area.
[0083] It should be noted that if Fig. 9 and Fig.10 As shown, the second region of interest is the portion with abnormal hemming.
[0084] 107. Perform misjudgment judgment on the second region of interest according to the grayscale mean value of the edge grayscale region to determine whether the second region of interest is a defective region.
[0085] Specifically, the grayscale mean of the grayscale area of the edge is calculated;
[0086] If the absolute value of the difference between the grayscale value of the pixel point in the grayscale area of the edge wrapping and the grayscale mean value is greater than a first preset threshold, the pixel point is recorded;
[0087] If the number of recorded pixel points is greater than the second preset threshold, the second region of interest is determined to be a defective region, otherwise it is a false defect determination.
[0088] It should be noted that the raised part of the hemming is of the hemming material and its grayscale value is similar. In order to reduce misjudgment, the difference between the grayscale value of the pixel points in the grayscale area of the hemming and the grayscale mean is calculated, and the number of pixels is recorded to determine whether the second region of interest is a defective area. When the number of pixels is greater than the second preset threshold, it means that the second region of interest has a defect, otherwise it is Fig.11 The defect shown is misjudged.
[0089] The present application first selects the first region of interest through a fixed threshold and image position, then obtains the edge contour line according to the fitted minimum circumscribed circle, and determines the contour area, and finally determines the second region of interest and the edge grayscale area according to the fitted edge inner circle, the edge contour line and the contour area. The second region of interest is the part with abnormal edge binding. Since the protruding part of the edge binding belongs to the edge binding material, its grayscale value is similar. Finally, by obtaining the grayscale mean of the edge grayscale area, it is determined whether the second region of interest is a misjudgment, thereby achieving the beneficial effect of stable detection effect, improving detection accuracy, and reducing the misjudgment rate of detection.
[0090] See also Figure 2 , Figure 2 Schematic diagram of the structure of a bottom edge detection device based on contour fitting comparison in an embodiment of the present application. Figure 2 As shown, specifically:
[0091] An acquisition unit 201 is used to acquire a bottom edge image of a cylindrical workpiece;
[0092] A preprocessing unit 202 is used to preprocess the bottom edge image to determine a first region of interest;
[0093] A first fitting unit 203, used for fitting the minimum circumscribed circle in the first region of interest;
[0094] The first processing unit 204 is used to obtain the edge contour line according to the minimum circumscribed circle and determine the contour area;
[0095] The second fitting unit 205 is used to fit the hemming inner circle according to the hemming contour line;
[0096] A second processing unit 206 is used to determine a second region of interest and a border grayscale region according to the border contour line, the border inner circle and the contour region;
[0097] The detection unit 207 is used to perform misjudgment judgment on the second region of interest according to the grayscale mean value of the edge grayscale area, and determine whether the second region of interest is a defective area.
[0098] The embodiment of the present application also provides a bottom hemming detection device based on contour fitting comparison, the device including a processor and a memory:
[0099] The memory is used to store the program code and transmit the program code to the processor;
[0100] The processor is used to execute the bottom edge detection method based on contour fitting and comparison in any of the above embodiments according to the instructions in the program code.
[0101] An embodiment of the present application further provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the bottom edge detection method based on contour fitting and comparison described in any of the above embodiments.
[0102] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0103] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0104] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0105] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0106] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0107] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0108] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store program codes.
[0109] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A bottom edge detection method based on contour fitting comparison, characterized in that: include: Acquire the bottom hemming image of the cylindrical workpiece; Preprocessing the bottom edge binding image to determine a first region of interest; Fitting a minimum circumscribed circle in the first region of interest; Acquire the edge contour line according to the minimum circumscribed circle and determine the contour area; Specifically, a number of rectangular areas are generated radially around the minimum circumscribed circle; Project all pixels in the long semi-axis direction of each rectangular area and accumulate them, and take the point with the largest adjacent accumulated step value as the contour point; Connect the contour points of all rectangular areas to form a border contour line and determine the contour area; Fitting the hemming inner circle according to the hemming contour line; Determine a second region of interest and a border grayscale region according to the border contour line, the border inner circle and the contour region; Specifically, the second region of interest is obtained by subtracting the edge contour line from the contour area; Subtract the inner circle of the edge from the contour area to get the grayscale area of the edge; According to the grayscale mean value of the edge grayscale area, performing misjudgment judgment on the second region of interest to determine whether the second region of interest is a defective area; Specifically, the grayscale mean of the grayscale area of the edge is calculated; If the absolute value of the difference between the grayscale value of the pixel point in the grayscale area of the edge wrapping and the grayscale mean value is greater than a first preset threshold, the pixel point is recorded; If the number of recorded pixel points is greater than the second preset threshold, the second region of interest is determined to be a defective region, otherwise it is a false defect determination.
2. The bottom edge detection method based on contour fitting comparison according to claim 1 is characterized in that: The preprocessing of the bottom edge image to determine the first region of interest specifically includes: By using a grayscale mapping method, grayscale values in the bottom edge binding image that are greater than a preset fixed value are mapped to the preset fixed value to determine a first region of interest.
3. The bottom edge detection method based on contour fitting comparison according to claim 1 is characterized in that: The step of fitting the minimum circumscribed circle in the first region of interest specifically includes: Traversing all points in the first region of interest, and calculating a first distance between each two points; Connect the two points with the largest first distance to form a line segment, use the line segment as the diameter of the minimum circumscribed circle, and determine the center of the minimum circumscribed circle; The second distances from other points to the center of the circle are calculated, and multi-point circle determination is performed with points whose second distances are greater than the radius of the minimum circumscribed circle to fit the minimum circumscribed circle.
4. The bottom edge detection method based on contour fitting comparison according to claim 1 is characterized in that: The step of fitting the hemming inner circle according to the hemming contour line specifically comprises: The contour points of all the rectangular areas are fitted based on the least square method, the center and radius of the bounding inner circle are determined, and the bounding inner circle is generated.
5. A bottom hemming detection device based on contour fitting comparison, characterized in that: include: An acquisition unit, used for acquiring a bottom edge image of a cylindrical workpiece; A preprocessing unit, used for preprocessing the bottom edge binding image to determine a first region of interest; A first fitting unit, used for fitting the minimum circumscribed circle in the first region of interest; A first processing unit, configured to obtain an edge contour line according to the minimum circumscribed circle and determine a contour area; The first processing unit is specifically configured to: Generate several rectangular areas radially around the minimum circumscribed circle; Project all pixels in the long semi-axis direction of each rectangular area and accumulate them, and take the point with the largest adjacent accumulated step value as the contour point; Connect the contour points of all rectangular areas to form a border contour line and determine the contour area; A second fitting unit, used for fitting an inner circle of the hemming according to the hemming contour line; A second processing unit, configured to determine a second region of interest and a border grayscale region according to the border contour line, the border inner circle and the contour region; The second processing unit is specifically used for: Subtract the edge contour line from the contour area to obtain the second region of interest; The inner circle of the edge is subtracted from the outline area to obtain the edge gray area; the detection unit is used to make an error judgment on the second region of interest according to the gray mean of the edge gray area to determine whether the second region of interest is a defect area; The detection unit is specifically used for: Calculate the grayscale mean of the grayscale area of the edge; If the absolute value of the difference between the grayscale value of the pixel point in the grayscale area of the edge wrapping and the grayscale mean value is greater than a first preset threshold, the pixel point is recorded; If the number of recorded pixel points is greater than the second preset threshold, the second region of interest is determined to be a defective region, otherwise it is a false defect determination.
6. A bottom hemming detection device based on contour fitting comparison, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the bottom edge detection method based on contour fitting comparison according to any one of claims 1 to 4 according to the instructions in the program code.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes, and the program codes are used to execute the bottom hemming detection method based on contour fitting comparison according to any one of claims 1 to 4.
Citation Information
Patent Citations
Edge defect detection method and system for glass panel
CN105405142A
Vision-based LED chip quality detection method
CN110490847A