Stamping Part Round Hole Positioning and Deformation Detection Method Based on Sub-Pixel Edge Extraction

Through the method based on subpixel edge extraction, combined with OSTU threshold segmentation and least squares fitting, the problem of accuracy and efficiency of circular hole positioning and deformation detection of stamped parts is solved, and efficient and accurate circular hole position offset and deformation detection is achieved, reducing production costs.

CN116542910BActive Publication Date: 2025-07-29FUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310386163.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-12
Publication Date
2025-07-29
Estimated Expiration
2043-04-12

AI Technical Summary

Technical Problem

The prior art has problems of low accuracy and low efficiency in the positioning and deformation detection of round holes of stamping parts, especially in production, the shape changes or position deviations of round holes caused by instrument errors and human errors are difficult to effectively detect.

Method used

Using a method based on subpixel edge extraction, the OSTU threshold segmentation algorithm and subpixel edge detection are used, and subpixel line and curve fitting are combined with the least squares method to screen out the straight line and circular contour edges of the stamping part, calculate the center coordinates and determine whether the circular hole position is offset or deformation.

Benefits of technology

It improves the accuracy and efficiency of circular hole positioning and deformation detection of stamping parts, reduces manual intervention, reduces production costs, has practicality and broad application prospects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116542910B_ABST
    Figure CN116542910B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for positioning circular holes and detecting deformation of stamping parts based on sub-pixel edge extraction, including: 1. Collecting images of stamping parts and performing preprocessing; 2. Using the OSTU threshold segmentation algorithm to extract the overall target of the stamping parts, and then converting the image into a binary image; 3. Extracting all edge pixels of the stamping parts through sub-pixel edge detection, and then performing sub-pixel straight edge fitting and sub-pixel curve edge fitting to obtain all contour edges of the three types of straight lines, ellipses, and circles, screening out the straight lines of the two-side edge contours and all circular contour edges, and calculating the center coordinates; 4. Calculating the distances from each center to the two-side edge straight lines respectively to determine whether the positions of the circular holes are shifted; 5. Calculating the distances from each center to each point on the circular edge contour, selecting the maximum value and the minimum value for comparison, and if the difference between the two exceeds the set range, it is determined that deformation has occurred. This method is beneficial to improving the accuracy and efficiency of positioning circular holes and detecting deformation of stamping parts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of stamping part detection, and particularly relates to a method for locating and deforming detection of circular holes in stamping parts based on sub-pixel edge extraction. Background Art

[0002] Stamping parts are an important process part in the production of contemporary metal parts. Punching is a major element in the production of stamping parts. In actual production, due to factors such as errors in production instruments and human errors, problems such as changes in the shape of circular holes or position offsets occur. Currently, most factories use sampling inspection methods for detection. This method has low accuracy and takes a long time, resulting in low efficiency. In recent years, with the continuous application of machine vision in this area, the detection link of circular hole deformation in stamping parts has been greatly facilitated and improved.

[0003] The research on machine vision detection in China started relatively late and has been formally emphasized since the end of the 20th century. After nearly several decades of development, good results have been achieved. In order to accurately detect the edges of metal workpieces, researchers use the method of obtaining the surface normal from the gray-scale images of the metal workpiece surface under different light intensities, and combine dilation and erosion with the least squares method to extract and fit the feature edges, thereby obtaining the edges of the object to be measured. For the problem of image target deformation extraction, a defect segmentation scheme based on image difference and combining positive and negative differences is proposed, which can quickly and accurately exclude background interference and achieve defect extraction and detection. Contour extraction is the most important step in deformation detection, and its main bottlenecks are: the lack of a suitable operator to quickly and effectively screen out edges due to the influence of light, overly complex edges, and low search and matching rates, such as the detection algorithms based on sliding window search and randomly obtaining point pixels. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for locating and deforming detection of circular holes in stamping parts based on sub-pixel edge extraction, which is beneficial to improving the accuracy and efficiency of locating and deforming detection of circular holes in stamping parts.

