A valve spring parallelism measurement method based on machine vision

CN118365691BActive Publication Date: 2026-08-07HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HEFEI UNIV OF TECH
Filing Date
2024-04-28
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0002]当下,对气门弹簧的平行度检测主要还是依靠人工的方式,传统人工测量方式存在着以下不足:检测的精度不高、容易出现误检和漏检、检测的效率不高检测结果不易保存和调用

Benefits of technology

[0050]由上述技术方案可知,本发明通过清除数据点集中的离散群点,并结合测量平台的计算角度矫正,消除了多种外部因素对测量弹簧平行度带来的误差影响,提高了计算结果的准确性和稳定性,满足实际生产中的基本需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118365691B_ABST
    Figure CN118365691B_ABST
Patent Text Reader

Abstract

The application relates to a valve spring parallelism measurement method based on machine vision, which comprises the following steps: S1: placing the spring vertically on a measuring platform for backlight irradiation, and collecting a spring image by using an industrial camera; S2: carrying out denoising processing on an original image to obtain an image O; S3: carrying out binaryzation processing on the image O to obtain an image P; S4: carrying out canny operator edge detection method processing on the image P to obtain an image P canny ; S5: carrying out cluster analysis to obtain S6: carrying out discrete group point removal operation; S7: calculating a measuring platform tilt angle to obtain valve spring parallelism. According to the above scheme, the discrete group points in the data point set are removed, the angle of the measuring platform is calculated and corrected, the error influence caused by various external factors on the measurement spring parallelism is eliminated, the accuracy and stability of the calculation result are improved, and the basic demand in actual production is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing, and more specifically to a method for measuring the parallelism of valve springs based on machine vision. Background Technology

[0002] Currently, the parallelism of valve springs is mainly tested manually. Traditional manual measurement methods have the following shortcomings: low accuracy, easy to make false detections and missed detections, low efficiency, and the test results are not easy to save and retrieve. Summary of the Invention

[0003] The purpose of this invention is to provide a machine vision-based method for measuring the parallelism of valve springs. This method can make the measurement results closer to the actual size of the spring, which not only greatly improves the measurement accuracy, but also effectively reduces the measurement error and improves efficiency.

[0004] To achieve the above objectives, the present invention includes the following steps:

[0005] S1: Place the spring vertically on the measuring platform and illuminate it with backlight using a vertical orthographic projection method, while simultaneously using an industrial camera to capture images of the spring.

[0006] S2: Image O is obtained by denoising the original image acquired in S1 using a Gaussian filtering algorithm and a 3×3 Gaussian kernel;

[0007] S3: Binarize image O to obtain image P;

[0008] S4: Image P is obtained by reprocessing image P using the Canny operator edge detection method. canny ;

[0009] S5: For image P canny Scanning from left to right with a step size Δx, the pixels with a grayscale value of 255 are obtained, representing the pixel coordinates on the left and right sides of the measuring platform and the upper plane of the spring. Cluster analysis is then performed on the collected pixels to obtain... The point set stores the pixel coordinates of the left, right and upper ends of the spring of the measurement platform, respectively;

[0010] S6: For the collected data Perform discrete group point clearing operation on the point set;

[0011] S7: Calculate the tilt angle of the platform, correct the pixel coordinates at the top of the spring, and obtain a new point set. And on The parallelism of the valve spring is obtained by solving the problem.

[0012] In S4 mentioned above, the canny operator edge detection method for image P includes the following steps:

[0013] S4.1: Calculate the image gradient gray scale amplitude T max and angle using the Sobel operator;

[0014] S4.2: Screen out the local maximum values of the image according to the obtained T max Judge the edge points through double thresholds and connect them to achieve image edge detection.

[0015] The above-mentioned S5 includes the following steps:

[0016] S5.1: Scan image P canny from left to right with a step size of Δx. Δx takes 3 pixel points, and store the coordinates of all qualified pixel points into the point set Point, and record the number k of all pixel points;

[0017] S5.2: Conduct the first clustering analysis. Traverse Point and add up the y coordinate values of all pixel points to calculate the average value Then compare the y coordinate values of all pixel points in Point with If then store it into and record it as the point set of the pixel point coordinates of the measurement platform, otherwise store it into and record it as the point set of the pixel point coordinates of the upper end of the spring. At the same time, re - sort the point set in ascending order of the x coordinate;

