Figures
Abstract
Online measurement of disk part dimensions by the standard industrial camera features low cost, high efficiency and good universality, but the impact of projection distortion and end face chamfer on measurement is needed to overcome. Present work presents a measurement method to resolve above issues based on machine vision. To improve the measurement accuracy, lower end face of a disk part is determined as calibration plane and the upper end face is measurement plane. To reduce the impact of projection distortion and chamfer on measurement, the measurement points are reconstructed on the measurement plane by re-projection. Then, the inner and outer diameters of disk parts are measured by circle geometric fitting, and the thickness is calculated by the measurement plane position. The experimental results show that the method can online measure disk part dimensions just by a single image, and accuracy meets the requirements of universal grade disk parts.
Citation: Miao J, Tan Q, Sun B, Zhao J, Liu S, Zhang Y (2024) Online measurement method for dimensions of disk parts based on machine vision. PLoS ONE 19(7): e0307525. https://doi.org/10.1371/journal.pone.0307525
Editor: Omnia Hamdy, National Institute of Laser Enhanced Sciences (NILES), Cairo University, EGYPT
Received: October 3, 2023; Accepted: July 7, 2024; Published: July 25, 2024
Copyright: © 2024 Miao et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: All relevant data are within the paper and its Supporting Information files.
Funding: This study was supported by “Changchun Guanghua University Research Fund Cultivation Project (QNZX2024001)”. The fund supported the author Jianwei Miao. Author Jianwei Miao plays a large role in research design, data collection and analysis, original draft writing and experimental verification.
Competing interests: The authors have declared that no competing interests exist.
1 Introduction
Disk parts are important mechanical components that are widely used in industry [1]. Online measurement technology based on machine vision is of great significance for development of intelligent and digital manufacturing technology [2,3], and has been widely studied in recent years [4,5].
Wen et al. [6] provided a method for detecting bearing roller defects based on machine vision. Shen et al. [7] developed an automatic detection system for flange surface defects based on machine vision, which can achieve surface defect test with a minimum width of 0.1 mm by parallel light projection. A telecentric lens was used to detect industrial gear parameters, and the Vision2D measurement system was developed to improve detection accuracy, reduce downtime, and optimize the detection process in [8]. A surface defects inspection system based on machine vision for clutch friction disks was developed to measure its shape and surface size in [9]. Wang et al. [10] proposed a visual measurement method for gear parameters, which can measure the root and top circle diameters of gears.
The above papers have conducted in-depth research on visual measurement of disk parts, but most of them focus on surface inspection. At present, no research has been found on simultaneous online visual measurement of inner diameter, outer diameter, and thickness of disk parts. Furthermore, some studies [11–13] use telecentric lenses to improve measurement accuracy, but telecentric lenses with high cost, small field of view, low measurement efficiency, and low universality, which make it difficult to satisfy the requirements of in-situ applications.
This work uses a standard industrial camera to realize high-precision online measurement of inner, outer diameters and thicknesses of disk parts just by a single image. In order to facilitate online measurement, take upper end face of the disk part (abbreviate as upper end face) as the measurement plane, and take points on the edge of the disk part as the measurement points for inner, outer diameters and thickness (abbreviate as measurement points). To eliminate the influence of the projection distortion on the measurement, reconstruct three-dimensional coordinates of the measurement points so that inner, outer diameters and thickness of the parts can be calculated on the measurement plane. Then, correct three-dimensional coordinates of the measurement points at chamfer. Finally, compare the measurement results obtained from the experiment with those obtained by a micrometer to verify accuracy of the measurement method. This work has five sections. Section 2 is camera calibration and coordinates transformation. Section 3 measures dimensions of disk parts. Section 4 experimentally tests the measurement method and section 5 provides conclusions of the study.
2 Camera calibration and coordinates transformation
2.1 Camera calibration and image processing
Camera intrinsic parameters are calibrated by checkerboard calibration board [14]. The part is placed on a workbench for visual measurement, so the workbench plane (that is lower end face of the part) is determined as calibration plane of camera extrinsic parameters, as shown in Fig 1. Equation of the part lower end face is calculated by calibrated equation of the checkerboard plane and known thickness of the calibration board. To see Appendix A in S1 Appendix for details of calibration results of camera intrinsic and extrinsic parameters.
The noise on machine vision images is usually Gaussian noise caused by accidental factors [15], so Gaussian filtering algorithm is used to filter and denoise the image. Balancing the speed of image processing and the enhancement effect of image, the Retinex algorithm based on center wrapping is adopted for image enhancement processing [16]. To improve the efficiency of feature points extraction, a grayscale template matching algorithm is used to determine the ROI (region of interest) on the image [17]. Sub pixel positions of the edge points on image are extracted by the method based on Zernike moment [18], and the singularities from feature points are removed by the Laida Criterion.
When disk parts are placed on the workbench for visual measurement, edges of the part upper end face on the image are more apt to detect, so the part upper end face is set as measurement plane.The difference in thickness of disk parts makes the difference in position of upper end face, so after calibrating the part lower end face (which coincides with the workbench plane) as the camera extrinsic parameters, the position of upper end face (that is measurement plane) is determined by perspective projection transformation and the known part chamfer size.
2.2 Coordinate transformation
As shown in Fig 2, origin of the world coordinate system is set at that of the camera coordinate system, that is, it coincides with the optical center of camera. The Z-axis of world coordinate system points vertically towards the workbench plane. Set a axis V, which passes through the origin and follows the cross product direction of z-axis of the camera coordinate system and Z-axis of the world coordinate system. Rotate the z-axis around V to the position coincided with the Z-axis, and then directions of the x-axis and y-axis of camera coordinate system after rotation are defined as directions of the X-axis and Y-axis of world coordinate system.
In camera coordinate system, equation of the part lower end face obtained by calibration is
(1)
The normal vector of lower end face is (A0,B0,C0), then directional cosine of the Z-axis of world coordinate system Zk is
(2)
Directional cosine of the z-axis of camera coordinate system is zk = (0,0,1)T, and the directional vector vd of axis V is the cross product of Zk and zk.
Unitizing vd to obtain the directional cosine vk of axis V.
The cross product matrix K of vk is
(5)
Directional cosine of the z-axis of camera coordinate system is zk =(0, 0, 1)T, and that of the Z-axis of world coordinate system is Zk = (i13, i23, i33)T. Their included angle βR is
(6)
According to the Rodrigues rotation transformation [19], combined with Eqs (5) and (6), the rotation matrix R of z-axis and Z-axis can be obtained.
(7)
Where Ione is identity matrix.
When the z-axis of camera coordinate system is rotated to the position coincided with the Z-axis of world coordinate system, positions of the x-axis and y-axis of camera coordinate system after rotation are those of the X-axis and Y-axis of world coordinate system. According to directional cosines xk = (1, 0, 0)T and yk = (0, 1, 0)T of the x-axis and y-axis of camera coordinate system, those of the X-axis and Y-axis of world coordinate system in camera coordinate system can be obtained by Eq (7).
Set camera coordinates of the point to (x,y,z), and its world coordinates to (X,Y,Z). Then the transformation relationship between two coordinate systems can be expressed as
(10)
The transformation matrix I can be determined based on the lower end face equation, as shown in Eq (1), obtained by extrinsic parameter calibration. Calculate camera coordinates of the intersection point P0 between the z-axis of camera coordinate system and the lower end face equation, and then convert them into world coordinates by Eq (10), the Z world coordinate Z0 of the point on lower end face can be obtained. To see Appendix B in S1 Appendix for details.
3 Visual measurement of disk parts dimensions
3.1 Reduce the impact of projection distortion on measurement accuracy
Projection distortion is mainly caused by the measured part surface not being parallel to the image plane. Therefore, the coordinates of detected points on the image are converted to the measurement plane (parallel to the measured part surface) for three-dimensional reconstruction, and then the part dimensions is calculated, which can effectively reduce the influence of projection distortion on measurement accuracy. To determine the position of measurement plane (upper end face), a projection plane is established, which coincides with the Z = 1 plane in world coordinate system and is parallel to measurement plane.
3.1.1 Calculate diameters of circles on both sides of the part chamfer by geometrically fitting circles on the projection plane.
In camera coordinate system, let the detection coordinates of measurement points on theoretical image plane be (xLi,yLi,1). According to Eq (10), they can be transformed into world coordinates (XLi,YLi,ZLi). Then the world coordinates (XTi,YTi,ZTi) of measurement points on projection plane can be obtained by perspective projection transformation, as shown in Eq (11).
In world coordinate system, edges on both sides of the part chamfer on projection plane are circles. According to Eq (11) and the least squares method [20,21], the geometric fitting function of the circle is established.
(12)
Where (X,Y,1) are world coordinates of the point on the circle to be fitted that corresponds perpendicular to the measurement point (XTi,YTi,1).
In world coordinate system, the circle equation to be fitted can be expressed as
(13)
Where (Xc,Yc,1) are world coordinates of the circle center, and rt is the circle radius
Expand the circle equation in Eq (13) into a general form, we can get
(14)
According to the geometric relationship [22,23] between (XTi,YTi,1) and (X,Y,1), Eq (15) are established.
The Jacobian matrix Jc of points coordinates (X,Y) on the circle over coefficients (Xc,Yc,rt) of the circle equation general form can be obtained by Eq (15).
(16)
(17)
(18)
When fitting, the center coordinates and radius obtained from the circle algebraic fitting are used as the initial values for geometric fitting. Then, according to Eq (18), the Gauss Newton iteration method [24] is used to geometrically fit Eq (12), and the radii r1 and r2 of circles on both sides of the part chamfer on projection plane are obtained.
3.1.2 Determine the position of measurement plane based on projection plane.
As shown in Fig 3, Oc is the camera optical center, and line segment Ock1 is on the Z-axis of world coordinate system. Points s2 and s3 are centers of the circles on both sides of the part chamfer fitted on projection plane, and the real centers corresponding to them are k2 and t3. Line segments s3s4 and s2s5 are the radii r1 and r2 of the circles fitted on projection plane, which are the perspective projections of line segments t3t4 on upper end face and k2k5 on plane Π respectively. Line segment t3t4 is radius R1 of the edge circle on upper end face, while line segment k2k5 is the true radius R2, which on plane II paralleled to upper end face. Since the projection plane is parallel to the upper end face, then ,
, we can get
(19)
Similarly, ,
, and the length of line segment t1k1 is the known axial chamfer size q1 of the part, so
(20)
According to the lengths of line segment t3t4 and k2k5, it can be obtained
(21)
Where q2 is the known radial chamfer size of the part, usually q2 = q1.
The Z world coordinate Zu of the point on measurement plane can be determined by substituting Eqs (19) and (20) into Eq (21).
(22)
Where Zu is a scalar, and its symbol is determined by the actual position of measurement plane relative to the Z-axis of world coordinate system.
3.2 Reduce the impact of chamfer on measurement accuracy
Due to the part chamfer, the measurement points on measurement plane (upper end face of the part), as shown in Eq (23), are not the accurate measurement points for minimum inner diameter or maximum outer diameter of the part. The accurate measurement points should be on the edge of plane Π in Fig 3. Plane Π is parallel to the measurement plane, and the distance between two planes is known axial chamfer size q1 of the part, so the Z world coordinate of the point on plane Π is ZΠ = Zu+q1.
According to Eq (11), the world coordinates of measurement points on plane Π are reconstructed by the ray tracing method, as shown in Eq (24).
3.3 Visual measurement of inner, outer diameters and thickness of disk parts
The circle geometric fitting model on plane Π can be established according to Eqs (12)–(18) and (18), and then the inner and outer diameters dn and dw of disk parts are obtained by geometrically fitting the circle on plane II.
In section 2.2, The Z world coordinate Z0 of the point on lower end face can be obtained by camera extrinsic parameters. So thickness LH of the disk part is calculated by Z0 and Eq (22).
4 Experiment and analysis
To verify accuracy of the online measurement method for the sizes of disk parts, a pulley, a flange, and a gear are selected for testing. The flowchart for executing the experiment steps is shown in Fig 4. The reference dimensions of three disk parts are obtained by a micrometer with an accuracy of ±0.001mm, the values are average of measuring 3 times, as shown in Table 1.
Table 2 shows main equipments and their parameters of the measurement system.
According to the method in this article, the Matlab software is used to complete online measurement for dimensions of disk parts based on machine vision. In the world coordinate system, the inner and outer diameters of disk parts are measured by geometrically fitting the part edge circle. Center and radius of the circle can be calculated by algebraic fitting used Matlab firstly, and the results are used as the initial values for geometric fitting. Then, the Gaussian Newton algorithm [24] is used to iteratively calculate the center and radius according to Eqs (12) and (18) to complete the circle geometric fitting. The duration for executing the main experimental program is approximately 5 seconds. An example of the fitting results is shown in Fig 5.
The measurement results of inner, outer diameters and thickness of disk parts are shown in Table 3. In Table 3, "measurement values" are the average values of 10 times measurement results by the method in this work, "reference values" are the part dimensions in Table 1, "errors" are deviations between measurement values and reference values, "absolute errors" are absolute values of errors, "standard deviations" are the standard deviations of 10 times measurement results.
Commonly used visual measurement for dimensions of disk parts currently is realized by the measuring projector, with a telecentric lens, which has high accuracy but a small field of view and is difficult to measure the thickness of the disk part. The "comparison values" in Table 3 are the measurement results by measuring projector JVP400 (≤3+L/200(μm)), and "comparison errors" are deviations between comparison values and reference values.
Measurement values by the method have good agreement with the reference values and comparison values, as shown in Table 3. Compared to the measuring projector with telecentric lenses, standard industrial camera features low cost and good universality, and the thickness of disk parts is difficult to be measured by the measuring projector. From the table, measurement accuracy of the method can meet the requirements for level IT7 tolerance of hole and shaft dimensions in GB/T 1800.1–2020 (eqv ISO 286–1: 2010). The measurement range of the dimensions of disk parts completed by the method is as follows: the inner diameters are in 13mm-34mm, the outer diameters are in 62mm-114mm and the thicknesses are in 14mm-28mm. The influence of projection distortion and chamfer on the measurement is effectively reduced, concluding that the method is correct and accurate. Then the detected errors of pixel coordinates of the measurement points are critical factors affecting the accuracy. The errors are mainly caused by image quality and detection methods. Improving the detection accuracy of measurement points is the main research direction in the future.
5 Conclusion
This work proposes an online measurement method for dimensions of disk parts based on machine vision just by a single image. In the method, the technical way of reducing the influence of projection distortion and chamfer is effective. The method is suitable for multiple types of disk parts, meeting the requirements for inner, outer diameters and thicknesses of universal grade disk parts. The detected accuracy of measurement points on the image is the main factor affecting the measurement accuracy.
Supporting information
S1 File. The minimum data set used in the study.
https://doi.org/10.1371/journal.pone.0307525.s001
(DOC)
References
- 1. Shen H., Li S. X., Gu D. Y., and Chang H. X., “Bearing defect inspection based on machine vision,” Measurement, 45(4): 719–733 (2012).
- 2. Liu S.Y., Tan Q. C., and Zhang Y.C., “Shaft Diameter Measurement Using Structured Light Vision,” Sensors 15(8): 19750–19767 (2015). pmid:26274963
- 3. Pei Y. C., Xie H. L. and Tan Q. C., “A non-contact high precision measuring method for the radial runout of cylindrical gear tooth profile,” Mech. Syst. Signal Process., vol. 138, 106543, APR. 2020.
- 4. Miao J. W., Tan Q. C., Liu S. Y., Bao H. J. and Li X. B., “Vision measuring method for the involute profile of a gear shaft,” Appl. Opt., 59(13): 4183–4190 (2020). pmid:32400699
- 5. Lian F. H., Tan Q. C. and Liu S. Y., “Block thickness measurement of using the structured light vision,” Int. J. Pattern Recognit. Artif. Intell., 33(4): 1992001 (2019).
- 6. Wen S. P., Chen Z. H., and Li C. X., “Vision-Based Surface Inspection System for Bearing Rollers Using Convolutional Neural Networks,” Appl. Sci., 8(12), 2565 (2018).
- 7. Shen X, Gong L, Li X, et al. “Automatic system design for flange surface quality inspection with a bionic motion-vision paradigm,” Journal of the Chinese Institute of Engineers, 43(8): 819–830 (2020).
- 8. Moru D.K., Borro D., “A machine vision algorithm for quality control inspection of gears,” Int. J. Adv. Manuf. Technol., 106: 105–123 (2020).
- 9. Kaushik Sujata, Jain Anjali, Chaudhary Tina and Chauhan N.R., Machine vision based automated inspection approach for clutch friction disc (CFD),” Materials Today: Proceedings, 62(1): 151–157 (2022).
- 10. Wang W, Guan F, Ma S and Li J., “Measurement System of Gear Parameters Based on Machine Vision,” Measurement and Control, 48(8):242–248 (2015).
- 11. Zhang S., Li B., Ren F. and Dong R., “High-Precision Measurement of Binocular Telecentric Vision System With Novel Calibration and Matching Methods,” IEEE Access, 7: 54682–54692 (2019).
- 12. Pan B. Yu L. and Wu D., “High-Accuracy 2D Digital Image Correlation Measurements with Bilateral Telecentric Lenses: Error Analysis and Experimental Verification,” Exp Mech 53: 1719–1733 (2013).
- 13. He Na, Wang Jianhua and Shang Zhiyi, “Gear Profile Measurement Based on Thin Line Structured Light,” J. Phys.: Conf. Ser., 2501: 012016 (2023).
- 14. Zhang Z.Y., “A flexible new technique for camera calibration,” IEEE Trans Pattern Anal Mach Intell, 22(11):1330–1334 (2000).
- 15. Kotecha J. H. and Djuric P. M., “Gaussian sum particle filtering,” IEEE Transactions on Signal Processing, 51(10): 2602–2612(2003)
- 16. Liu Mingzhu, Chen Junyu and Han Xiaofei, “Research on Retinex Algorithm Combining with Attention Mechanism for Image Enhancement,” Electronics, 11(22): 3695(2022).
- 17. Yongbum Lee, Hara T., Fujita H., Itoh S. and Ishigaki T., “Automated detection of pulmonary nodules in helical CT images based on an improved template-matching technique,” IEEE Transactions on Medical Imaging, 20(7): 595–604(2001). pmid:11465466
- 18. Cheng Huang, Wei Jin, Qian Xu, Ziqi Liu, and Zhiliang Xu, “Sub-pixel Edge Detection Algorithm Based On Canny-Zernike Moment Method,” Journal of Circuits, Systems and Computers, 29(15): 2050238(2020).
- 19. Gay Neto A., “Simulation of mechanisms modeled by geometrically-exact beams using Rodrigues rotation parameters,” Comput Mech, 59, 459–481(2017).
- 20. Ahn S. J. and Rauh W., “Geometric least squares fitting of circle and ellipse,” Int. J. Pattern Recognit. Artif. Intell., 13(7): 987–996(1999).
- 21. Markovsky I., Kukush A. and VanHuffel S., “Consistent least squares fitting of ellipsoids,” Numer. Math., 98(1): 177–194(2004).
- 22. Wang J. and Yu Z. Y., “Quadratic curve and surface fitting via squared distance minimization,” Comput. Graph., 35(6): 1035–1050(2011).
- 23. Ahn S. J., “Geometric fitting of parametric curves and surfaces,” Journal of Information Processing Systems, 4(4): 153–158(2008)
- 24. Ahn S J, Rauh W and Warnecke Hans-Jürgen, “Least-squares orthogonal distances fitting of circle, sphere, ellipse, hyperbola, and parabola,” Pattern Recognition, 34(12): 2283–2303(2001).