Method and system for detecting burrs of mechanical parts based on image processing

Through image processing-based methods, the feature descriptor and glitch probability of edge pixel points of mechanical parts are calculated, and the ideal edge image is obtained, which solves the accuracy and efficiency of traditional detection methods and achieves efficient and accurate glitch detection.

CN115239661BActive Publication Date: 2025-06-17HENAN POINTER NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210851986.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2025-06-17
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

Traditional mechanical parts burr detection methods have poor accuracy, high labor costs, and great efficiency due to personnel proficiency and fatigue. Infrared detection equipment is complex and expensive, and environmental conditions are high, resulting in excessive costs.

Method used

Using an image-based processing method, by obtaining the surface image of the part to be detected, determining the actual edge image, calculating the feature descriptor of the edge pixel point, determining the non-glitched edge pixel point and its feature descriptor, calculating the glitch probability of the edge pixel point, obtaining the ideal edge image, and finally determining the glitch detection result by comparing the actual and ideal edge images.

Benefits of technology

It improves the accuracy and efficiency of burr detection, reduces labor costs, avoids the complexity and high cost of infrared detection equipment, and adapts to various environmental conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115239661B_ABST
    Figure CN115239661B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for detecting burrs of mechanical parts based on image processing, comprising: obtaining a surface image of a part to be detected, and then determining its actual edge image; obtaining the number and grayscale of each edge pixel point in a preset neighborhood of each edge pixel point in the actual edge image, and then obtaining a feature descriptor of each edge pixel point, thereby determining each non-burr edge pixel point in each edge pixel point and its corresponding feature descriptor, and finally determining the probability of each edge pixel point being a burr; according to the probability of each non-burr edge pixel point and each edge pixel point being a burr, obtaining an ideal edge image of the part to be detected without burrs, and then determining the burr detection result of the part to be detected. The present invention not only improves the detection efficiency of burrs of mechanical parts, but also helps to improve the accuracy of burr detection and save labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for detecting burrs on mechanical parts based on image processing. Background Art

[0002] With the rapid development of my country's industry in the past two years, the demand for mechanical parts is increasing. However, during the processing of mechanical parts, burrs often appear on the edges of parts, that is, there are uneven flashes on the edges of cold-cut, hot-sawed or flame-cut steel. Generally, parts are allowed to have burrs of a certain height, but some mechanical parts such as welded pipes must be smoothed and deburred for internal and external burrs. In order to ensure the processing and production quality of mechanical parts, burr detection is required for mechanical parts.

[0003] The traditional burr detection method is generally to check whether there are burrs on parts and the specific location of burrs by visual inspection on site by staff or remote viewing of camera images. This detection method not only takes a long time and has high labor costs, but the detection efficiency is greatly affected by the proficiency of staff and the degree of fatigue at work. It is very easy to miss burrs that are very small or in hidden locations. In addition, infrared rays can usually be used to detect burrs on parts, but the equipment used in the infrared detection method of burrs on parts is relatively complex and expensive. Infrared detection of burrs on parts also has high requirements for environmental conditions, making the cost of the burr detection process too high. Summary of the invention

[0004] In order to solve the technical problem of poor accuracy in burr detection of mechanical parts mentioned above, the object of the present invention is to provide a method and system for burr detection of mechanical parts based on image processing.

[0005] In order to solve the above technical problems, the present invention provides a method for detecting burrs of mechanical parts based on image processing, comprising the following steps:

[0006] Acquire a surface image of the part to be inspected, and then determine an actual edge image of the part to be inspected;

[0007] Obtain the number and grayscale of each edge pixel in a preset neighborhood of each edge pixel in the actual edge image of the part to be detected, and obtain a feature descriptor of each edge pixel in the actual edge image according to the number and grayscale of each edge pixel in the preset neighborhood of each edge pixel;

[0008] According to the feature descriptors of each edge pixel in the actual edge image, each non-burr edge pixel in each edge pixel in the actual edge image and its corresponding feature descriptor are determined, and then the probability of each edge pixel in the actual edge image being a burr is determined;

[0009] According to the probability of each non-burr edge pixel point and each edge pixel point being a burr, an ideal edge image of the part to be inspected without burrs is obtained;

[0010] The burr detection result of the part to be detected is determined according to the actual edge image of the part to be detected and the ideal edge image of the part to be detected without burrs.

[0011] Furthermore, the step of obtaining an ideal edge image of the part to be inspected without burrs includes:

[0012] Establish a coordinate system based on the actual edge image of the part to be inspected, and obtain the actual coordinates of each edge pixel point of the actual edge image;

[0013] Clustering each non-burr edge pixel point according to the actual coordinates of each non-burr edge pixel point, so as to obtain each dense area;

