Machine Vision-Based Precision Detection of Circular Holes Using Canny Threshold Optimization and Zernike Moments
Abstract
1. Introduction
- (1)
- Canny dual-threshold weighted optimization for geometric fidelity of circular holes Three dedicated evaluation metrics—circular hole closure, circularity, and contour closure—are established, and six weighted scoring functions (standard processing, hole priority, circularity priority, contour priority, balanced optimization, and adaptive balance) are designed. Through systematic traversal of 24 threshold configurations, the optimal dual thresholds are automatically selected based on the weighted composite score, significantly improving edge continuity while maintaining a circularity of .
- (2)
- Adaptive subpixel edge localization based on multi-order Zernike moment synergy A multi-order collaborative strategy is adopted, led by the order and supplemented by the and orders. Combined with a coarse-to-fine two-stage radius scanning mechanism that minimizes the moment magnitude, five radius estimation methods are integrated, and an adjustment factor is introduced to compensate for systematic bias, thereby significantly enhancing subpixel localization accuracy.
2. Image Preprocessing and Segmentation
2.1. Image Preprocessing
2.2. Threshold Segmentation
2.3. Feature Region Localization
3. Edge Detection and Optimization
3.1. Canny Edge Detection Algorithm
3.2. Threshold Optimization
4. Subpixel Localization and Circular Fitting
4.1. Adaptive Optimization Algorithm for Subpixel Edge Detection Based on Zernike Moments
- (1)
- Conventional Zernike Moment Subpixel Algorithm
- (2)
- Adaptive Optimization Algorithm Based on Zernike Moment Subpixel Edge Detection
4.2. Least Squares Fitting of Circles
5. Experiment and Analysis
5.1. Camera Calibration
5.2. Experimental Platform
5.3. Results and Analysis
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Li, L. China’s Manufacturing Locus in 2025: With a Comparison of “Made-in-china 2025” and “industry 4.0”. Technol. Forecast. Soc. Change 2017, 135, 66–74. [Google Scholar] [CrossRef]
- Gradl, P.R.; Tinker, D.C.; Ivester, J.; Skinner, S.W.; Teasley, T.; Bili, J.L. Geometric Feature Reproducibility for Laser Powder Bed Fusion (L-PBF) Additive Manufacturing with Inconel 718. Addit. Manuf. 2021, 47, 102305. [Google Scholar] [CrossRef]
- Fan, B.; Qin, X.; Wu, Q.; Fu, J.; Hu, Z.; Wang, Z. Instance Segmentation Algorithm for Sorting Dismantling Components of End-of-life Vehicles. Eng. Appl. Artif. Intell. 2024, 133, 108318. [Google Scholar] [CrossRef]
- Rahimi, A.; Anvaripour, M.; Hayat, K. Object Detection Using Deep Learning in a Manufacturing Plant to Improve Manual Inspection. In Proceedings of the International Conference on Prognostics and Health Management; IEEE: New York, NY, USA, 2021. [Google Scholar]
- Saif, Y.; Rus, A.Z.M.; Yusof, Y.; Ahmed, M.L.; Al-Alimi, S.; Didane, D.H.; Adam, A.; Gu, Y.H.; Al-masni, M.A.; Abdulrab, H.Q.A. Advancements in Roundness Measurement Parts for Industrial Automation Using Internet of Things Architecture-Based Computer Vision and Image Processing Techniques. Appl. Sci. 2023, 13, 11419. [Google Scholar] [CrossRef]
- Sun, J.; Li, C.; Wu, X.J.; Palade, V.; Fang, W. An Effective Method of Weld Defect Detection and Classification Based on Machine Vision. IEEE Trans. Ind. Inform. 2019, 15, 6322–6333. [Google Scholar] [CrossRef]
- Galata, D.L.; Meszaros, L.A.; Kallai-Szabo, N.; Szabo, E.; Pataki, H.; Marosi, G.; Nagy, Z.K. Applications of Machine Vision in Pharmaceutical Technology: A Review. Eur. J. Pharm. Sci. 2021, 159, 105717. [Google Scholar] [CrossRef]
- Xi’an, F.; Xiangdong, G.; Guiqian, L.; Nvjie, M.; Yanxi, Z. Research and Prospect of Welding Monitoring Technology Based on Machine Vision. Int. J. Adv. Manuf. Technol. 2021, 115, 3365–3391. [Google Scholar] [CrossRef]
- Zhonghe, R.; Dublin, U.C.; Ning, Y.; You, W. State of the Art in Defect Detection Based on Machine Vision. Int. J. Precis. Eng. Manuf.-Green Technol. 2021, 9, 661–691. [Google Scholar]
- Jiang, Y.; Wang, W.; Zhao, C. A Machine Vision-based Realtime Anomaly Detection Method for Industrial Products Using Deep Learning. In Proceedings of the Chinese Automation Congress; IEEE: New York, NY, USA, 2019; pp. 4842–4847. [Google Scholar]
- Liu, Y.; Cheng, M.M.; Hu, X.; Wang, K.; Bai, X. Richer Convolutional Features for Edge Detection. In Computing Research Repository; IEEE: New York, NY, USA, 2017. [Google Scholar]
- Soria, X.; Riba, E.; Sappa, A. Dense Extreme Inception Network: Towards a Robust CNN Model for Edge Detection. In IEEE Winter Conference on Applications of Computer Vision; IEEE: New York, NY, USA, 2020. [Google Scholar]
- Jing, J.; Liu, S.; Wang, G.; Zhang, W.; Sun, C. Recent Advances on Image Edge Detection: A Comprehensive Review. Neurocomputing 2022, 503, 259–271. [Google Scholar] [CrossRef]
- Rong, W.; Li, Z.; Zhang, W.; Sun, L. An Improved Canny Edge Detection Algorithm. In 2021 2nd International Conference on Computer Science and Management Technology (ICCSMT); IEEE: New York, NY, USA, 2021; pp. 414–417. [Google Scholar]
- Huang, M.; Liu, Y.; Yang, Y. Edge Detection of Ore and Rock on the Surface of Explosion Pile Based on Improved Canny Operator. Alex. Eng. J. 2022, 61, 10769–10777. [Google Scholar] [CrossRef]
- Cao, J.; Chen, L.; Wang, M.; Tian, Y. Implementing a Parallel Image Edge Detection Algorithm Based on the Otsu-Canny Operator on the Hadoop Platform. Comput. Intell. Neurosci. 2018, 2018, 1–12. [Google Scholar] [CrossRef]
- Boudraa, M.; Bennour, A.; Al-Sarem, M.; Ghabban, F.; Bakhsh, O.A. Contribution to Historical Manuscript Dating: A Hybrid Approach Employing Hand-Crafted Features with Vision Transformers. Digit. Signal Process. 2024, 149, 104477. [Google Scholar] [CrossRef]
- Li, Y.; Poma, X.S.; Li, G.; Yang, C.; Xiao, Q.; Bai, Y.; Li, Z. PiDiNeXt: An Efficient Edge Detector Based on Parallel Pixel Difference Networks. In Pattern Recognition and Computer Vision; Lecture Notes in Computer Science; Springer: Singapore, 2024; Volume 14434, pp. 261–272. [Google Scholar]
- Hong, W.; Ji, H.; Wang, C.; Hu, X. Online Detection Technology of Triangular-Blade Tool Grinding Precision Based on Machine Vision. Appl. Opt. 2024, 63, 6419–6431. [Google Scholar] [CrossRef]
- Zhaoyao, S.; Yiming, F.; Xiaoyi, W. Research Progress in Gear Machine Vision Inspection Instrument and Technology. Laser Optoelectron. Prog. 2022, 59, 1415006. [Google Scholar]
- Wenye, Z.; Min, Z.; Xiaojie, L. Research on the Size Measurement of Porous Parts Based on Machine Vision. In Proceedings of the Conference on Industrial Electronics and Applications; IEEE: New York, NY, USA, 2017. [Google Scholar]
- Gong, L.-H.; Tian, C.; Zou, W.-P.; Zhou, N.-R. Robust and Imperceptible Watermarking Scheme Based on Canny Edge Detection and SVD in the Contourlet Domain. Multimed. Tools Appl. 2020, 80, 439–461. [Google Scholar]
- Ni, F.; Zhang, J.; Chen, Z. Zernike-moment Measurement of Thin-crack Width in Images Enabled by Dual-scale Deep Learning. Comput.-Aided Civ. Infrastruct. Eng. 2018, 34, 367–384. [Google Scholar] [CrossRef]
- DONG, J.; Wang, Z. Edge detection based on Zernike moments and Sobel operator. J. Terahertz Sci. Electron. Inf. Technol. 2011, 9, 202–205, 210. [Google Scholar]
- Zhang, Y.; Liu, W.; Lan, Z.; Zhang, Z.; Ye, F.; Zhao, H.; Li, X.; Jia, Z. Global Measurement Method for Large-Scale Components Based on a Multiple Field of View Combination. J. Sens. 2017, 2017, 1–12. [Google Scholar] [CrossRef]
- Renshaw, D.T.; Christian, J.A. Subpixel Localization of Isolated Edges and Streaks in Digital Images. J. Imaging 2020, 6, 33. [Google Scholar] [CrossRef]
- Huang, C.; Jin, W.; Xu, Q.; Liu, Z.; Xu, Z. Sub-Pixel Edge Detection Algorithm Based on Canny-Zernike Moment Method. J. Circuits Syst. Comput. 2020, 29, 2050238. [Google Scholar] [CrossRef]
- Yang, L.; Xu, Y.; Wang, S.; Yuan, C.; Zhang, Z.; Li, B.; Hu, W. PDNet: Toward Better One-Stage Object Detection with Prediction Decoupling. IEEE Trans. Image Process. 2022, 31, 5121–5133. [Google Scholar] [CrossRef] [PubMed]
- Scitovski, R.; Sabo, K. Application of the DIRECT algorithm to searching for an optimal k-partition of the set A⊂Rn and its application to the multiple circle detection problem. J. Glob. Optim. 2019, 74, 63–77. [Google Scholar] [CrossRef]
- Wang, J.; Fu, P.; Gao, R.X. Machine Vision Intelligence for Product Defect Inspection Based on Deep Learning and Hough Transform. J. Manuf. Syst. 2019, 51, 52–60. [Google Scholar] [CrossRef]
- Man, J.; Jun, W.; Bojun, D.; Haifeng, W.; Haisong, C. Measurement Method of Gun’s Jump Angle Based on Improved Least-Squares. Laser Optoelectron. Prog. 2020, 57, 030701. [Google Scholar]
- Wu, Z.; Chen, F.; Liang, G.; Zhou, Y.; Wu, X.; Feng, W. Accurate Localization of Defective Circular PCB Mark Based on Sub-Pixel Edge Detection and Least Square Fitting. In 2019 IEEE 8th Data Driven Control and Learning Systems Conference (DDCLS); IEEE: New York, NY, USA, 2019; pp. 465–470. [Google Scholar]
- Liu, W.; Yang, X.; Sun, H.; Yang, X.; Yu, X.; Gao, H. A Novel Subpixel Circle Detection Method Based on the Blurred Edge Model. IEEE Trans. Instrum. Meas. 2021, 71, 5002611. [Google Scholar] [CrossRef]
- Rouhi, Z.; Mansouri, N. A Comprehensive Survey of Multi-Level Thresholding Segmentation Methods for Image Processing. Arch. Comput. Methods Eng. 2024, 31, 3647–3697. [Google Scholar] [CrossRef]
- Kong, X.; Yi, J.; Wang, X.; Luo, K.; Hu, J. Full-Field Mode Shape Identification Based on Subpixel Edge Detection and Tracking. Appl. Sci. 2023, 13, 474. [Google Scholar] [CrossRef]
- Guo, L.; Wu, S. FPGA Implementation of a Real-Time Edge Detection System Based on an Improved Canny Algorithm. Appl. Sci. 2023, 13, 870. [Google Scholar] [CrossRef]
- Kar, A.; Pramanik, S.; Chakraborty, A.; Bhattacharjee, D.; Ho, E.S.L.; Shum, H.P.H. LMZMPM: Local Modified Zernike Moment Per-Unit Mass for Robust Human Face Recognition. IEEE Trans. Inf. Forensics Secur. 2021, 16, 495–509. [Google Scholar] [CrossRef]
- Tang, Q.; Huang, X.; Miao, Y.; Huang, J. A Robust Algorithm for Rapid Pre-Alignment of Multiple Types and Sizes of Wafers. Signal Image Video Process. 2024, 18, 2559–2569. [Google Scholar] [CrossRef]

















