Plate processing drilling defect recognition method and system based on machine vision
Through machine vision technology, the Gaussian core size in Canny edge detection algorithm is dynamically adjusted, which solves the defect problem caused by external factors during the drilling of the plate, and achieves more accurate hole position defect identification, improving production quality and efficiency.
Patent Information
- Application Number
- CN202411644615.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2044-11-18
AI Technical Summary
In the prior art, during the drilling process of sheets, defects occur in the drilling edge due to external factors such as drill bit wear and unstable machine tool, which affects product quality and production efficiency.
Using a machine vision-based method, the grayscale map of the plate is obtained, and the Canny edge detection algorithm is used to dynamically adjust the Gaussian core size based on the texture width and the connection domain distance, and the edge detection algorithm is optimized to identify hole position defects.
It improves the accuracy of identification of plate drilling defects, reduces false detection and missed inspection, ensures effective detection of hole defects under different conditions, and improves production quality and efficiency.
Smart Images

Figure CN119444731B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing and to a method and system for identifying drilling defects in plate processing based on machine vision. Background Art
[0002] With the development of the manufacturing industry, sheet metal processing, as a crucial link in the manufacturing process, has seen technological advancements have a profound impact on the quality and efficiency of the entire manufacturing industry. Sheet metal processing involves multiple aspects, including cutting, forming, and drilling, with drilling being an essential step in the joining and assembly processes. To improve production efficiency and reduce human error, the demand for automated and intelligent drilling systems continues to grow.
[0003] At present, the patent application document with publication number CN117483838A discloses an artificial intelligence-based plate drilling method and device, which includes: controlling a preset lathe device to perform drilling operations on the plate to be processed through multiple target drilling paths, collecting real-time image data of the plate to be processed during the drilling operation and performing drilling parameter analysis; performing drilling deviation analysis on the plate to be processed based on the drilling depth data and drilling position data obtained from the parameter analysis to obtain drilling deviation data; and performing control parameter analysis on the lathe based on the drilling deviation data to obtain target control parameters, and controlling the lathe to perform drilling control on the plate to be processed according to the target control parameters.
[0004] Although the above operation solves the problem of difficulty in timely detection and correction of processing deviations during the drilling process, there may still be some external influencing factors such as drill bit wear and machine tool instability during the drilling parameter analysis, which may lead to defects on the edge of the drill hole, thereby affecting the quality and efficiency of plate processing. Summary of the Invention
[0005] In order to solve the above-mentioned technical problem that external factors cause defects in the edge of the drilled holes during the plate processing and drilling process, thereby affecting product quality and production efficiency, the present invention provides solutions in the following aspects.
[0006] In a first aspect, a method for identifying drilling defects in plate processing based on machine vision includes:
[0007] Get the grayscale image of the plate containing the holes;
[0008] The grayscale image is binarized to obtain a binary image, and the binary image is used to detect hole defects using the Canny edge detection algorithm to obtain defect recognition results;
[0009] The texture width of each connected domain in the binary image is calculated, and the size of the Gaussian kernel in the Canny edge detection algorithm is adjusted based on the distance between the connected domains and the texture width.
[0010] When the average of the texture widths of all connected domains is less than or equal to the average of the distances between all connected domains, the size of the Gaussian kernel is: ; Conversely, the size of the Gaussian kernel is: ; is the size of the Gaussian kernel, In the binary image The texture width of the connected domain, For the The connected domain and The distance between adjacent connected domains of a connected domain, is the number of connected regions in the binary graph, is an odd conversion function, is the minimum function.
[0011] The present invention first obtains a grayscale image of a plate containing holes and performs binarization processing, and then applies the Canny algorithm to perform edge detection on the binary image. By analyzing the characteristics of the plate holes, such as texture width and the distance between connected domains, the size of the Gaussian kernel is dynamically adjusted, and the edge detection algorithm is optimized to make it more adaptable to the specific characteristics of the holes on the plate. This helps to more accurately identify tiny defects at the edges of the holes, thereby timely discovering and correcting these problems during the production process, and improving the quality and efficiency of plate processing.
[0012] Preferably, the step of binarizing the grayscale image to obtain a binary image further includes:
[0013] Calculate the possibility of hole position existence of each row of pixels and each column of pixels in the grayscale image respectively;
[0014] The hole existence possibility of the pixel points calculated in the grayscale image is mapped to the relative position of the binary image.
[0015] By more accurately locating the holes, both false detections (misidentifying non-hole areas as holes) and missed detections (failing to identify true holes) can be reduced.
[0016] Preferably, after calculating the texture width of each connected region in the binary image, the method further includes:
[0017] Correct the initial texture width to get the optimal texture width.
[0018] By correcting the initial texture width, misjudgment caused by inaccurate texture width measurement can be reduced, such as misidentifying normal hole positions as defective hole positions.
[0019] Preferably, the optimal texture width satisfies the relationship:
[0020] Where, In the binary image The optimal texture width of a connected domain, is the minimum function, For the The height of the circumscribed rectangle of a connected region, For the The width of the circumscribed rectangle of a connected region, is the correction factor, It is an exponential function with the natural constant e as its base.
[0021] Preferably, the correction factor is expressed as:
[0022] Where, is the minimum function, For the The average value of the hole existence probability of the vertical coordinates of all pixels in a connected domain, For the The average value of the hole existence probability of the horizontal coordinates of all pixels in a connected domain.
[0023] By introducing a correction factor in the form of an exponential function, the influence of image noise or measurement error on the texture width measurement results can be reduced. Since the holes may have different shapes and sizes, this correction method based on the minimum enclosing rectangle and the possibility of hole locations can provide more flexible size adjustment.
[0024] Preferably, the expression for the possibility of the hole position of each row of pixels in the grayscale image is:
[0025] Where, In the grayscale image There is a possibility that the hole position of the row pixel point is For the The sum of the grayscale values of all pixels in the row, is the minimum value of the sum of the grayscale values of pixels in all rows of the grayscale image. is the number of rows of the grayscale image, It is an exponential function with the natural constant e as its base.
[0026] Preferably, the expression for the possibility of the hole position of each column of pixels in the grayscale image is:
[0027] Where, In the grayscale image There is a possibility that there are holes in the column pixels. For the The sum of the grayscale values of all pixels in the column, is the minimum value of the sum of the grayscale values of the pixels in all columns of the grayscale image. is the number of columns of the grayscale image, It is an exponential function with the natural constant e as its base.
[0028] Calculating the probability of hole existence in each row and column provides additional spatial information for the image and helps to understand the distribution pattern of hole positions in the image.
[0029] Preferably, the optimal texture width satisfies the relationship:
[0030] Where, In the binary image The optimal texture width of a connected domain, is the minimum function, For the The height of the circumscribed rectangle of a connected region, For the The width of the circumscribed rectangle of a connected region, is the correction factor.
[0031] In the second aspect, a plate processing drilling defect recognition system based on machine vision includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned plate processing drilling defect recognition method based on machine vision is implemented.
[0032] Beneficial effect: The present invention maps the hole existence possibility of the pixel points calculated in the grayscale image to the relative position of the binary image, thereby enhancing the characteristics of the defective area in the binary image, and dynamically adjusts the algorithm parameters according to the actual drilling characteristics of the plate by calculating the texture width of each connected domain in the binary image, ensuring that defects can be effectively detected under different conditions, thereby more accurately detecting hole defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an illustrative and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0034] Figure 1 This is a method flow chart of steps S1 to S2 in a plate processing drilling defect recognition method based on machine vision in an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0036] In the production process of panel furniture, holes are drilled in the panels, and the panels are fixed to each other by matching the holes with connectors to form a cabinet structure. However, during the drilling process, burrs often appear on the edges of the holes due to external factors such as drill bit wear and machine tool instability, affecting the quality and efficiency of panel processing. Therefore, the present invention adopts Canny edge detection to extract the edges of the images of the panel holes, and detects whether there are burrs on the holes through the extracted hole edges.
[0037] The embodiment of the present invention discloses a method for identifying drilling defects in plate processing based on machine vision, referring to Figure 1 , including steps S1 and S2, specifically as follows:
[0038] S1: Obtain a grayscale image of the plate containing the holes.
[0039] In an embodiment of the present invention, an industrial camera or a camera is used to capture an image of a plate containing holes, and the captured plate image is preprocessed, including operations such as denoising and contrast enhancement, and then the plate image is converted into a grayscale image.
[0040] S2: Binarize the grayscale image to obtain a binary image, and perform hole defect detection on the binary image according to the Canny edge detection algorithm to obtain a defect recognition result.
[0041] Since the plate has texture and the texture of the plate may be mistaken for the edge, when using the Canny edge detection algorithm, especially when using the Gaussian filter to smooth the image, it may cause the texture details to be lost or the edge information to be over-smoothed, which may lead to false detection or missed detection of the hole edge.
[0042] After obtaining the grayscale image in step S1 above, since the holes in the grayscale image have lower grayscale values, the sum of the grayscale values of the pixels in a row and a column corresponding to the holes is significantly lower than the sum of the grayscale values of the pixels in other locations. Therefore, the rows and columns of the grayscale image can be traversed. By calculating the difference between the pixel sum of each row or column and the minimum pixel sum in each row or column and performing normalization, the probability of the hole in each row or column can be obtained. The smaller the difference, the more likely the row or column contains a hole.
[0043] For example, for the grayscale image The probability of the hole position existing is calculated as follows:
[0044]
[0045] Where, In the grayscale image There is a possibility that the hole position of the row pixel point is For the The sum of the grayscale values of all pixels in the row, is the minimum value of the sum of the grayscale values of pixels in all rows of the grayscale image. is the number of rows of the grayscale image, It is an exponential function with the natural constant e as its base.
[0046] For the grayscale image The probability of the hole position existing is calculated as follows:
[0047]
[0048] Where, In the grayscale image There is a possibility that there are holes in the column pixels. For the The sum of the grayscale values of all pixels in the column, is the minimum value of the sum of the grayscale values of the pixels in all columns of the grayscale image. is the number of columns of the grayscale image, It is an exponential function with the natural constant e as its base.
[0049] In which, by dividing or Normalization is performed to limit the calculation results to a reasonable range to facilitate comparison and calculation.
[0050] Specifically, an adaptive threshold binarization operation is performed on the grayscale image of the plate to obtain a binary image. In the binary image, texture and other features may form a connected area, that is, a group of adjacent pixels share the same pixel value; through connected domain analysis, the texture width of each connected domain is calculated (the initial estimate of the texture width usually depends on the height and width of the circumscribed rectangle of the connected area), and the texture features in the image are extracted and analyzed.
[0051] It should be noted that different styles of plates have different textures, and these textures may vary in length, which appears as different states in the grayscale image. At the same time, the presence of holes may affect the judgment of the plate texture width. Therefore, the calculated texture width (i.e., the initial texture width) can be corrected to obtain the optimal texture width to reduce this effect.
[0052] Specifically, the hole existence probability calculated in the grayscale image is mapped to the corresponding position in the binary image. This means that if the hole existence probability of a row or column in the grayscale image is higher, then the pixels in the corresponding row or column in the binary image may be assigned different values or attributes to indicate that they are more likely to be hole locations.
[0053] For each connected region, calculate the average of the vertical coordinates (i.e., row numbers) of all pixels in the region. For example, if the horizontal coordinates (i.e., column numbers) of the pixels in a connected region are between 100 and 110, then calculate the average of the probability of the presence of a hole in these 11 columns of pixels. Similarly, calculate the average of the horizontal coordinates of all pixels in each connected region to determine the approximate horizontal position of the hole. By analyzing the pixel coordinates of these connected regions, the influence of the hole on the texture width judgment is further reduced, because by calculating the average coordinate of the connected region, the influence of individual holes can be ignored to a certain extent.
[0054] For example, the optimal texture width is:
[0055]
[0056] Where, In the binary image The optimal texture width of a connected domain, is the minimum function, For the The height of the circumscribed rectangle of a connected region, For the The width of the circumscribed rectangle of a connected region, is the correction factor, It is an exponential function with the natural constant e as its base.
[0057] Among them, the correction factor The relationship is as follows:
[0058]
[0059] Where, is the minimum function, For the The average value of the hole existence probability of the vertical coordinates of all pixels in a connected domain, For the The average value of the hole existence probability of the horizontal coordinates of all pixels in a connected domain.
[0060] Among them, when When it is larger, it indicates that the connected area is more likely to be formed by pores. Smaller, yes The degree of correction is large, which effectively reduces the problem of excessive texture width caused by the hole position; when When it is smaller, it indicates that the connected area is more likely to be a real texture area. Close to 1, yes The degree of correction is smaller.
[0061] In another embodiment, the optimal texture width also satisfies the relationship:
[0062]
[0063] Where, In the binary image The optimal texture width of a connected domain, is the minimum function, For the The height of the circumscribed rectangle of a connected region, For the The width of the circumscribed rectangle of a connected region, is the correction factor.
[0064] Similarly, according to the above calculation The optimal texture width of each connected domain can be calculated by using the method of the optimal texture width of each connected domain.
[0065] After the texture width is calculated, the size of the Gaussian kernel in the Canny edge detection algorithm is adjusted based on the distance between connected domains and the texture width.
[0066] Specifically, when the average texture width of all connected domains is less than or equal to the average distance between all connected domains, a smaller Gaussian kernel is required to avoid missed burrs due to oversmoothing. The size of the Gaussian kernel satisfies the following relationship: ;
[0067] On the contrary, a larger Gaussian kernel is needed to better smooth the texture and reduce false detection of burrs. The size of the Gaussian kernel satisfies the relationship: ;
[0068] Where, is the size of the Gaussian kernel, In the binary image The texture width of the connected domain, For the The connected domain and The distance between adjacent connected domains of a connected domain, is the number of connected regions in the binary graph, is an odd conversion function, is the minimum function.
[0069] Among them, the odd conversion function ensures that the size of the Gaussian kernel is an odd number, which helps to maintain the symmetry of the convolution operation and thus makes edge detection more accurate.
[0070] After dynamically adjusting the size of the Gaussian kernel in the Canny edge detection algorithm, the Canny edge detection algorithm is applied to the plate image to detect hole defects, thereby accurately identifying burr defects. Subsequent staff can perform corresponding processing operations.
[0071] An embodiment of the present invention also discloses a plate processing drilling defect recognition system based on machine vision, including a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, a plate processing drilling defect recognition method based on machine vision according to the present invention is implemented.
[0072] The system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and therefore will not be described in detail here.
[0073] In the present invention, the aforementioned memory can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic storage medium or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store the required information and can be accessed by an application, module, or both. Any such computer storage medium can be part of, accessible to, or connected to the device.
[0074] In the description of this specification, "multiple" and "several" mean at least two, such as two, three or more, unless otherwise clearly defined.
[0075] While several embodiments of the present invention have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.
Claims
1. A plate processing drilling defect recognition method based on machine vision, characterized in that: include: Get the grayscale image of the plate containing the holes; The grayscale image is binarized to obtain a binary image, and the binary image is used to detect hole defects using the Canny edge detection algorithm to obtain defect recognition results; The texture width of each connected domain in the binary image is calculated, and the size of the Gaussian kernel in the Canny edge detection algorithm is adjusted based on the distance between the connected domains and the texture width. When the average of the texture widths of all connected domains is less than or equal to the average of the distances between all connected domains, the size of the Gaussian kernel is: ; Conversely, the size of the Gaussian kernel is: ; is the size of the Gaussian kernel, In the binary image The texture width of the connected domain, For the The connected domain and The distance between adjacent connected domains of a connected domain, is the number of connected regions in the binary graph, is an odd conversion function, is the minimum function.
2. The plate processing drilling defect recognition method based on machine vision according to claim 1 is characterized in that: The step of performing binarization processing on the grayscale image to obtain a binary image further includes: Calculate the possibility of hole position existence of each row of pixels and each column of pixels in the grayscale image respectively; The hole existence possibility of the pixel points calculated in the grayscale image is mapped to the relative position of the binary image.
3. The plate processing drilling defect recognition method based on machine vision according to claim 2 is characterized in that: After calculating the texture width of each connected region in the binary image, the method further includes: Correct the initial texture width to get the optimal texture width.
4. The plate processing drilling defect recognition method based on machine vision according to claim 3 is characterized in that: The optimal texture width satisfies the relationship: Where, In the binary image The optimal texture width of a connected domain, is the minimum function, For the The height of the circumscribed rectangle of a connected region, For the The width of the circumscribed rectangle of a connected region, is the correction factor, It is an exponential function with the natural constant e as its base.
5. The plate processing drilling defect recognition method based on machine vision according to claim 4 is characterized in that: The expression of the correction factor is: Where, is the minimum function, For the The average value of the hole existence probability of the vertical coordinates of all pixels in a connected domain, For the The average value of the hole existence probability of the horizontal coordinates of all pixels in a connected domain.
6. The plate processing drilling defect recognition method based on machine vision according to claim 5 is characterized in that: The expression for the possibility of hole position existence of each row of pixels in the grayscale image is: Where, In the grayscale image There is a possibility that the hole position of the row pixel point is For the The sum of the grayscale values of all pixels in the row, is the minimum value of the sum of the grayscale values of pixels in all rows of the grayscale image. is the number of rows of the grayscale image, It is an exponential function with the natural constant e as its base.
7. The plate processing drilling defect recognition method based on machine vision according to claim 6 is characterized in that: The expression for the possibility of hole position existence of each column of pixels in the grayscale image is: Where, In the grayscale image There is a possibility that there are holes in the column pixels. For the The sum of the grayscale values of all pixels in the column, is the minimum value of the sum of the grayscale values of the pixels in all columns of the grayscale image. is the number of columns of the grayscale image, It is an exponential function with the natural constant e as its base.
8. The plate processing drilling defect recognition method based on machine vision according to claim 3 is characterized in that: The optimal texture width satisfies the relationship: Where, In the binary image The optimal texture width of a connected domain, is the minimum function, For the The height of the circumscribed rectangle of a connected region, For the The width of the circumscribed rectangle of a connected region, is the correction factor.
9. The plate processing drilling defect recognition system based on machine vision is characterized by: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the plate processing drilling defect recognition method based on machine vision according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Plate drilling method and device based on artificial intelligence
CN117483838A
Industrial image detection method based on improved canny algorithm
CN114549525A