[0014] According to the actual horizontal coordinates corresponding to the non-burr edge pixels in each dense area and the burr pixels in each dense area, the ideal coordinates corresponding to the burr pixels in each dense area are obtained;

[0015] According to the actual coordinates of each non-burr edge pixel point in each dense area and the ideal coordinates of each burr pixel point, the ideal edge corresponding to each dense area is obtained;

[0016] According to the ideal edges corresponding to each dense area and the actual coordinates of each edge pixel point not in each dense area and the probability of being a burr, an ideal edge image of the part to be inspected without burrs is determined.

[0017] Further, the step of determining an ideal edge image of the part to be inspected without burrs includes:

[0018] Determine the nearest edge pixel point that is not in each dense area at any end of the ideal edge corresponding to the dense area, and determine the predicted ordinate coordinate of the nearest edge pixel point that is not in each dense area according to the ideal edge and the actual abscissa coordinate of the nearest edge pixel point that is not in each dense area;

[0019] Determine the ideal ordinate of the nearest edge pixel point not in each dense area according to the predicted ordinate, the actual ordinate, and the probability of being a burr of the nearest edge pixel point not in each dense area;

[0020] According to the actual horizontal coordinate and ideal vertical coordinate of the nearest edge pixel point not in each dense area, the ideal edge corresponding to the dense area is updated to obtain the updated ideal edge corresponding to the dense area, and the nearest edge pixel point not in each dense area at any end of the ideal edge corresponding to the updated dense area is determined, and the above steps are repeated until the ideal vertical coordinates of all edge pixel points not in each dense area are determined.

[0021] Furthermore, the calculation formula for determining the ideal ordinate of the nearest edge pixel point that is not in each dense area is as follows:

[0022]

[0023] Among them, Y k is the ideal ordinate corresponding to the nearest edge pixel point k at any end of the ideal edge corresponding to the dense area, which is not in each dense area, p(x k ,y k ) is the probability that the edge pixel k closest to any end of the ideal edge corresponding to the dense area and not in each dense area is a burr, is the predicted ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, y k is the actual ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, x k is the actual horizontal coordinate of the nearest edge pixel point k that is not in each dense area at any end of the ideal edge corresponding to the dense area.

[0024] Furthermore, the step of obtaining the feature descriptor of each edge pixel includes:

[0025] Calculating the grayscale gradient of each edge pixel within a preset neighborhood of each edge pixel, and determining the grayscale gradient change characteristics of each edge pixel according to the grayscale gradient of each edge pixel within the preset neighborhood of each edge pixel;

[0026] A feature descriptor of each edge pixel is obtained according to the number of each edge pixel in a preset neighborhood of each edge pixel and the grayscale gradient change characteristics of each edge pixel.

[0027] Furthermore, the step of calculating the grayscale gradient change characteristics of each edge pixel includes:

[0028] Obtaining gradient unit vectors of two adjacent edge pixel points within a preset neighborhood of the edge pixel point, and then obtaining cosine similarity of the gradient unit vectors of two adjacent edge pixel points within the preset neighborhood of the edge pixel point;

[0029] According to the cosine similarity of the gradient unit vectors of two adjacent edge pixel points in the preset neighborhood of the edge pixel point, a change sequence of the gradient unit vector of the edge pixel point in the preset neighborhood is determined, and then an autocorrelation matrix of the edge pixel point is obtained;

[0030] According to the autocorrelation matrix of the edge pixel point, the grayscale gradient change characteristics of the edge pixel point are determined.

[0031] Furthermore, the step of determining the probability of burrs existing at each edge pixel point includes:

[0032] The similarity between the feature descriptor of each edge pixel and the feature descriptor of each non-burr edge pixel is calculated, and the similarity between the two is used as the probability that the corresponding edge pixel is a burr.

[0033] Furthermore, the calculation formula for calculating the probability of each edge pixel being a burr is as follows:

[0034]

[0035] Among them, p(x,y) is the probability that the edge pixel (x,y) is a burr, N (x,y) is the number of edge pixels in the preset neighborhood of the edge pixel point (x, y), N0 is the number of edge pixels in the preset neighborhood of the non-burr pixel point, T (x,y) is the grayscale gradient change feature of the edge pixel (x, y), and T0 is the grayscale gradient change feature of the non-burr pixel.

[0036] Furthermore, the step of obtaining the burr detection result of the part to be detected includes:

[0037] An XOR operation is performed on the real edge image of the part to be inspected and the ideal edge image of the part to be inspected without burrs, a comparison image corresponding to the two edge images is obtained, and the burr area of ​​the part to be inspected is obtained according to the comparison image.