| Filtering Method | PSNR (dB) | SSIM |
|---|---|---|
| Mean Filter | 34.4841 | 0.844 |
| Gaussian Filter | 35.799 | 0.88 |
| Adaptive Median Filter | 40.7249 | 0.958 |
| Segmentation Method | Number of Target Pixels | Number of Connected Regions | Average Compactness |
|---|---|---|---|
| Iterative Thresholding | 4,637,334 | 3 | 0.7612 |
| Optimal Adaptive Thresholding | 3,952,252 | 2417 | 0.6676 |
| Otsu Thresholding | 4,637,334 | 3 | 0.7612 |
| Position | Measured Diameter (mm) | DXF Diameter (mm) | Absolute Error (mm) | Relative Error (%) |
|---|---|---|---|---|
| Region: 2 | 6.9550 | 7 | 0.0450 | 0.6429 |
| Region: 4 | 7.0490 | 7 | 0.0490 | 0.7000 |
| Measurement No. | Measured Diameter (mm) | Absolute Error (mm) | Relative Error (%) |
|---|---|---|---|
| 1 | 6.9753 | 0.0247 | 0.3529 |
| 2 | 6.9840 | 0.0160 | 0.2286 |
| 3 | 6.9550 | 0.0450 | 0.6429 |
| 4 | 7.0380 | 0.0380 | 0.5429 |
| 5 | 6.9541 | 0.0459 | 0.6557 |
| 6 | 7.0145 | 0.0145 | 0.2071 |
| 7 | 6.9740 | 0.0260 | 0.3714 |
| 8 | 7.0213 | 0.0213 | 0.3043 |
| Nominal Diameter (mm) | Production Batch | Number of Holes (n) | Mean Measured Diameter (mm) | Mean Absolute Error (mm) | Standard Deviation (mm) |
|---|---|---|---|---|---|
| Batch A | 20 | 6.9678 | 0.0322 | 0.0112 | |
| Batch B | 20 | 6.9709 | 0.0291 | 0.0103 | |
| Batch C | 20 | 6.9650 | 0.0350 | 0.0119 | |
| (all batches) | 60 | 6.9679 | 0.0321 | 0.0113 | |
| Batch A | 20 | 9.9617 | 0.0383 | 0.0131 | |
| Batch B | 20 | 9.9586 | 0.0414 | 0.0140 | |
| Batch C | 20 | 9.9642 | 0.0358 | 0.0125 | |
| (all batches) | 60 | 9.9615 | 0.0385 | 0.0132 | |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Du, J.; Yu, J.; Jiang, X.; Li, X.; Liu, X. Machine Vision-Based Precision Detection of Circular Holes Using Canny Threshold Optimization and Zernike Moments. Sensors 2026, 26, 3699. https://doi.org/10.3390/s26123699
Du J, Yu J, Jiang X, Li X, Liu X. Machine Vision-Based Precision Detection of Circular Holes Using Canny Threshold Optimization and Zernike Moments. Sensors. 2026; 26(12):3699. https://doi.org/10.3390/s26123699
Chicago/Turabian StyleDu, Juan, Jizheng Yu, Xintian Jiang, Xiaorui Li, and Xiaodong Liu. 2026. "Machine Vision-Based Precision Detection of Circular Holes Using Canny Threshold Optimization and Zernike Moments" Sensors 26, no. 12: 3699. https://doi.org/10.3390/s26123699
APA StyleDu, J., Yu, J., Jiang, X., Li, X., & Liu, X. (2026). Machine Vision-Based Precision Detection of Circular Holes Using Canny Threshold Optimization and Zernike Moments. Sensors, 26(12), 3699. https://doi.org/10.3390/s26123699