[0005] To achieve the above purpose, the technical solution adopted by the present invention is: a method for locating and deforming detection of circular holes in stamping parts based on sub-pixel edge extraction, including the following steps:

[0006] Step 1: Collect images of stamping parts and preprocess the images;

[0007] Step 2: Use the OSTU threshold segmentation algorithm to extract the overall target of the stamping part, and then convert the image into a binary image;

[0008] Step 3: Extract all edge pixels of the stamping part through sub-pixel edge detection, then perform sub-pixel straight-edge fitting and sub-pixel curve-edge fitting to obtain all contour edges of the three types of straight lines, ellipses, and circles. Screen out the straight lines of the two-side edge contours, and screen out all circular contour edges, and calculate the center coordinates of the circles;

[0009] Step 4: Calculate the distances from each center to the two-side edge straight lines respectively, and determine whether the positions of the round holes are shifted;

[0010] Step 5: Calculate the distances from each center to each point on the circular edge contour, select the maximum value and the minimum value for comparison, and if the difference between the two exceeds the set range, it is determined that deformation has occurred.

[0011] Furthermore, in Step 1, preprocess the image of the stamping part. The first step is to perform grayscale conversion on the image, and the second step is to perform noise reduction processing on the median filter of the image.

[0012] Furthermore, in Step 3, perform sub-pixel edge detection through the moment-based sub-pixel edge detection method. The moment-based sub-pixel edge detection method determines the position of the actual edge by assuming that the actual edge distribution in the image is consistent with the gray level of the ideal step edge model, which is equivalent to the invariance of its moments;

[0013] One-dimensional ideal step edge is connected by multiple pixels with gray levels h1 and h2. h1 and h2 are the gray levels of two pixels with a step distribution, and its step point is set as k. The actual pixel points are the pixel values distributed above and below the values of h1 and h2. The ideal edge is a pixel set composed of two gray levels h1 and h2; and the edge position k and the gray levels h1 and h2 on both sides of the edge jointly determine the ideal edge; the one-dimensional ideal edge function is expressed as:

[0014] E1(x) = (h1 - h2)μ(x - k) + h1 (1)

[0015] Among them, E1(x) represents the ideal edge, and μ represents the step function;

[0016] The position of the edge is obtained by adding the first three-order actual and ideal gray-level moments of one dimension plus the proportion of the pixels with gray levels h1 and h2 equal to 1:

[0017]

[0018] Among them, n represents the total number of pixel points, and p1 represents the percentage of the pixel points with gray level h1 in the total number of pixel points n;

[0019] Assume that the gray levels of the actual pixels are composed of a monotonic sequence g j , j = 1, 2, …, n, and the sequence starts from the pixel position;

[0020] The moment-based sub-pixel edge detection method obtains a high-precision edge position by fitting the gray value. The prerequisite is to clarify the characteristics of the object to be measured before detection, so as to apply the corresponding fitting algorithm for edge fitting.

[0021] Furthermore, on the basis of sub-pixel edge detection, the sub-pixel straight edge is fitted by the least square method:

[0022] On the basis of the pixel edge, the straight line contour is a set of vectors. Perform least square linear regression on this set of vectors. Let the regression equation be:

[0023] y′=k0 + k l x (3)

[0024] where y’ represents the function value of the regression equation, and k0 and k1 represent the two coefficients to be determined in the regression equation; Let y i be the value of the measurement point, and i be the pixel point number. When the distance between y i and y′ i reaches the minimum, it is the position of the actual measurement value; Combining with the extreme value theory, we have:

[0025]

[0026]

[0027] Obtain k0 and k1, that is, the fitted straight line.

[0028] Furthermore, on the basis of sub-pixel edge detection, the sub-pixel curve edge is fitted by the method of quadratic curve fitting:

[0029] Let the quadratic curve function be f(x)=ax 2 + bx + c, calculate the coefficients of the quadratic curve function by the least square method, so as to fit f(x), which are the coefficients that minimize the mean square error of the function; The obtained matrix equation system is BC = Y;