[0038] A mechanical parts burr detection system based on image processing comprises a processor and a memory, wherein the processor is used for processing instructions stored in the memory to implement a mechanical parts burr detection method based on image processing.

[0039] The present invention has the following beneficial effects:

[0040] The present invention first obtains the actual edge image of the part to be detected, and obtains the feature descriptor of each edge pixel point according to the number of each edge pixel point in the neighborhood of each edge pixel point in the actual edge image of the part to be detected and the grayscale change characteristics of each edge pixel point, the purpose of which is to determine the burr characteristics of each edge pixel point, that is, to obtain the probability of each edge pixel point being a burr. Through the probability of each edge pixel point being a burr, each non-burr edge pixel point in each edge pixel point can be accurately determined, and then the ideal coordinates of each non-burr edge pixel point in the ideal edge image can be obtained, thereby obtaining an ideal edge image without burrs, and by comparing the ideal edge image and the actual edge image of the part to be detected, the burr detection results of different positions of the part to be detected can be accurately obtained, thereby improving the accuracy of burr detection and also improving the efficiency of burr detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 The present invention is a flow chart of a method for detecting burrs on mechanical parts based on image processing. DETAILED DESCRIPTION

[0043] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures, or characteristics in one or more embodiments may be combined in any suitable form.

[0044] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0045] This embodiment provides a method for detecting burrs of mechanical parts based on image processing. Figure 1 As shown, the method steps include:

[0046] (1) Obtain a surface image of the part to be inspected, and then determine the actual edge image of the part to be inspected.

[0047] In this embodiment, the surface image of the part to be detected is obtained by a camera, where the camera refers to an RGB camera, and the surface image refers to the RGB image of the surface, and the surface image of the part to be detected is grayed. The Canny edge detection operator is used to process the grayed surface image of the part to be detected, so as to obtain the actual edge image I of the part to be detected. by , that is, the edge area of ​​the RGB image, which is the ROI area for burr detection. The actual edge image of the part to be detected is obtained, and the edge information of the edge area of ​​the RGB image is collected, including the burr features of the part, which is conducive to the subsequent accurate identification of the burr area and its position of the part to be detected. The graying process and the Canny edge detection operator are both prior arts and are not within the scope of protection of the present invention, and will not be elaborated here.

[0048] (2) Obtain the number and grayscale of each edge pixel in a preset neighborhood of each edge pixel in the actual edge image of the part to be detected, and obtain a feature descriptor of each edge pixel in the actual edge image based on the number and grayscale of each edge pixel in the preset neighborhood of each edge pixel.

[0049] (2-1) Obtaining the number and grayscale of each edge pixel point in a preset neighborhood of each edge pixel point in the actual edge image of the part to be detected, the steps comprising:

[0050] In this embodiment, the actual coordinates (x, y) of any edge pixel point in the actual edge image of the part to be detected are first obtained, where x is the horizontal coordinate, y is the vertical coordinate, and the preset neighborhood range of the edge pixel point (x, y) in the horizontal coordinate direction is [x-α, x+α], and the preset neighborhood range in the vertical coordinate direction is [y-α, y+α], α is a preset parameter, and in this embodiment, the preset parameter α is 2. Of course, in other embodiments, the implementer sets the value of parameter α according to specific circumstances.

[0051] According to the size of the neighborhood range of the edge pixel point (x, y) and the edge pixels in the neighborhood range of the edge pixel point (x, y), the length of the edge in the preset neighborhood of the edge pixel point (x, y) is obtained, that is, the number N of the edge pixels in the preset neighborhood of the edge pixel point (x, y) (x,y) , and obtain the grayscale value of each edge pixel in the preset neighborhood of the edge pixel (x, y).

[0052] It should be noted that, according to prior knowledge, if the edge pixel point (x, y) is a burr pixel point, within its neighborhood, the number of edge pixels of the burr edge pixel point will be significantly larger than the number of edge pixels of the non-burr edge pixel point, so N (x,y) It can reflect the burr characteristics at the edge pixel point (x, y).

[0053] (2-2) According to the number and grayscale of each edge pixel in a preset neighborhood of each edge pixel, a feature descriptor of each edge pixel in the actual edge image is obtained, the steps comprising:

[0054] (2-2-1) Calculate the grayscale gradient of each edge pixel within a preset neighborhood of each edge pixel, and determine the grayscale gradient change characteristics of each edge pixel based on the grayscale gradient of each edge pixel within the preset neighborhood of each edge pixel.

[0055] It should be noted that since the burr area of ​​the part is an irregular area, the gradient direction distribution of each edge pixel point in the preset neighborhood of each edge pixel point in the burr area is more chaotic than that in the non-burr area of ​​the part, so the grayscale gradient direction feature T of each edge pixel point (x,y) It can reflect the burr characteristics at the edge pixel point (x, y), then the gray gradient direction characteristics T of each edge pixel point (x,y) The steps to obtain include:

