Image-based sub-pixel-level high-precision two-dimensional size online measurement method and system
Through the image-based high-precision two-dimensional dimension online measurement method, image processing technology is used to achieve high-precision measurement under low-resolution imaging system, solving the problems of high costs and strict hardware requirements in the existing technology, and achieving efficient and accurate industrial inspection.
Patent Information
- Application Number
- CN202510192613.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2045-02-21
AI Technical Summary
The existing high-precision online measurement technology has high system cost and strict hardware requirements due to the high resolution requirements of imaging equipment, making it difficult to achieve high-precision measurements under low-cost hardware.
The image-based high-precision two-dimensional dimension measurement method is adopted to achieve high-precision two-dimensional dimension measurement through the acquisition of part images, denoising and binarization processing, Hough edge detection correction, Canny and Zernike moment subpixel edge detection, synthesis of straight lines and intersection coordinate screening and other steps.
It realizes high-precision two-dimensional dimension measurement under low-resolution imaging systems, reducing hardware costs, and improving measurement efficiency and accuracy, meeting the requirements of industrial inspection.
Smart Images

Figure CN119665861A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of workpiece online measurement, and in particular to an image-based sub-pixel-level high-precision two-dimensional dimension online measurement method and system. Background Art
[0002] In modern manufacturing, the dimensional accuracy of parts is a crucial indicator of product quality. This is particularly true in high-precision industries such as aerospace, automotive manufacturing, and electronics, where part dimensional control directly impacts product assembly accuracy and final performance. Traditional dimensional measurement methods rely primarily on manual use of measuring tools such as vernier calipers and micrometers. This method is not only time-consuming and labor-intensive, but also subject to certain human errors. To improve measurement efficiency and accuracy, online measurement technologies are gaining increasing attention. Two-dimensional online measurement technology, as one such method, enables real-time measurement and control of part dimensions on the production line. Compared to traditional measurement methods, online measurement technology offers the following advantages: 1. High efficiency: It enables real-time measurement of part dimensions during the production process, significantly improving inspection efficiency. 2. High precision: Using high-precision optical measuring equipment, high-precision dimensional measurement down to the micron level can be achieved. 3. Automation: Online measurement systems can be integrated into automated production lines, reducing manual intervention, human error, and labor costs.
[0003] However, high-precision online measurement also places corresponding demands on the high resolution of imaging equipment. While improving the accuracy of online measurement, it often increases the cost of the measurement system, and the hardware requirements cannot be ignored. Similarly, low-resolution measurement systems are cheaper, but their measurement accuracy is inevitably reduced significantly. Summary of the Invention
[0004] The present invention provides an image-based sub-pixel-level high-precision two-dimensional dimension online measurement method and system to solve the technical problems mentioned in the background technology.
[0005] To achieve the above object, the technical solution of the present invention is achieved as follows: This invention provides an image-based, sub-pixel-level, high-precision online two-dimensional dimension measurement method, comprising the following steps: S1. Collect input part images and perform denoising and binarization processing on the collected part images; S2. The binarized part image is corrected by using the Hough edge detection-based image correction method to rotate the longest straight edge of the target in the part image to the horizontal direction, thereby straightening the part image and obtaining the corrected part image. S3. The Canny edge detection algorithm and the Zernike subpixel edge detection method are used in sequence to perform edge detection on the corrected part image in S2. The detection result is several line segments of the edge. According to the size of the part, the line segments are grouped according to different slopes and intercepts. Each group represents a straight edge of the part. S4. Combine the line segments from each group into a straight line. Take the slope of all line segments within each group. and intercept average and , as the slope and intercept of the line; S5. Obtain the coordinates of the intersections of all synthetic lines Erosion is performed on the binarized part image in S1, and the coordinates of points located outside the black area of the eroded image are filtered out to obtain new intersection point coordinates. The coordinates of this intersection point serve as the two endpoints of the edge line, and a line is connected between the two endpoints. ,straight line That is, the straight line of the outline edge of the part;
[0006] S7. Measure the contour of the part and obtain the measurement data.
[0007] Furthermore, step S1 specifically includes the following steps: S11. Place the part to be measured on the stage of the measuring equipment, and then acquire the image of the part using a telecentric camera; S12. Denoise the acquired part image, then calculate the binarization threshold using the binarization threshold selection formula, and perform binarization processing on the denoised part image using the binarization threshold; the binarization processing divides all pixels into two categories, C1 and C2. The formula for selecting the binarization threshold is as follows: ; ; ; ; , ; Where, is the global mean; represents the binarization threshold; is the pixel level of the part image, The value of is between 0 and 255; represents the between-class variance; and Represent the probability of occurrence of pixel values C1 and C2 respectively; Indicates grayscale threshold The cumulative mean; and These are the mean values of pixels in categories C1 and C2, respectively. Represents pixel value The probability of occurrence.
[0008] Furthermore, step S2 specifically includes the following steps: S21. First, use the Hough line detection method to detect the edge contour of the part image to obtain a number of line segments; then calculate the slopes of the line segments; S22. If the slopes of the line segments on the same edge are the same, select the slope value with the largest number of line segments. The edge with the most line segments is the edge of the longest straight line of the target; the calculation and slope value are... The angle between the line segment and the horizontal direction of the image coordinate axis included angle The specific calculation formula is as follows: ; Angle The absolute value, that is Let be the rotation angle of the image, if The rotation direction is clockwise: if If so, the direction of rotation is counterclockwise; S23, based on the included angle The longest straight edge of the target in the part image is rotated to the horizontal direction to straighten the part image; thus, a corrected part image is obtained.
[0009] Furthermore, the S3 specifically includes the following steps: S31, Canny edge detection algorithm detects the edge of the part image by setting high and low thresholds; and uses non-maximum suppression to process the part image; the calculation formulas of the high and low thresholds are as follows: ; in The high threshold is the optimal segmentation threshold. The threshold is low, and the threshold is higher than high. Points that are above a certain threshold are considered edge points, while points below a certain threshold are not considered edge points. S32, then performing edge detection on the part image after non-maximum suppression processing using a Zernike moment sub-pixel edge detection method to obtain a plurality of sub-pixel edge coordinates, and then connecting the plurality of sub-pixel edge coordinates according to the contour of the part to obtain a detection result, i.e., a plurality of edge line segments; S33. Based on the size of the part, group the line segments according to different slopes and intercepts, with each group representing a straight edge of the part.
[0010] Furthermore, step S32 specifically includes the following steps: S321. The coordinate points in the part image after non-maximum suppression processing Represented by an nth-order m-th Zernike moment; S322, Then rotate the part image after non-maximum suppression processing by an angle. The Zernike moment after rotation is ; S323. Calculate Zernike moments of different orders based on the rotational invariance of moments; S324. Substitute Zernike moments of different orders into the subpixel edge coordinate derivation formula to obtain the coordinate points. The corresponding subpixel edge coordinates; S325, looping S321 to S324 until the number of loops reaches the set number, and obtaining multiple sub-pixel edge coordinates; S326. Then, based on the contour of the part, connect the coordinates of multiple sub-pixel edges to obtain the detection result, which is several line segments of the edge.
[0011] Furthermore, in S321 Step The Zernike moments are represented as follows: ; in, 、 All are integers and satisfy , is an even number and ; yes The conjugate complex number in polar coordinates It is an orthogonal polynomial in polar coordinates. Coordinates polar coordinates, The origin and coordinate points Vector length between The angle between this vector and the counterclockwise direction of the x-axis is given.
[0012] Furthermore, the specific derivation formula for the sub-pixel edge coordinates in S324 is as follows: ; in, Subpixel edge coordinates This represents the vertical distance from the origin to the ideal edge.
[0013] Furthermore, the S5 specifically includes the following steps: S51. Obtain the coordinates of the intersection points of all the composite lines. ; S52, Create The all-1 array of is used as the convolution kernel of the corrosion process. The value range of the array is 0~255. Then the number of iterations of the corrosion operation is set; and multiple rounds of corrosion are performed on the part image after binarization in S1. The corrosion operation can be expressed as: ; Where structure A represents the image and structure B represents the convolution kernel; S53, Traverse the coordinates of intersection points Determine coordinates Whether it is located in the black area of the eroded image, and the coordinates of the points retained within this area are: ; S54, coordinates of traversal points Select two lines from S4 that are located on the same composite line. Take the coordinates of the intersection points on the line and use these two intersection points as the two endpoints of the line. Connect the two endpoints with the line. ,straight line That is, the straight line of the outline edge of the part.
[0014] Furthermore, the following steps are included between S5 and S7: S6. Use the Hough transform method to detect the circular contour of the part and draw the circular hole contour of the part. The straight lines of the contour edge of the part and the circular hole contour of the part constitute the contour of the part.
[0015] Furthermore, step S6 specifically includes the following steps: S61, using polygonal approximation to detect the contours of the Canny image, preliminarily screening out contours that meet a preset condition, where the preset condition is that the number of corner points of the contour must be greater than 10; S62, using the least squares method to fit the selected contour, approximating it to a circle, obtaining the fitted circle center coordinates (xp, yp) and the circle radius rp, and screening out circles that meet the radius according to the set minimum radius and maximum radius; S63. Sub-pixel positioning of the circular hole contour of the part is performed according to the Zernike moment algorithm, and the RANSAC algorithm is used for data fitting to remove the deviation points, thereby obtaining the circular hole contour of the part; the contour edge straight line of the part and the circular hole contour of the part constitute the contour of the part.
[0016] In another aspect, the present invention provides a subpixel-level high-precision two-dimensional online measurement system, including a computer device, which is programmed or configured to perform the above-described subpixel-level high-precision two-dimensional online measurement method. Alternatively, the computer device may have a computer program stored in its memory that is programmed or configured to perform the above-mentioned subpixel-level high-precision online two-dimensional dimension measurement method.
[0017] Beneficial effects of the present invention: 1. This invention proposes an image-based subpixel-level high-precision online measurement method for two-dimensional dimensions, which solves the measurement problems of high resolution and high cost associated with existing high-precision measurements. This invention uses part images to perform high-precision measurement of the two-dimensional dimensions of objects, achieving a measurement accuracy at the micrometer level. It realizes efficient, accurate, and automated detection of part dimensions during the production process, providing strong support for quality control and production optimization in the manufacturing industry.
[0018] 2. This invention enables high-precision automated parts inspection in industrial production without requiring significant modifications to the production line, saving unnecessary expenses. Furthermore, this invention eliminates the need for precision inspection under a high-resolution imaging system, greatly reducing the hardware cost of the inspection equipment. 3. This invention, while utilizing a low-resolution imaging system, still ensures measurement accuracy meets industrial testing requirements. Simultaneously, its second-level measurement speed improves the efficiency of real-time product quality monitoring in industrial production, thus solving the problem of high efficiency at high cost. Attached Figure Description
[0019] Figure 1 is a flow chart of the present invention; Figure 2 This is an example diagram of a part image captured by the telecentric camera in the present invention; Figure 3 This is an enlarged image of the sub-pixel edge local fitting of the example image of the part in the embodiment of the invention; Figure 4 This is an example diagram showing the measurement of the contour of a part in an embodiment of the present invention; Figure 5 Figure (a) shows the ideal model for subpixel edge detection, where (a) represents the original edge image model and (b) shows the rotated edge image model. Detailed Implementation
[0020] To facilitate understanding of the present invention, the present invention will be described more fully below with reference to the accompanying drawings. The drawings illustrate preferred embodiments of the present invention. However, the present invention may be implemented in many other forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the present disclosure.
[0021] Reference Figure 1 This application provides an image-based sub-pixel-level high-precision online measurement method for two-dimensional dimensions, comprising the following steps: S1. Acquire the input part image and perform denoising and binarization processing on the acquired part image; S2. The binarized part image is corrected by using the Hough edge detection-based image correction method to rotate the longest straight edge of the target in the part image to the horizontal direction, thereby straightening the part image and obtaining the corrected part image. S3. The Canny edge detection algorithm and the Zernike subpixel edge detection method are used in sequence to perform edge detection on the corrected part image in S2. The detection result is several line segments of the edge. According to the size of the part, the line segments are grouped according to different slopes and intercepts. Each group represents a straight edge of the part. S4. Combine the line segments from each group into a straight line. Take the slope of all line segments within each group. and intercept Average value and , which serves as the slope and intercept of the straight line; S5. Obtain the coordinates of the intersections of all synthetic lines Erosion is performed on the binarized part image in S1, and the coordinates of points located outside the black area of the eroded image are filtered out to obtain new intersection coordinates. The coordinates of this intersection point serve as the two endpoints of the edge line, and a straight line is connected between the two endpoints. ,straight line That is the contour edge straight line of the part; S7. Measure the contour of the part and obtain the measurement data.
[0022] In some embodiments, S1 specifically includes the following steps: S11. Place the part to be measured on the stage of the measuring equipment, and then acquire an image of the part using a telecentric camera. See the example image of the part. Figure 2 ; S12. Denoise the acquired part image, then calculate the binarization threshold using the binarization threshold selection formula, and perform binarization processing on the denoised part image using the binarization threshold; the binarization processing divides all pixels into two categories, C1 and C2. The formula for selecting the binarization threshold is as follows: ; ; ; ; , ; In the formula, This is the global mean. Indicates the binarization threshold; is the pixel level of the part image, The value of is between 0 and 255; Represents the variance between classes; and Represent the probability of occurrence of pixel values C1 and C2 respectively; Indicates grayscale threshold The cumulative mean; and These are the mean values of pixels in categories C1 and C2, respectively. Represents pixel value The probability of occurrence.
[0023] The selected threshold All pixels are divided into two categories C1 and C2, where C1 consists of pixels with gray levels in [0, k-1] and C2 consists of pixels with gray levels in [k, 255].
[0024] In some embodiments, the step S2 specifically includes the following steps: S21. First, use the Hough line detection method to detect the edge contour of the part image to obtain a number of line segments; then calculate the slopes of the line segments; S22. If the slopes of the line segments on the same edge are the same, select the slope value with the largest number of line segments. The edge with the most line segments is the edge of the longest straight line of the target; the calculation and slope value are... The angle between the line segment and the horizontal direction of the image coordinate axis included angle The specific calculation formula is as follows: ; Angle The absolute value, that is Let be the rotation angle of the image, if The rotation direction is clockwise: if If so, the direction of rotation is counterclockwise; S23, based on the included angle The longest straight edge of the target in the part image is rotated to the horizontal direction to straighten the part image; thus, a corrected part image is obtained.
[0025] In some embodiments, S3 specifically includes the following steps: S31, Canny edge detection algorithm detects the edge of the part image by setting high and low thresholds; and uses non-maximum suppression to process the part image; the calculation formulas of the high and low thresholds are as follows: ; in The high threshold is the optimal segmentation threshold. is a low threshold; Above the high threshold Points above a certain threshold are considered edge points, while points below a low threshold are not considered edge points; in discontinuous parts, if... and Points between points that are near edge points are treated as edge points to smooth the edges.
[0026] S32, then performing edge detection on the part image after non-maximum suppression processing using a Zernike moment sub-pixel edge detection method to obtain a plurality of sub-pixel edge coordinates, and then connecting the plurality of sub-pixel edge coordinates according to the contour of the part to obtain a detection result, i.e., a plurality of edge line segments; S33. Based on the size of the part, group the line segments according to different slopes and intercepts, with each group representing a straight edge of the part.
[0027] In some embodiments, S32 specifically includes the following steps: S321. The coordinate points in the part image after non-maximum suppression processing pass Step The Zernike moment is expressed; the S321 Step The Zernike moments are represented as follows: ; in, 、 All are integers and satisfy , is an even number and ; yes The conjugate complex number in polar coordinates It is an orthogonal polynomial in polar coordinates. Coordinates polar coordinates, The origin and coordinate points Vector length between The angle between this vector and the counterclockwise direction of the x-axis; S322, Then rotate the part image after non-maximum suppression processing by an angle. The Zernike moment after rotation is ; Reference Figure 5 The straight lines contained within the unit circle. Representing the ideal edge, the gray values on both sides of the straight line are... and , is the grayscale difference, The perpendicular distance from the origin to the ideal edge. for The angle with the x-axis. Edge parameters, i.e., functions, can be determined by Zernike moments. , , , , The corresponding integral kernel functions can be calculated using the polynomial definition of Zernike moments: , , , , ; S323. Calculate Zernike moments of different orders based on the rotational invariance of moments; ; From the above formula, we can calculate , , , ,make From the formula It can be seen that ,in and They are The real and imaginary parts of the equation are used to calculate the rotation angle. ; S324. Substitute Zernike moments of different orders into the subpixel edge coordinate derivation formula to obtain the coordinate points. The corresponding sub-pixel edge coordinate values; the specific derivation formula for the sub-pixel edge coordinates in S324 is as follows: ; in, Subpixel edge coordinates This represents the vertical distance from the origin to the ideal edge.
[0028] Considering the template amplification effect, for The template can be used to modify the derivation formula as follows: ; S325, repeat S321 to S324 until the set number of iterations is reached to obtain multiple sub-pixel edge coordinates; S326. Then, based on the contour of the part, connect the coordinates of multiple sub-pixel edges to obtain the detection result, which is several line segments of the edge.
[0029] In some embodiments, S5 specifically includes the following steps: S51. Obtain the coordinates of the intersection points of all the composite lines. ; S52, Create The all-1 array of is used as the convolution kernel of the corrosion process, and the value range of the array is 0~255. Then the number of iterations of the corrosion operation is set to 5 times; and multiple rounds of corrosion are performed on the part image after binarization in S1; the corrosion operation can be expressed as: ; Where structure A represents the image and structure B represents the convolution kernel; S53, Traverse the coordinates of intersection points Determine coordinates Whether it is located in the black area of the eroded image, and the coordinates of the points retained within this area are: ; S54, coordinates of traversal points Select two lines from S4 that are located on the same composite line. Take the coordinates of the intersection points on the line and use these two intersection points as the two endpoints of the line. Connect the two endpoints with the line. ,straight line That is, the straight line of the outline edge of the part.
[0030] In some embodiments, the following steps are further included between S5 and S7: S6. Use the Hough transform method to detect the circular contour of the part and draw the circular hole contour of the part. The straight lines of the contour edge of the part and the circular hole contour of the part constitute the contour of the part.
[0031] In some embodiments, S6 specifically includes the following steps: S61, using polygonal approximation to detect the contours of the Canny image, preliminarily screening out contours that meet a preset condition, where the preset condition is that the number of corner points of the contour must be greater than 10; S62, using the least squares method to fit the selected contour, approximating it to a circle, obtaining the fitted circle center coordinates (xp, yp) and the circle radius rp, and screening out circles that meet the radius according to the set minimum radius and maximum radius; S63. Perform sub-pixel positioning of the circular hole contour of the part using the Zernike moment algorithm, and use the RANSAC algorithm for data fitting to remove deviation points and obtain a refined contour circle, thereby obtaining the circular hole contour of the part; the contour edge straight line of the part and the circular hole contour of the part constitute the contour of the part. See the schematic diagram of the part contour for Figure 4 .
[0032] The present invention realizes high-precision automated parts detection in industrial production, and at the same time, does not require major changes to the production line, saving unnecessary expenses. At the same time, the present invention does not require precision detection under a high-resolution imaging system, which also greatly reduces the hardware cost of the detection equipment.
[0033] The present invention, with the help of a low-resolution imaging system, can also ensure that the measurement accuracy meets the requirements of industrial inspection. At the same time, the measurement speed of seconds also improves the efficiency of real-time inspection of product quality in industrial production, solving the problem of high efficiency and high cost.
[0034] In another aspect, the present invention provides a subpixel-level high-precision two-dimensional online measurement system, including a computer device, which is programmed or configured to perform the above-described subpixel-level high-precision two-dimensional online measurement method. Alternatively, the computer device may have a computer program stored in its memory that is programmed or configured to perform the above-mentioned subpixel-level high-precision online two-dimensional dimension measurement method.
[0035] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. An image-based sub-pixel high-precision two-dimensional dimension online measurement method, characterized in that: The steps include: S1, collecting input part images, and performing denoising and binarization processing on the collected part images; S2. Using an image correction method based on Hough edge detection to correct the binarized part image, the longest straight edge of the target in the part image is rotated to the horizontal direction, so as to straighten the part image and obtain a corrected part image; S3, using the Canny edge detection algorithm and the Zernike moment sub-pixel edge detection method in turn, to perform edge detection on the part image corrected in S2. The detection result is a number of edge line segments. According to the size of the part, the line segments are grouped according to different slopes and intercepts. Each group represents a straight line edge of the part. S4. Combine the line segments of each group into a straight line , take the slope of all line segments in each group and the intercept The average and , as the slope and intercept of the line; S5. Obtain the coordinates of the intersection points of all synthetic lines , corrode the binarized part image in S1, filter out the point coordinates outside the black area of the corroded image, and obtain the new intersection coordinates , the coordinates of this intersection are used as the two endpoints of the edge line, and a straight line is connected between the two endpoints ,straight line It is the contour edge straight line of the part; S7. Measure the contour of the part to obtain measurement data.
2. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 1, characterized in that: The S1 specifically includes the following steps: S11, placing the part to be measured on the stage of the measuring device, and then collecting the input part image through the telecentric camera; S12, denoising the collected part image, then obtaining a binarization threshold through a binarization threshold selection formula, and binarizing the part image after denoising using the binarization threshold; dividing all pixels into two categories, C1 and C2, through the binarization process; The binary threshold selection formula is as follows: ; ; ; ; , ; In the formula, is the global mean; represents the binarization threshold; is the pixel level of the part image, The value of is between 0 and 255; represents the between-class variance; and Respectively represent the probability of occurrence of pixel values C1 and C2; Grayscale threshold The cumulative mean of and are the mean values of pixels of categories C1 and C2 respectively; Represents pixel value Probability of occurrence.
3. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 2, characterized in that: The S2 specifically includes the following steps: S21. First, the edge contour of the part image is detected using the Hough line detection method to obtain a number of line segments; then the slopes of the line segments are calculated; S22. If the slopes of the line segments on the same edge are the same, select the slope value with the largest number of line segments. , the edge with the largest number of line segments is the longest straight line edge of the target; the slope value is calculated as The angle between the line segment and the horizontal direction of the image coordinate axis , angle The calculation formula is as follows: ; Angle The absolute value of is the rotation angle of the image, if , the rotation direction is clockwise: If , the direction of rotation is counterclockwise; S23, according to the angle Rotate the longest straight edge of the target in the part image to the horizontal direction to straighten the part image; Get the corrected part image.
4. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 3, characterized in that: The S3 specifically includes the following steps: S31, Canny edge detection algorithm detects the edge of the part image by setting high and low thresholds; and uses non-maximum suppression to process the part image; the calculation formulas of the high and low thresholds are as follows: ; in is a high threshold, i.e., the optimal segmentation threshold; is the low threshold, higher than the high threshold Points with a value lower than the low threshold are considered edge points, while points with a value lower than the low threshold are not considered edge points. S32, then performing edge detection on the part image after non-maximum suppression processing by using a Zernike moment sub-pixel edge detection method to obtain a plurality of sub-pixel edge coordinates, and then connecting the plurality of sub-pixel edge coordinates according to the contour of the part to obtain a detection result, i.e., a plurality of edge line segments; S33. According to the size of the part, group the line segments with different slopes and intercepts. Each group represents a straight line edge of the part.
5. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 4, characterized in that: The S32 specifically includes the following steps: S321, the coordinate points in the part image after non-maximum suppression processing pass Step It is represented by the Zernike moment; S322, then rotate the part image after non-maximum suppression processing by an angle , the Zernike moment after rotation is ; S323, according to the moment rotation invariance, calculate the Zernike moments of different orders; S324, substituting different orders of Zernike moments into the sub-pixel edge coordinate derivation formula to obtain the coordinate point The corresponding sub-pixel edge coordinate values; S325, looping S321 to S324 until the number of loops reaches a set number, and obtaining a plurality of sub-pixel edge coordinates; S326. Then, multiple sub-pixel edge coordinates are connected according to the contour of the part to obtain a detection result, that is, a plurality of edge line segments.
6. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 5, characterized in that: The S321 Step The sub-Zernike moment is expressed as follows: ; in, , are integers and satisfy , is an even number and ; yes The conjugate complex number in polar coordinates, is an orthogonal polynomial in polar coordinates, is the coordinate point The polar coordinates of The origin and coordinate points The length of the vector between is the counterclockwise angle between this vector and the x-axis.
7. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 5, characterized in that: The sub-pixel edge coordinate derivation formula in S324 is as follows: ; in, is the sub-pixel edge coordinate, Represents the vertical distance from the origin to the ideal edge.
8. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 7, characterized in that: The S5 specifically includes the following steps: S51, obtain the intersection coordinates of all synthetic lines ; S52. Create a The all-1 array of is used as the convolution kernel of the corrosion process, and the value range of the array is 0~255. Then the number of iterations of the corrosion operation is set; and multiple rounds of corrosion are performed on the part image after binarization in S1; the corrosion operation can be expressed as: ; Among them, structure A represents the image, and structure B represents the convolution kernel; S53, traversing intersection coordinates , determine the coordinates Whether it is located in the black area of the eroded image, the coordinates of the points retained in this area are ; S54, traversal point coordinates , select two from S4 that are on the same synthetic line The coordinates of the intersection points on the right and left are used as the two end points of the straight line, and a straight line is connected between the two end points. ,straight line This is the straight line of the contour edge of the part.
9. The image-based sub-pixel high-precision two-dimensional dimension online measurement method according to claim 8, characterized in that: The following steps are also included between S5 and S7: S6. Detect the circular contour of the part using the Hough transform method and draw the circular hole contour of the part. The contour edge straight line of the part and the circular hole contour of the part constitute the contour of the part. The S6 specifically includes the following steps: S61, using polygons to approximate the contours obtained by the Canny detection image, and preliminarily screening out contours that meet a preset condition, where the preset condition is that the number of corner points of the contour must be greater than 10; S62, using the least square method to fit the selected contour, approximating it to a circle, obtaining the fitted center coordinates (xp, yp) and the radius rp of the circle, and selecting a circle that meets the radius according to the set minimum radius and maximum radius; S63. Sub-pixel positioning of the circular hole contour of the part is performed according to the Zernike moment algorithm, and the RANSAC algorithm is used for data fitting to remove deviation points, thereby obtaining the circular hole contour of the part; the contour edge straight line of the part and the circular hole contour of the part constitute the contour of the part.
10. A sub-pixel high-precision two-dimensional dimension online measurement system, comprising a computer device, characterized in that: The computer device is programmed or configured to execute the sub-pixel high-precision two-dimensional dimension online measurement method according to any one of claims 1 to 9; Or, a computer program programmed or configured to execute the sub-pixel level high-precision two-dimensional dimension online measurement method as described in any one of claims 1 to 9 is stored in the memory of the computer device.
Citation Information
Patent Citations
A high-precision sub-pixel circular part measuring method
CN109003258A
Imaging measurement method for size of shaft-type small part
CN111047588A
Contour detector, positioning apparatus, pattern-drawing device, and contour detection method
JP2008135423A
Line width measurement method and apparatus, computing processing device, computer program, and computer readable medium
WO2023070593A1