[0030]

[0031] Solve the above formula to obtain the coefficients in the quadratic curve function f(x); Take the first derivative of f(x) and let f′(x) = 0, Find the maximum value of the curve, which is the coordinate of the edge point; Similarly, use the method of quadratic curve fitting to obtain the coordinate of the edge point in the Y direction.

[0032] Further, in step 3, the two longest straight lines among the contour edges are selected, which are the edges on both sides of the stamping part. After finding the edges on both sides of the stamping part, the coordinates at both ends of the two straight lines are respectively extracted through a coordinate operator, and the distance from the center of the circle to one edge is obtained by calculating with the coordinates at both ends of the straight line and the coordinates of the center of the circle. Similarly, the distance from the center of the circle to the other edge is calculated. A deviation threshold is set. If the difference between the distances from the center of the circle to both sides exceeds the deviation threshold, it is determined that the position of the round hole is deviated.

[0033] Further, the deviation threshold is 1 / 150 of the distance between the two sides.

[0034] Further, in step 3, the distances from the center of the circle to each edge point are calculated in sequence and form an array. The calculation formula is as follows:

[0035]

[0036] where Row and Colum respectively represent the horizontal and vertical coordinates of the center of the circle, and Row1 and Colum1 respectively represent the horizontal and vertical coordinates of each edge point;

[0037] The maximum value and the minimum value are selected from the array for comparison. If the difference between the two exceeds the set deformation threshold, it is determined that deformation has occurred.

[0038] Compared with the prior art, the present invention has the following beneficial effects: It provides a method for positioning and deformation detection of round holes in stamping parts based on sub-pixel edge extraction. This method determines the deviation of the round hole position and deformation by extracting the sub-pixel edge of the stamping part image, improves the accuracy and efficiency of stamping part deformation detection, reduces manual intervention, lowers production costs, and has strong practicability and broad application prospects. Description of the Drawings

[0039] Figure 1 is the flowchart of the method implementation of the embodiment of the present invention;

[0040] Figure 2 is the segmentation effect diagram of the stamping part in the embodiment of the present invention;

[0041] Figure 3 is the flowchart of the round hole position deviation detection in the embodiment of the present invention;

[0042] Figure 4 is the flowchart of the round hole deformation detection in the embodiment of the present invention;

[0043] Figure 5 is the result diagram of edge extraction of the stamping part by four methods in the embodiment of the present invention;

[0044] Figure 6 is the result diagram of extracting the straight line edge and the round hole edge in the embodiment of the present invention;

[0045] Figure 7 These are the result diagrams of the deformation detection of various stamping parts in the embodiments of the present invention. Specific embodiments

[0046] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0047] It should be noted that the following detailed description is exemplary and is intended to provide further illustration of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present application belongs.

[0048] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular forms are also intended to include the plural forms. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0049] As Figure 1 shown, this embodiment provides a method for positioning and deformation detection of circular holes in stamping parts based on sub-pixel edge extraction, including the following steps:

[0050] Step 1: Collect images of stamping parts and preprocess the images.

[0051] Step 2: Use the OSTU threshold segmentation algorithm to extract the overall target of the stamping part, and then convert the image into a binary image.

[0052] Step 3: Extract all edge pixels of the stamping part through sub-pixel edge detection, and then perform sub-pixel straight edge fitting and sub-pixel curve edge fitting to obtain all contour edges of the three types of straight lines, ellipses, and circles. Screen out the straight lines of the two side edge contours, and screen out all circular contour edges, and calculate the center coordinates.

[0053] Step 4: Calculate the distance from each center to the two side edge straight lines respectively, and judge whether the position of the circular hole has shifted.

[0054] Step 5: Calculate the distance from each center to each point on the circular edge contour, select the maximum value and the minimum value for comparison, and if the difference between the two exceeds the set range, it is determined that deformation has occurred.

[0055] The relevant content involved in the above method steps will be further described below.

[0056] 1. Sub-pixel edge detection method