[0056] (2-2-1-1) Obtain the gradient unit vectors of two adjacent edge pixel points within a preset neighborhood of the edge pixel point, and then obtain the cosine similarity of the gradient unit vectors of two adjacent edge pixel points within the preset neighborhood of the edge pixel point.

[0057] In this embodiment, the grayscale gradient direction of each edge pixel point within the preset neighborhood range of the edge pixel point (x, y) is first obtained, and then each edge pixel point is numbered in a certain order. In this embodiment, the number of each edge pixel point is recorded as l, and the grayscale gradient direction of the edge pixel point numbered l within the preset neighborhood range of the edge pixel point (x, y) is And the grayscale gradient direction of its adjacent edge pixel numbered l+1 is Here as well as The cosine similarity of the gradient unit vectors of two adjacent edge pixels in the preset neighborhood of the edge pixel point (x, y) is calculated. The calculation formula is as follows:

[0058]

[0059] in, is the cosine similarity between the edge pixel numbered l and its adjacent edge pixel numbered l+1 within the preset neighborhood of the edge pixel point (x, y). is the grayscale gradient unit vector of the edge pixel numbered l within the preset neighborhood of the edge pixel point (x, y), It is the grayscale gradient unit vector of the edge pixel numbered l+1 within the preset neighborhood of the edge pixel point (x, y).

[0060] In the same way, the cosine similarities of all two adjacent edge pixel points within the preset neighborhood of the edge pixel point (x, y) are obtained.

[0061] (2-2-1-2) Based on the cosine similarity of the gradient unit vectors of pairwise adjacent edge pixel points in a preset neighborhood of the edge pixel point, the change sequence of the gradient unit vector of the edge pixel point in the preset neighborhood is determined, and then the autocorrelation matrix of the edge pixel point is obtained.

[0062] In this embodiment, according to the cosine similarity of all two adjacent edge pixels within the preset neighborhood range of the edge pixel point (x, y) obtained in step (2-2-1-1), a row of N (x,y) -1 column grayscale gradient direction change sequence, and construct a grayscale gradient direction change sequence with a size of (N (x,y) -1)×(N (x,y) -1), the calculation formula corresponding to the value of the uth row and vth column in the autocorrelation matrix Z is as follows:

[0063] Z u,v =exp(-|Sim u -Sim v |)

[0064] Among them, Z u,v is the value of the uth row and vth column in the autocorrelation matrix Z, Sim u is the u-th cosine similarity in the gray gradient direction change sequence, Sim v is the vth cosine similarity in the grayscale gradient direction change sequence.

[0065] (2-2-1-3) Determine the grayscale gradient change characteristics of the edge pixel point based on the autocorrelation matrix of the edge pixel point.

[0066] In this embodiment, the grayscale gradient change feature of the edge pixel point (x, y) is calculated according to the autocorrelation matrix Z of the edge pixel point (x, y), and the calculation formula is as follows:

[0067]

[0068] Among them, T (x,y) is the gray gradient change feature in the preset neighborhood of the edge pixel (x, y), ‖Z‖1 is the L1 norm of the matrix Z (which represents the sum of the absolute values ​​of each element in the matrix), N (x,y) is the number of edge pixels in the preset neighborhood of the edge pixel (x, y).

[0069] It should be noted that if the grayscale gradient of the edge pixel (x, y) changes smoothly, the closer the grayscale gradient changes of all adjacent edge pixels in the preset neighborhood of the edge pixel (x, y) are, the closer the value in the autocorrelation matrix Z is to 1. At this time, the grayscale gradient change feature T of the edge pixel (x, y) is (x,y) The closer it is to 1.

[0070] (2-2-2) Obtain a feature descriptor for each edge pixel point based on the number of edge pixels within a preset neighborhood of each edge pixel point and the grayscale gradient change characteristics of each edge pixel point.

[0071] In this embodiment, according to the number N of edge pixels in the preset neighborhood of the edge pixel point (x, y), (x,y) And the gray gradient change characteristics T of each edge pixel (x,y) , get the feature descriptor of the edge pixel (x, y), that is, the vector (N (x,y) ,T (x,y) ).

[0072] In addition, it should be noted that the present embodiment has currently obtained the feature descriptor of the edge pixel point (x, y), and according to step (2-2), the feature descriptor of each edge pixel point in the actual edge image can be obtained.

[0073] (3) According to the feature descriptors of each edge pixel in the actual edge image, each non-burr edge pixel in each edge pixel in the actual edge image and its corresponding feature descriptor are determined, and then the probability of each edge pixel in the actual edge image being a burr is determined.