[0018] S5.3: Conduct the second clustering analysis. Traverse Add up the x coordinate values of all pixel points to calculate the average value Then Compare the x coordinate values of all pixel points in with If then store it into and record it as the point set of the pixel point coordinates on the right side of the measurement platform, otherwise skip and continue to judge the next coordinate point, record it as the point set of the pixel point coordinates on the left side of the measurement platform. At the same time, sort the two point sets

[0019] The above-mentioned S6 includes the following steps:

[0020] S6.1: Calculate the average value of the y coordinate values of n pixel points in

[0021]

[0022] ​S6.2: Again The residual error v is calculated from n data points. k ;

[0023]

[0024] S6.3: Calculated The root mean square deviation σ of n data points;

[0025]

[0026] S6.4: Calculation The y-coordinate value and average value of each pixel. The difference Discard the coordinates of pixels with a difference greater than 3σ.

[0027] Where: n is The number of all elements in the array, i = 0, 1, 2, j = 1, 2, ..., n;

[0028] y j yes Pixel y-axis coordinate;

[0029] σ is the root mean square deviation;

[0030] yes Average y-axis coordinate of each pixel;

[0031] v k It is the residual error.

[0032] The S7 step includes the following steps:

[0033] S7.1: Find the pixel coordinates max_left, min_left and max_right, min_right of the maximum and minimum y-coordinates on the left and right sides of the measurement platform, respectively. Compare the x-coordinates of max_right and max_left. If max_left > max_right, then the formula for calculating the platform tilt angle θ is:

[0034]

[0035] Conversely, the formula for calculating the platform tilt angle θ is:

[0036]

[0037] S7.2: Correction of what was obtained in S5 pixel coordinates x in the point set i ′ ,y i ′ ;

[0038]

[0039] Obtain the new set of pixel coordinates at the upper end of the spring.

[0040]

[0041] S7.3: According to Using the coordinate system, the least squares method is used to fit the fitted straight line y at the upper end of the spring.

[0042] y = kx + b S7.4: Solve for the parallelism of the spring Parallelism;

[0043] Para = k(x) max -x min )

[0044] Where: x max x min They are Maximum and minimum x-coordinate values ​​of the middle pixel;

[0045] θ is the platform tilt angle;

[0046] These are the coordinates of the pixel at the top of the corrected spring;

[0047] K is the slope of the fitted line;

[0048] (x i ,y i () represents the coordinates of the pixel at the top of the original spring;

[0049] (x i ′ ,y i ′ () represents the coordinates of the corrected pixel.

[0050] As can be seen from the above technical solution, the present invention eliminates the influence of various external factors on the measurement of spring parallelism by clearing discrete clusters of data points and combining the calculation angle correction of the measurement platform, thereby improving the accuracy and stability of the calculation results and meeting the basic needs in actual production. Attached Figure Description

[0051] Figure 1 This is a flowchart of the present invention;

[0052] Figure 2 Image O is obtained after Gaussian filtering.

[0053] Figure 3 Image P is obtained by binarizing image O;

[0054] Figure 4 Image P is obtained by edge detection of image P using the Canny operator. canny ;

[0055] Figure 5 It is the data collection point on the left side of the measurement platform;

[0056] Figure 6 It is the sampling point at the upper end of the spring;

[0057] Figure 7 It is the data collection point on the right side of the platform;

[0058] Figure 8 This is a comparison chart of measurement data results from the present invention and manual measurement. Detailed Implementation

[0059] The present invention will be further described below with reference to the accompanying drawings:

[0060] like Figure 1 The method for measuring valve spring parallelism based on machine vision includes the following steps:

[0061] First, the spring is placed vertically on the measuring platform and backlit using a vertical orthographic projection method, while an industrial camera is used to capture images of the spring.

[0062] Secondly, to reduce the impact of external factors on the raw images captured by the industrial camera, a Gaussian filtering algorithm with a 3×3 Gaussian kernel is used to denoise the raw images captured by S1, resulting in the following image: Figure 2 The image O shown is a result of convolving a Gaussian kernel with each pixel in the image. This is essentially a weighted summation process, where the gray value of each pixel is weighted according to its distance from the center of the Gaussian kernel and the weight of the Gaussian kernel. The result of the convolution operation is then used as the new pixel value, replacing the corresponding pixel value in the original image.

[0063] Then, image O is binarized to obtain image P. That is, a fixed threshold method is used to binarize the attached image. Figure 2 The image O is binarized to obtain the following: Figure 3 The image P shown is used to determine the threshold T through experiments. When the gray value of a detected pixel is greater than the threshold T, the gray value of that pixel is set to 255, and it appears as white in the image, thus being segmented as the background. When the gray value of a detected pixel is less than the threshold T, the gray value of that pixel is set to 0, and it appears as black in the image, thus being segmented as the object to be tested. Finally, a binarized image P is obtained.

[0064] Next, the binarized image P is reprocessed using the Canny operator edge detection method to obtain image P.canny , that is, denoise the image P of Figure 3 by Gaussian filtering. Specifically: calculate the gradient magnitude and direction of each edge point, operate using the Sobel operator template, and solve the gradient gray-scale amplitude T max and direction; according to the input threshold, compare the gradient gray-scale amplitude T max detected in the previous step, and obtain the local maximum value of the image by screening; judge and connect the edge points through double thresholds, and finally achieve image edge detection to obtain the image P as shown in Figure 4 . canny .

[0065] Subsequently, scan the image P canny from left to right with a step size of Δx, and the pixel points with a gray value equal to 255 are the pixel point coordinates of the left and right sides of the measurement platform and the upper plane of the spring; perform clustering analysis on the collected pixel points to obtain a point set, and store the pixel point coordinates of the left side, right side and upper end of the measurement platform respectively. Specifically include: 1) Scan the image P canny from left to right with a step size of Δx, Δx takes 3 pixel points, store all the qualified pixel point coordinates into the point set Point, and record the total number k of all pixel points; 2) Perform the first clustering analysis, traverse Point to add up the y coordinate values of all pixel points to find the average value and then compare the y coordinate values of all pixel points in Point with , if then store it into and record it as the pixel point coordinate point set of the measurement platform, otherwise store it into and record it as the pixel point coordinate point set of the upper end of the spring. At the same time, reorder the point set in ascending order of the x coordinate; 3) Perform the second clustering analysis, traverse add up the x coordinate values of all pixel points to find the average value and then compare the x coordinate values of all pixel points in with , if then store it into and record it as the pixel point coordinate point set of the right side of the measurement platform, otherwise skip and continue to judge the next coordinate point, record it as the pixel point coordinate point set of the left side of the measurement platform. At the same time, sort the two point sets in ascending order of the x coordinate, and mark all the points in the images such as Figure 5 , Figure 6 , Figure 7 .