[0057] Pixels represent the resolution of an image and are the basic units of an image. Sub-pixels are further divided based on the image and are more precise than pixels, capable of improving the image resolution. There are several preconditions for the sub-pixel technology: the measured target cannot be a single pixel and must be an area or composed of multiple pixels; the measured target generally has certain characteristics, including gray level, geometry, or a combination of both. Sub-pixels analyze the measured object, and the data obtained is of floating-point type, generally accurate to 0.1 to 0.5 pixels, and can be accurate to 0.001 in good environmental conditions with good image processing effects.

[0058] In this embodiment, sub-pixel edge detection is performed through the moment-based sub-pixel edge detection method. This method locates the sub-pixel edge through the integral operator of the moment to effectively prevent noise interference. The principle of this method is: by assuming that the actual edge distribution in the image is consistent with the gray level of the ideal step edge model, which is equivalent to the invariance of its moment, to determine the position of the actual edge.

[0059] One-dimensional ideal step edge is connected by multiple pixels with gray levels h1 and h2. h1 and h2 are the gray values of two pixels with a step distribution, and the step point is set as k. The actual pixel points are the pixel values distributed above and below the values of h1 and h2. The ideal edge is a pixel set composed of the two gray values h1 and h2. And the edge position k and the gray values h1 and h2 on both sides of the edge jointly determine the ideal edge. The one-dimensional ideal edge function is expressed as:

[0060] E1(x) = (h1 - h2)μ(x - k) + h1 (1)

[0061] Among them, E1(x) represents the ideal edge, and μ represents the step function.

[0062] The position of the edge is obtained by adding the first three-order actual and ideal gray-level moments in one dimension plus the proportion of pixels with gray values h1 and h2 equal to 1:

[0063]

[0064] Among them, n represents the total number of pixel points, and p1 represents the percentage of pixel points with gray value h1 in the total number of pixel points n.

[0065] Assume that the gray values of the actual pixels are composed of a monotonic sequence g j , j = 1, 2,..., n, and the sequence starts from the pixel position. Gray-level moment edge detection can balance the gray values, and additive noise can make the actual edge position closer to the center of the sequence. Therefore, when the edge position is closer to the center of the sequence, the error is smaller.

[0066] The moment-based sub-pixel edge detection method obtains a high-precision edge position by fitting the gray value, on the premise that the characteristics of the object to be measured are clear before detection, such as noise distribution, pixel gray value, geometric features, etc. If the target meets the model of the existing operator, the corresponding fitting algorithm can be used for edge fitting.

[0067] (1) Sub-pixel straight edge fitting

[0068] In this embodiment, based on sub-pixel edge detection, sub-pixel straight edge fitting is performed by the least squares method.

[0069] The least squares method is an effective algorithm for detecting straight lines. Based on the pixel edge, the straight line contour is a set of vectors. Perform least squares linear regression on this set of vectors. Let the regression equation be:

[0070] y′=k0 + k1x (3)

[0071] Among them, y’ represents the function value of the regression equation, and k0 and k1 represent the two coefficients to be determined in the regression equation; let y i be the value of the measurement point, i be the pixel point serial number. When the distance between y i and y i ′ reaches the minimum, it is the position of the actual measurement value. Combining with the extreme value theory, we have:

[0072]

[0073]

[0074] Obtain k0 and k1, that is, the fitted straight line. And when more pixel points participate in the fitting, the position obtained by the sub-pixel is more accurate, but it will consume more time.

[0075] (2) Sub-pixel curve edge fitting

[0076] In this embodiment, based on sub-pixel edge detection, sub-pixel curve edge fitting is performed by the method of quadratic curve fitting.

[0077] The difference in gray value in the image is caused by the light intensity. The gray value is a gradual change process. The gray value changes the most at the edge point. It is not difficult to think of using gray value difference to replace the gray value. When the gray value difference is the largest, it is the edge point, and the outer envelope of the difference image conforms to the form of a quadratic curve.