[0074] (3-1) determining each non-burr edge pixel point and its corresponding feature descriptor among each edge pixel point in the actual edge image according to the feature descriptor of each edge pixel point in the actual edge image, the steps comprising:

[0075] In this embodiment, the number of occurrences of the feature descriptor corresponding to each edge pixel in the actual edge image is first counted, and a three-dimensional surface is drawn. The height value of the three-dimensional surface can reflect the number of occurrences of the feature descriptor corresponding to each edge pixel. In the case that there are no major errors in the processing technology, there are no burrs in the edge areas of most parts, so the feature descriptor corresponding to the maximum height value of the three-dimensional surface is determined to be the feature descriptor of each non-burr edge pixel in each edge pixel in the actual edge image, and then each non-burr edge pixel in each edge pixel in the actual edge image is determined.

[0076] (3-2) Calculate the similarity between the feature descriptor of each edge pixel and the feature descriptor of each non-burr edge pixel, and use the similarity between the two as the probability that the corresponding edge pixel is a burr.

[0077] In this embodiment, the similarity between the feature descriptor of the edge pixel point and the feature descriptor of the non-burr edge pixel point is used as the probability p of the edge pixel point (x, y) being a burr, and the calculation formula of the probability p of the edge pixel point (x, y) being a burr is as follows:

[0078]

[0079] Among them, p(x,y) is the probability that the edge pixel (x,y) is a burr, N (x,y) is the number of edge pixels in the preset neighborhood of the edge pixel point (x, y), N0 is the number of edge pixels in the preset neighborhood of the non-burr edge pixel point, T (x,y) is the grayscale gradient change feature of the edge pixel (x, y), and T0 is the grayscale gradient change feature of the non-burr edge pixel.

[0080] (4) According to the probability of each non-burr edge pixel point and each edge pixel point being a burr, an ideal edge image of the part to be inspected without burrs is obtained, the steps comprising:

[0081] (4-1) A coordinate system is established based on the actual edge image of the part to be inspected, and the actual coordinates of each edge pixel point of the actual edge image are obtained.

[0082] A coordinate system is established on the actual edge image of the part to be detected, so as to obtain the actual coordinates of each pixel point on the actual edge image of the part to be detected, that is, to obtain the actual coordinates of each edge pixel point of the actual edge image. In this step, the actual horizontal coordinates of each edge pixel point of the actual edge image are obtained, so as to facilitate the subsequent determination of the ideal vertical coordinates of each burr edge pixel point.

[0083] (4-2) Clustering each non-burr edge pixel point according to the actual coordinates of each non-burr edge pixel point, thereby obtaining each edge pixel point dense area.

[0084] In this embodiment, the DBSCAN density clustering algorithm is used to analyze each non-burr edge pixel point, that is, the DBSCAN density clustering algorithm is used to cluster each non-burr edge pixel point to obtain each cluster. The DBSCAN density clustering algorithm is a prior art and is not within the scope of protection of the present invention, and will not be described in detail here.

[0085] In this embodiment, a rectangular frame of size 3×3 is set, and the rectangular frame is made to slide in each cluster until all clusters are traversed. During the sliding, the density of non-burr edge pixels in the rectangular frame is calculated each time the sliding is performed. The density calculation formula is:

[0086]

[0087] Among them, ρ is the density of non-burr edge pixels in the rectangular frame during this sliding, Num is the number of non-burr edge pixels in the rectangular frame, that is, the edge pixels with a burr probability p of 0, and the value 9 refers to the area of ​​the rectangular frame during sliding.

[0088] It should be noted that the greater the number of non-burr edge pixels in the rectangular frame, the greater its density. According to the above-mentioned density calculation formula, the density index ρ is obtained each time the rectangular frame slides, and it is determined whether the density index ρ is greater than the set density threshold ρ0. If it is greater than the density threshold ρ0, the edge pixel points in the rectangular frame are a dense area. In this embodiment, the density threshold ρ0 is set to 4.

[0089] According to the above step (4-2), each edge pixel dense area can be screened out from each cluster.

[0090] (4-3) According to the actual horizontal coordinates corresponding to the non-burr edge pixels in each edge pixel dense area and the burr pixels in each dense area, the ideal coordinates corresponding to each burr pixel point in each dense area are obtained.

[0091] This embodiment uses an interpolation algorithm to obtain the coordinates of each burr edge pixel point between each non-burr edge pixel point in each edge pixel point dense area, that is, using the actual coordinates of each non-burr edge pixel point in each edge pixel point dense area and the actual horizontal coordinates corresponding to each burr pixel point in each dense area, the ideal vertical coordinate corresponding to each burr pixel point in each dense area is determined, and then the ideal coordinates corresponding to each burr pixel point in each dense area are obtained. The interpolation algorithm is a prior art and is not within the protection scope of the present invention, and will not be elaborated here.