[0066] Subsequently, to prevent external environmental factors from affecting the collected point set, the collected data was... The point set undergoes a discrete cluster point clearing operation. Specifically:

[0067] 1) Calculation The average y-coordinate values ​​of n pixels

[0068]

[0069] 2) Then on The residual error v is calculated from n data points. k ;

[0070]

[0071] 3) Calculation results The root mean square deviation σ of n data points;

[0072]

[0073] 4) Calculation The y-coordinate value and average value of each pixel. The difference Discard the coordinates of pixels with a difference greater than 3σ.

[0074] Where: n is The number of all elements in the array, i = 0, 1, 2, j = 1, 2, ..., n;

[0075] y j yes Pixel y-axis coordinate;

[0076] σ is the root mean square deviation;

[0077] yes Average y-axis coordinate of each pixel;

[0078] v k It is the residual error.

[0079] Finally, by calculating the tilt angle of the platform and correcting the coordinates of the pixels at the top of the spring, a new point set is obtained. And on The parallelism of the valve spring is obtained by solving the problem. Specifically:

[0080] 1) Find the pixel coordinates max_left, min_left and max_right, min_right of the left and right sides of the measurement platform, respectively. Compare the x-coordinates of max_right and max_left. If max_left > max_right, then the formula for calculating the platform tilt angle θ is:

[0081]

[0082] Conversely, the formula for calculating the platform tilt angle θ is:

[0083]

[0084] 2) Correction of S5 obtained pixel coordinates x in the point set i ′ ,y i ′ ;

[0085]

[0086] Obtain the new set of pixel coordinates at the upper end of the spring.

[0087]

[0088] 3) According to Using the coordinate system, the least squares method is used to fit the fitted straight line y at the upper end of the spring.

[0089] y = kx + b

[0090] 4) Solve for the parallelism of the spring, Para;

[0091] Para = k(x) max -x min )

[0092] Where: x max x min They are Maximum and minimum x-coordinate values ​​of the middle pixel;

[0093] θ is the platform tilt angle;

[0094] These are the coordinates of the pixel at the top of the corrected spring;

[0095] K is the slope of the fitted line;