[0078] Let the quadratic curve function be f(x)=ax 2+ bx + c, the coefficients of the quadratic curve function are calculated by the least squares method, so as to fit f(x), which are the coefficients that minimize the mean square error of the function. And the number of unknown coefficients is 3, and the number of points with known coordinates is 4 (or more), then the matrix equation system can be obtained as BC = Y;

[0079]

[0080] Solving the above equation gives the coefficients in the quadratic curve function f(x). Take the first derivative of f(x) and let f′(x) = 0, The maximum value of the curve is found, which is the coordinate of the edge point. Similarly, the coordinate of the edge point in the Y direction is obtained by using the quadratic curve fitting method.

[0081] 2. Stamping part round hole positioning and deformation detection method

[0082] The positioning and deformation detection of stamping parts includes two parts. One is to judge whether the positions of each round hole are shifted, and the other is to judge whether each round hole is deformed.

[0083] 2.1 Stamping part image preprocessing and segmentation

[0084] When positioning the round holes of the stamping part, first, we preprocess the stamping part image. The first step of the preprocessing is to perform grayscale conversion on the image, and the second step is to perform noise reduction processing on the median filter of the image. Then, the OSTU algorithm is used to segment the stamping part target from the image, and the obtained stamping part segmentation map is as Figure 2 shown.

[0085] 2.2 Judgment of the deviation of the center position

[0086] Since it is basically impossible to judge the deviation of the round hole position by the naked eye, this method chooses to judge by calculating the distances from the center of the circle to both sides of the mold. First, perform sub-pixel edge detection to extract all edge pixels of the stamping part, then perform sub-pixel straight edge fitting and sub-pixel curve edge fitting to obtain all contour edges of the three types of straight lines, ellipses, and circles. After that, screen the two straight lines with the longest "perimeter" of the contour, which are the two side edges of the stamping part.

[0087] After finding the two side edges of the stamping part, the coordinates at both ends of the two straight lines are extracted respectively through the coordinate operator, and the distance from the center of the circle to one edge is calculated by using the coordinates at both ends of the straight line and the coordinates of the center of the circle. Similarly, the distance from the center of the circle to the other edge is calculated. Since sub-pixels are used for extraction and calculation, the two distances obtained are almost impossible to be equal. In this method, an offset threshold is set for the difference between the distances from the center of the circle to the two sides to determine whether the position is offset. If the difference between the distances from the center of the circle to the two sides exceeds the offset threshold, it is determined that the position of the round hole is offset. Through multiple detections and debuggings, combined with the height of the collected image and the proportion of the contour display in the total image, the offset threshold is determined to be 1 / 150 of the distance between the two contour lines. The detection process of the round hole position offset in this embodiment is as Figure 3 shown.

[0088] 2.3 Detection of Circular Edge Deformation

[0089] The second function implemented by the present invention is to detect whether each round hole is deformed. From the round holes of the stamping part, it can be seen that the deformation of the round hole can be classified into burrs, depressions or insufficient roundness, etc. But these several deformations can all be summarized as the unequal distances from the center of the circle to each point on the edge contour. In the previous steps, all circular edges have been detected, and then the distances from the center of the circle to each edge point are calculated in turn and form an array. The calculation formula is as follows:

[0090]

[0091] where Row and Colum respectively represent the horizontal and vertical coordinates of the center of the circle, and Row1 and Colum1 respectively represent the horizontal and vertical coordinates of each edge point.

[0092] Select the maximum and minimum values in the array for comparison. Similarly, due to some inevitable factors such as the differences in the image acquisition process, there will be deviations in its values, and a certain error range, that is, the deformation threshold, also needs to be set. If the difference between the maximum value and the minimum value exceeds the set deformation threshold, it is determined that deformation has occurred. The detection process of the round hole deformation in this embodiment is as Figure 4 shown.

[0093] In this embodiment, the Roberts operator, Sobel operator, Canny operator and the method of the present invention are respectively used to extract the edges of the stamping part, and the results are as Figure 5 shown.