[0092] It should be noted that the ideal coordinates corresponding to each burr pixel point in each dense area refer to the coordinates on the ideal edge image without burrs on the part to be inspected. If there are burrs on the edge pixel point, the actual coordinates of the edge pixel point on the actual edge image are different from the ideal coordinates of the ideal edge image without burrs, so it is necessary to obtain the ideal coordinates corresponding to each burr pixel point in each dense area.

[0093] (4-4) According to the actual coordinates of each non-burr edge pixel point in each dense area and the ideal coordinates of each burr pixel point, the ideal edge corresponding to each dense area is obtained.

[0094] The actual coordinates of each non-burr edge pixel point in each dense area and the ideal coordinates of each burr pixel point are used to perform polynomial fitting on each non-burr edge pixel point in the dense area. At the same time, in order to ensure that the fitted polynomial conforms to the actual direction of the edge, the highest power n of the polynomial is set to 5 according to prior knowledge in this embodiment, and the polynomial y=f(x) is constructed. The calculation formula is as follows: Where n is the highest power of the polynomial, j is the power of the polynomial, and w is the coefficient of the polynomial.

[0095] This step is to use the actual coordinates of the non-burr edge pixel points in the dense area and the ideal coordinates of the burr pixel points that have been obtained as data for polynomial fitting, and use the least squares method to obtain the final fitting result, that is, the ideal edge corresponding to each dense area. The process of fitting the coordinates of discrete points using the least squares method is a prior art and is not within the scope of protection of the present invention, and will not be elaborated here.

[0096] (4-5) According to the ideal edges corresponding to each dense area and the actual coordinates of each edge pixel point not in each dense area and the probability of being a burr, an ideal edge image of the part to be inspected without burrs is determined.

[0097] (4-5-1) Determine the nearest edge pixel point that is not in each dense area at any end of the ideal edge corresponding to the dense area, and determine the predicted vertical coordinate of the nearest edge pixel point that is not in each dense area based on the actual horizontal coordinate of the ideal edge and the nearest edge pixel point that is not in each dense area.

[0098] First, for the ideal edge corresponding to each dense area, simultaneously obtain the edge pixel points at both ends of each ideal edge that are not in each dense area, that is, each end of the ideal edge will find a corresponding edge pixel point that is closest to it and is not in each dense area. For the convenience of description, the edge pixel point that is closest to one end of the ideal edge and is not in each dense area is called the first target edge point, and the edge pixel point that is closest to the other end of the ideal edge and is not in each dense area is called the second target edge point. Secondly, for the ideal edge corresponding to each dense area, the actual horizontal coordinates of the first target edge point and the second target edge point are respectively substituted into the fitting polynomial corresponding to the ideal edge, so as to obtain the predicted vertical coordinates of the first target edge point and the second target edge point.

[0099] (4-5-2) According to the predicted ordinate, actual ordinate, and probability of being a burr of the nearest edge pixel point not in each dense area, the ideal ordinate of the nearest edge pixel point not in each dense area is determined, and the calculation formula is as follows:

[0100]

[0101] Among them, Y k is the ideal ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, p(x k ,y k ) is the probability that the edge pixel k closest to any end of the ideal edge corresponding to the dense area and not in each dense area is a burr, is the predicted ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, y k is the actual ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, x k is the actual horizontal coordinate of the nearest edge pixel point k that is not in each dense area at any end of the ideal edge corresponding to the dense area.

[0102] It should be noted that the probability that the edge pixel point k at any end of the ideal edge corresponding to the dense area and not in each dense area is a burr is used as the weight of the predicted ordinate and the actual ordinate to ensure that the ideal ordinate of the nearest edge pixel point k not in each dense area is more accurate. For example, when p(x k ,y k ) is 0, the actual ordinate of the nearest edge pixel k that is not in each dense area is directly used as its ideal ordinate; when p(x k ,y k ) is 1, the predicted ordinate of the nearest edge pixel point k that is not in each dense area is directly used as its ideal ordinate.

[0103] Through the above method and step (4-5-2), for the ideal edge corresponding to each dense area, the ideal vertical coordinates of the first target edge point and the second target edge point corresponding to the ideal edge can be determined.

[0104] (4-5-3) The ideal edge corresponding to the dense area is updated according to the actual horizontal coordinate and ideal vertical coordinate of the nearest edge pixel point that is not in each dense area, so as to obtain the ideal edge corresponding to the updated dense area, and the nearest edge pixel point that is not in each dense area at any end of the ideal edge corresponding to the updated dense area is determined, and the above steps are repeated until the ideal vertical coordinates of all edge pixel points that are not in each dense area are determined.