[0096] (x i ,y i () represents the coordinates of the pixel at the top of the original spring;

[0097] (x i ′ ,y i ′ () represents the coordinates of the corrected pixel.

[0098] like Figure 8 As shown, when measuring the parallelism of valve springs using the method provided by this invention, the measurement results are closer to the actual dimensions of the springs, which not only greatly improves measurement accuracy but also effectively reduces measurement errors and improves efficiency. The embodiments described above are merely preferred embodiments of this invention and are not intended to limit the scope of the invention. Various modifications and improvements made to the technical solutions of this invention by those skilled in the art without departing from the spirit of the invention should fall within the protection scope defined by the claims of this invention.

Claims

1. A machine vision-based method for measuring the parallelism of valve springs, comprising the following steps: S1: Place the spring vertically on the measuring platform and illuminate it with backlight using a vertical orthographic projection method, while simultaneously using an industrial camera to capture images of the spring. S2: Image O is obtained by denoising the original image acquired in S1 using a Gaussian filtering algorithm and a 3×3 Gaussian kernel; S3: Binarize image O to obtain image P; S4: Image P is obtained by reprocessing it using the Canny operator edge detection method. ; S5: For images From left to right and by step Scanning was performed, and the coordinates of pixels with a grayscale value of 255 were obtained, representing the pixel coordinates on the left and right sides of the measuring platform and the upper plane of the spring. Cluster analysis was then performed on the collected pixels to obtain... The point set stores the pixel coordinates of the left, right and upper ends of the spring of the measurement platform, respectively; S6: For the collected data Perform discrete group point clearing operation on the point set; S7: Calculate the tilt angle of the platform, correct the pixel coordinates at the top of the spring, and obtain a new point set. and to The parallelism of the valve spring is obtained by solving the problem. The S5 step includes the following steps: S5.1: For images From left to right and by step Perform a scan. Take 3 pixels, obtain the coordinates of all pixels that meet the conditions and store them in the point set Point, and record the total number of pixels k. S5.2: Perform the first cluster analysis, iterate through Point and sum the y-coordinate values ​​of all pixels to calculate the average. Then, compare the y-coordinate values ​​of all pixels in the Point with... If a comparison is made, Then store in The middle part is denoted as the set of pixel coordinates of the measurement platform; otherwise, it is stored in... The middle part is denoted as the set of pixel coordinates at the upper end of the spring, and the set of points is also... Reorder them according to their x-coordinates from smallest to largest; S5.3: Perform the second clustering analysis and traverse Add up the x - coordinate values of all pixel points and calculate the average value , and then Compare the x - coordinate values of all pixel points in with . If > , store them in and record them as the coordinate point set of the pixel points on the right side of the measurement platform. Otherwise, skip and continue to judge the next coordinate point, record them as the coordinate point set of the pixel points on the left side of the measurement platform, and at the same time sort the two point sets in ascending order of the x - coordinate; The S7 step includes the following steps: S7.1: Find the pixel coordinates max_left, min_left and max_right, min_right of the maximum and minimum y-coordinates on the left and right sides of the measurement platform, respectively. Compare the x-coordinates of max_right and max_left. If max_left > max_right, then the platform tilt angle is... The calculation formula is: Conversely, the platform tilt angle The calculation formula is: S7.2: Correction of what was obtained in S5 Pixel coordinates in point set ; Obtain the new set of pixel coordinates at the upper end of the spring. ; S7.3: According to Using the coordinate system, the least squares method is used to fit the fitted straight line y at the upper end of the spring. S7.4: Solve for the spring parallelism Para; in: They are Maximum and minimum x-coordinate values ​​of the middle pixel; It refers to the platform's tilt angle; These are the coordinates of the pixel at the top of the corrected spring; k is the slope of the fitted line. These are the coordinates of the pixel at the top of the original spring; These are the pixel coordinates after correction.

2. The valve spring parallelism measurement method based on machine vision according to claim 1, characterized in that: In step S4, the Canny operator edge detection method for image P includes the following steps: S4.1: Calculate the grayscale magnitude of the image gradient using the Sobel operator. and angle; S4.2: Based on the obtained The local maxima of the image are obtained by filtering, and edge points are determined and connected by double thresholding to achieve image edge detection.

3. The valve spring parallelism measurement method based on machine vision according to claim 1, characterized in that: The S6 step includes the following steps: S6.1: Calculation The average y-coordinate values ​​of n pixels ; S6.2: Again The residual error is calculated from n data points. ; S6.3: Calculated Root mean square deviation of n data points ; S6.4: Calculation The y-coordinate value and average value of each pixel. The difference Discard values ​​with a difference greater than 1 The pixel coordinates; Where: n is The number of all elements in the array, i = 0, 1, 2, j = 1, 2, ..., n; yes Pixel y-axis coordinate; It is the root mean square deviation; yes Average y-axis coordinate of each pixel; It is the residual error.