[0094] It is obvious that the detection effect of the Canny operator retains the edges well. However, although the templates used by the Sobel and Roberts operators suppress noise, they also remove many edges in the process, and the positioning is not accurate enough. Although the Canny operator can roughly extract the contours, there are still cases of broken lines and blurring, which shows a significant difference from sub-pixel edge extraction. Sub-pixel extraction not only extracts the edges well but also divides the edges at different levels. After extracting the edge contours, the sub-pixel fitting method is used to extract the straight line and circular hole edges, and the results are as Figure 6 shown.

[0095] The results of inspecting 6 kinds of stamping parts by the method of the present invention are as Figure 7 shown. Stamping part 2 has 4 circular holes, stamping part 3 has 3 circular holes, and the remaining stamping parts all have 2 circular holes. The positioning and deformation detection results of each circular hole are marked at the corresponding positions.

[0096] Statistical analysis of the detection results is carried out to obtain the distances from the centers of each circle of each stamping part to the two edge lines, as well as the maximum and minimum values of the distances from each center to the edge contour, and calculate the errors between the measured values and the actual values. As shown in Tables 1, 2, 3, and 4, it can be seen that even if there are slight deformations in the circular holes, they can be accurately identified.

[0097] Table 1 Test data of circular hole 1 of each stamping part

[0098]

[0099]

[0100] Table 2 Test data of circular hole 2 of each stamping part

[0101]

[0102] Table 3 Test data of circular hole 3 of each stamping part

[0103]

[0104] Table 4 Test data of circular hole 4 of each stamping part

[0105]

[0106] When using the manual method to detect the deformation of stamping parts, misjudgment is likely to occur due to the visual fatigue of workers and individual judgment differences. Although choosing a machine to judge the deformation can carry out systematic detection, the purchase of equipment consumes high resources and has a large operation difficulty, thus increasing the production cost. The method for positioning and deformation detection of circular holes in stamping parts based on sub-pixel edge extraction proposed by the present invention can not only improve the accuracy and detection efficiency of stamping part deformation detection, reduce manual intervention, but also reduce the production cost.

[0107] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0108] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0109] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0110] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0111] As described above, it is only the preferred embodiments of the present invention, and it is not a limitation to the present invention in other forms. Any person skilled in the art may use the disclosed technical content to make changes or modifications into equivalent embodiments with equivalent changes. However, as long as it does not depart from the technical content of the technical solution of the present invention, any simple modification, equivalent change, and modification made to the above embodiments based on the technical essence of the present invention still fall within the protection scope of the technical solution of the present invention.

Claims

1. A method for positioning circular holes and detecting deformation of stamping parts based on sub-pixel edge extraction, characterized in that, It includes the following steps: Step 1: Collect the image of the stamping part and preprocess the image; Step 2: Use the OSTU threshold segmentation algorithm to extract the overall target of the stamping part, and then convert the image into a binary image; Step 3: Perform sub-pixel edge detection through the moment-based sub-pixel edge detection method. On the basis of sub-pixel edge detection, perform sub-pixel straight-edge fitting by the least squares method, and perform sub-pixel curve-edge fitting by the quadratic curve fitting method to obtain all the contour edges of the three types of straight lines, ellipses, and circles. Screen the two longest straight lines among the contour edges, which are the two edges on both sides of the stamping part. Extract the coordinates of both ends of the two straight lines through the coordinate operator respectively, and calculate the distance from the center of the circle to one edge by using the coordinates of both ends of the straight line and the coordinates of the center of the circle. Similarly, calculate the distance from the center of the circle to the other edge; Step 4: Set an offset threshold for the difference between the distances from the center of the circle to the two edges on both sides. The offset threshold is 1 / 150 of the distance between the two sides. If the difference between the distances from the center of the circle to the two sides exceeds the offset threshold, it is determined that the position of the round hole is offset; Step 5: Detect whether each round hole is deformed. The deformation of the round hole includes burrs, depressions, or insufficient roundness. The deformation detection is as follows: Calculate the distances from each center of the circle to each point on the round-edge contour, select the maximum value and the minimum value for comparison, and if the difference between the two exceeds the set range, it is determined that deformation has occurred.