[0105] According to the actual horizontal coordinates and ideal vertical coordinates of the edge pixel points k not in each dense area, the ideal edge corresponding to the dense area corresponding to the edge pixel point k is updated, that is, the edge pixel point k not in each dense area is added to the ideal edge corresponding to the dense area, that is, the ideal edge corresponding to the dense area is extended to the edge pixel point k. In this way, the ideal edge corresponding to each dense area can be extended to the actual horizontal coordinates and ideal vertical coordinates of the corresponding first target edge point and second target edge point, thereby realizing the update process of each ideal edge.

[0106] According to the ideal edge corresponding to the updated dense area, the nearest edge pixel point that is not in each dense area at any end of the ideal edge corresponding to the updated dense area is determined again, that is, the above steps (4-5-1)-(4-5-3) are repeated until the ideal vertical coordinates of all edge pixel points that are not in each dense area are obtained, that is, each ideal edge is extended to the actual horizontal coordinate and ideal vertical coordinate positions corresponding to all edge pixel points that are not in each dense area, and finally an ideal edge image without burrs on the inspected part is obtained.

[0107] (5) Determine the burr area of ​​the part to be inspected based on the actual edge image of the part to be inspected and the ideal edge image of the part to be inspected without burrs.

[0108] An XOR operation is performed on the real edge image of the part to be inspected and the ideal edge image of the part to be inspected without burrs, and a comparison image corresponding to the two edge images is obtained. The burr area of ​​the part to be inspected is obtained according to the comparison image, and the specific positions of different burr areas are determined.

[0109] In this embodiment, the ideal edge image of the part to be inspected without burrs obtained in step (4) is marked as The actual edge image I by and ideal edge image Perform XOR operation (same is 0, different is 1) to get the comparison image. by If there is no burr in the image, the edge pixel points at each position in the comparison image are 0; if the actual edge image I byIf there is a burr in the image, there is an edge pixel point of 1 in the comparison image, and the area with the edge pixel point of 1 is the edge area of ​​the burr.

[0110] This example uses connected domain analysis to extract the closed edges of all burrs, and can accurately and quickly obtain burr detection results at different positions of the part to be detected. The detection results include whether there are burrs in the part to be detected and the specific location of the burr area. Connected domain analysis is a prior art and is not within the scope of protection of the present invention, and will not be described in detail here.

[0111] This embodiment also provides a mechanical parts burr detection system based on image processing, including a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement a mechanical parts burr detection method based on image processing, which is the content described above and will not be elaborated here.

[0112] It should be noted that the sequence of the embodiments of the present invention described above is for description only and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0113] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting burrs of mechanical parts based on image processing, characterized in that: The following steps are involved: Acquire a surface image of the part to be inspected, and then determine an actual edge image of the part to be inspected; Obtain the number and grayscale of each edge pixel in a preset neighborhood of each edge pixel in the actual edge image of the part to be detected, and obtain a feature descriptor of each edge pixel in the actual edge image according to the number and grayscale of each edge pixel in the preset neighborhood of each edge pixel; According to the feature descriptors of each edge pixel in the actual edge image, each non-burr edge pixel in each edge pixel in the actual edge image and its corresponding feature descriptor are determined, and then the probability of each edge pixel in the actual edge image being a burr is determined; According to the probability of each non-burr edge pixel point and each edge pixel point being a burr, an ideal edge image of the part to be inspected without burrs is obtained; The burr detection result of the part to be detected is determined according to the actual edge image of the part to be detected and the ideal edge image of the part to be detected without burrs.

2. The method for detecting burrs of mechanical parts based on image processing according to claim 1, characterized in that: The steps to obtain an ideal edge image of the part to be inspected without burrs include: Establish a coordinate system based on the actual edge image of the part to be inspected, and obtain the actual coordinates of each edge pixel point of the actual edge image; Clustering each non-burr edge pixel point according to the actual coordinates of each non-burr edge pixel point, so as to obtain each dense area; According to the actual horizontal coordinates corresponding to the non-burr edge pixels in each dense area and the burr pixels in each dense area, the ideal coordinates corresponding to the burr pixels in each dense area are obtained; According to the actual coordinates of each non-burr edge pixel point in each dense area and the ideal coordinates of each burr pixel point, the ideal edge corresponding to each dense area is obtained; According to the ideal edges corresponding to each dense area and the actual coordinates of each edge pixel point not in each dense area and the probability of being a burr, an ideal edge image of the part to be inspected without burrs is determined.