2. The method for stamping round hole positioning and deformation detection based on sub-pixel edge extraction according to claim 1, characterized in that In Step 1, when preprocessing the image of the stamping part, the first step is to perform grayscale conversion on the image, and the second step is to perform noise reduction processing on the image by median filtering.

3. The method for positioning and deformation detection of circular holes on a stamping part based on sub-pixel edge extraction according to claim 1, wherein In Step 3, the moment-based sub-pixel edge detection method determines the position of the actual edge by assuming that the actual edge distribution in the image is consistent with the gray level of the ideal step edge model; The one-dimensional ideal step edge is connected by multiple pixels with gray levels h1 and h2. h1 and h2 are the gray levels of two pixels with a step distribution, and its step point is set as k. The actual pixel points are the pixel values distributed above and below the values of h1 and h2. The ideal edge is a pixel set composed of the two gray levels h1 and h2; and the edge position k and the gray levels h1 and h2 on both sides of the edge jointly determine the ideal edge; The one-dimensional ideal edge function is expressed as: E1(x) = (h1 - h2)μ(x - k) + h1 (1) where E1(x) represents the ideal edge and μ represents the step function; The edge position is: where n represents the total number of pixel points, and p1 represents the percentage of pixel points with gray level h1 in the total number of pixel points n; Assume that the gray values of the actual pixels are composed of a monotonic sequence g j , j = 1, 2, …, n, and the sequence starts from the pixel position; The moment-based sub-pixel edge detection method obtains a high-precision edge position by fitting the gray level. The prerequisite is to clarify the characteristics of the object to be measured before detection, so as to use the corresponding fitting algorithm for edge fitting.

4. The method for stamping part round hole positioning and deformation detection based on sub-pixel edge extraction according to claim 3, wherein The sub-pixel straight-edge fitting by the least squares method includes: On the basis of the pixel edge, the straight-line contour is a set of vectors. Perform least squares linear regression on this set of vectors, and set the regression equation as: y′ = k0 + k1x (3) Among them, y’ represents the function value of the regression equation, and k0 and k1 represent the two coefficients to be determined in the regression equation; let y i be the value of the measurement point, i be the pixel point serial number. When the distance between y i and y i ′ reaches the minimum, it is the position of the actual measurement value; combined with the extreme value theory, we have: Obtain k0 and k1, which are the fitted straight lines.

5. The method for positioning and deformation detection of circular holes on a stamping part based on sub-pixel edge extraction according to claim 3, characterized in that, The sub-pixel curve-edge fitting by the quadratic curve fitting method includes: Let the quadratic curve function be f(x) = ax 2 + bx + c. Calculate the coefficients of the quadratic curve function by the least squares method, so as to fit and obtain f(x), which are the coefficients that minimize the mean square error of the function; the obtained matrix equation system is BC = Y; where Solving the above equation gives the coefficients in the quadratic curve function f(x); taking the first derivative of f(x) and setting f′(x) = 0, finding the maximum value of the curve gives the coordinates of the edge point; similarly, the coordinates of the edge point in the Y direction are obtained using the quadratic curve fitting method.

6. The method for positioning and deformation detection of round holes on a stamping part based on sub-pixel edge extraction according to claim 1, characterized in that, Calculate the distances from each center of the circle to each point on the round-edge contour, including: Among them, Row and Colum respectively represent the horizontal and vertical coordinates of the center of the circle, and Row1 and Colum1 respectively represent the horizontal and vertical coordinates of each point on the edge; Select the maximum and minimum values in the array for comparison. If the difference between the two exceeds the set deformation threshold, it is determined that deformation has occurred.

Citation Information

Patent Citations

  • Circular stamping part defect detection method based on quantum firework arc edge extraction

    CN113870235A

  • Grinding wheel wear detection method and system based on machine vision

    CN114092403A