3. The method for detecting burrs of mechanical parts based on image processing according to claim 2, characterized in that: The steps to determine an ideal edge image of the part to be inspected without burrs include: Determine the nearest edge pixel point that is not in each dense area at any end of the ideal edge corresponding to the dense area, and determine the predicted ordinate coordinate of the nearest edge pixel point that is not in each dense area according to the ideal edge and the actual abscissa coordinate of the nearest edge pixel point that is not in each dense area; Determine the ideal ordinate of the nearest edge pixel point not in each dense area according to the predicted ordinate, the actual ordinate, and the probability of being a burr of the nearest edge pixel point not in each dense area; According to the actual horizontal coordinate and ideal vertical coordinate of the nearest edge pixel point not in each dense area, the ideal edge corresponding to the dense area is updated to obtain the updated ideal edge corresponding to the dense area, and the nearest edge pixel point not in each dense area at any end of the ideal edge corresponding to the updated dense area is determined, and the above steps are repeated until the ideal vertical coordinates of all edge pixel points not in each dense area are determined.

4. The method for detecting burrs of mechanical parts based on image processing according to claim 3 is characterized in that: The calculation formula for determining the ideal ordinate of the nearest edge pixel that is not in each dense area is as follows: Among them, Y k is the ideal ordinate corresponding to the nearest edge pixel point k at either end of the ideal edge corresponding to the dense area, which is not in each dense area, p(x k ,y k ) is the probability that the edge pixel k closest to any end of the ideal edge corresponding to the dense area and not in each dense area is a burr, is the predicted ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, y k is the actual ordinate of the nearest edge pixel k that is not in each dense area at any end of the ideal edge corresponding to the dense area, x k is the actual horizontal coordinate of the nearest edge pixel point k that is not in each dense area at any end of the ideal edge corresponding to the dense area.

5. The method for detecting burrs of mechanical parts based on image processing according to claim 1, characterized in that: The steps of obtaining the feature descriptor of each edge pixel include: Calculating the grayscale gradient of each edge pixel within a preset neighborhood of each edge pixel, and determining the grayscale gradient change characteristics of each edge pixel according to the grayscale gradient of each edge pixel within the preset neighborhood of each edge pixel; A feature descriptor of each edge pixel is obtained according to the number of each edge pixel in a preset neighborhood of each edge pixel and the grayscale gradient change characteristics of each edge pixel.

6. The method for detecting burrs of mechanical parts based on image processing according to claim 5, characterized in that: The steps of calculating the grayscale gradient change characteristics of each edge pixel include: Obtaining gradient unit vectors of two adjacent edge pixel points within a preset neighborhood of the edge pixel point, and then obtaining cosine similarity of the gradient unit vectors of two adjacent edge pixel points within the preset neighborhood of the edge pixel point; According to the cosine similarity of the gradient unit vectors of two adjacent edge pixel points in the preset neighborhood of the edge pixel point, a change sequence of the gradient unit vector of the edge pixel point in the preset neighborhood is determined, and then an autocorrelation matrix of the edge pixel point is obtained; According to the autocorrelation matrix of the edge pixel point, the grayscale gradient change characteristics of the edge pixel point are determined.

7. The method for detecting burrs of mechanical parts based on image processing according to claim 5, characterized in that: The steps of determining the probability of burrs existing at each edge pixel point include: The similarity between the feature descriptor of each edge pixel and the feature descriptor of each non-burr edge pixel is calculated, and the similarity between the two is used as the probability that the corresponding edge pixel is a burr.

8. The method for detecting burrs of mechanical parts based on image processing according to claim 7, characterized in that: The calculation formula for calculating the probability of each edge pixel being a burr is as follows: Among them, p(x,y) is the probability that the edge pixel (x,y) is a burr, N (x,y) is the number of edge pixels in the preset neighborhood of the edge pixel point (x, y), N0 is the number of edge pixels in the preset neighborhood of the non-burr pixel point, T (x,y) is the grayscale gradient change feature of the edge pixel (x, y), and T0 is the grayscale gradient change feature of the non-burr pixel.

9. The method for detecting burrs of mechanical parts based on image processing according to claim 1, characterized in that: The steps to obtain the burr detection results of the parts to be inspected include: An XOR operation is performed on the real edge image of the part to be inspected and the ideal edge image of the part to be inspected without burrs, a comparison image corresponding to the two edge images is obtained, and the burr area of ​​the part to be inspected is obtained according to the comparison image.

10. A mechanical parts burr detection system based on image processing, characterized in that: It comprises a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement the mechanical parts burr detection method based on image processing as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Burr positioning and burr detection model training method and device

    CN112529829A

  • Digital image blemish removal

    US20170103502A1