Detection of Impurity Rate of Machine-Picked Cotton Based on Improved Canny Operator
Abstract
:1. Introduction
2. Materials and Methods
2.1. Real-Time Detection System for Machine-Picked Seed Cotton
2.2. Detection of Impurity Rate of Machine-Picked Cotton
2.2.1. Detection Process
2.2.2. Traditional Canny Operator Edge Detection
- Smoothing images
- Calculate the magnitude and direction of the gradient
2.2.3. Dark Impurity Segmentation
- Nonmaximum suppression of gradient amplitude was performed
- Double threshold method to detect and connect edges
- Defect analysis of traditional Canny operator image edge-detection algorithm
2.2.4. Improved Canny Operator Edge Detection
- Mean filtering
- Nonlocal mean denoising
- Improved gradient amplitude calculation
2.2.5. Determination Algorithm of Intersection between Impurities and Image Edge
2.2.6. Impurity Classification and Recognition Based on YOLO V5
- Model training
- Identify the impurities of machine-picked cotton after segmentation
2.2.7. Data-Processing Threads
3. Results
4. Discussion
5. Conclusions
- (1)
- Aiming at the real-time detection of the impurity rate in machine-picked cotton processing, this paper proposed a detection method for the impurity rate in machine-picked cotton based on an improved Canny operator. According to the characteristics of different saturations between cotton and impurities, the impurities were separated by extracting the image S channel.
- (2)
- In view of the problems existing in traditional Canny operator edge detection, mean filtering and nonlocal mean denoising were used to replace Gaussian filtering; this could effectively remove the noise in the image.
- (3)
- A YOLO V5 neural network was used to classify and identify the impurities after segmentation, and the density of various impurities was measured. The V–W model was established to solve the impurity rate based on mass.
- (4)
- Using multithread technology, the processing time was shortened by 43.65% compared with that of a single thread, and the processing frame rate was effectively improved. By finding the average value of the impurity rate, the anti-interference performance of the algorithm was enhanced, and had the characteristics of real-time detection and stability.
Author Contributions
Funding
Conflicts of Interest
References
- Lu, X.; Yang, J. Research on foreign fiber Online Detection Technology based on Vision Sensor. Cotton Text. Technol. 2018, 46, 5–8. [Google Scholar]
- Zhang, Y.; Xu, J.; Wang, Z.; Shi, P. Optimization of cotton fiber detection Technology based on machine vision. Chin. J. Agric. Mech. 2018, 39, 65–69. [Google Scholar] [CrossRef]
- Dong, C.; Du, Y.; Ren, W.; Zhao, D. Research progress of optical imaging technology for detection of heterotropic fibers in cotton. J. Text. 2020, 41, 183–189. [Google Scholar]
- Shi, H.; Guan, S.; Wu, N. Image multi-resolution differential detection method for cotton metafiber. Text. J. 2014, 35, 13–18. (In Chinese) [Google Scholar]
- Cao, Z.; Jing, J.; Su, Z.; Zhang, H. Research on Deep Learning Color Fabric Defect Detection Based on Raspberry PI. Cotton Text. Technol. 2019, 47, 21–25. [Google Scholar]
- Ding, X.; Zhang, Y. Research on color foreign fiber detection method based on image processing. Cotton Text. Technol. 2020, 48, 11–15. [Google Scholar]
- Zhao, X.; Li, D.; Yang, B.; Ma, C.; Zhu, Y.; Chen, H. Feature selection based on improved ant colony optimization for online detection of foreign fiber in cotton. Appl. Soft Comput. 2014, 24, 585–596. [Google Scholar] [CrossRef]
- Zhao, X.; Li, D.; Yu, H. Online Detection of Cotton fiber Based on Fischer Score and Discrete Particle Swarm Optimization. Trans. Chin. Soc. Agric. Eng. 2014, 107–115. [Google Scholar]
- Wang, X.; Yang, W.; Li, Z. A fast image segmentation algorithm for detection of pseudo-foreign fibers in lint cotton. Comput. Electr. Eng. 2015, 46, 500–510. [Google Scholar] [CrossRef]
- He, X.; Su, Z.; Deng, B.; Pan, Y.; Chi, Z. An Artificial intelligence Detection Method for Hetero fiber in Seed cotton. Cotton Text. Technol. 2018, 46, 49–52. [Google Scholar]
- Pavani, S.K.; Dogan, M.S.; Sari-Sarraf, H.; Hequet, E.F. Segmentation and Classification of Four Common Cotton Contaminants in X-Ray microtomographic Images. In Machine Vision Applications in Industrial Inspection XII; Electrical Engineering Department, Texas Tech University: Lubbock, TX, USA, 2004; p. 79409. [Google Scholar]
- Zhang, C.; Li, L.; Dong, Q.; Ge, R. Method for detecting impurities in machine-picked cotton by region color segmentation. J. Text. Sci. Technol. 2017, 38, 135–141. [Google Scholar]
- Zhang, C.; Li, L.; Dong, Q.; Ge, R. Recognition of impurities in machine-picked cotton based on ga-svm model. Trans. Chin. Soc. Agric. Eng. 2016, 32, 189–196. [Google Scholar]
- Wang, X.; Li, D.; Yang, W.; Li, Z. Identification method of cotton pseudo fiber based on visible light machine vision. Trans. Chin. Soc. Agric. Mach. 2015, 46, 7–14. [Google Scholar]
- Wang, H.; Li, H. Classification and recognition of seed cotton impurities based on local Binary mode and gray co-occurrence matrix. Trans. Chin. Soc. Agric. Eng. 2015, 31, 236–241. [Google Scholar]
- Wei, P.; Zhang, L.; Liu, X.; Wang, D.; Su, Z. Dual-light source imaging detection method of foreign fiber in seed cotton. J. Text. Res. 2017, 38, 32–38. (In Chinese) [Google Scholar]
- Alaknanda Anand, R.S.; Kumar, P. Flaw detection in radiographics weld images using morphological approach. Ndt E Int. 2006, 39, 29–33. [Google Scholar] [CrossRef]
- Kiranyaz, S.; Ferreira, M.; Gabbouj, M. Automatic object extraction over multiscale edge field for multimedia retrieval. IEEE Trans. Image Process. 2006, 15, 3759–3772. [Google Scholar] [CrossRef]
- Yu, H.; Wang, Y. An Improved Canny Edge Detection Algorithm. Comput. Eng. Appl. 2004, 40, 27–29. [Google Scholar]
- Wei, H.; Zhao, B.; Tang, L.; He, P. Improvement of Canny algorithm and implementation in hardware. Opt. Tech. 2006, 32, 263–266. (In Chinese) [Google Scholar]
- Demigny, D.; Kamle, T. A Discrete Expression of Canny’s Criteria for Step Edge Detector Performances Evaluation. IEEE Trans. Pattern Anal. Mach. Intell. 1997, 19, 1199–1211. [Google Scholar] [CrossRef]
- Zhang, X.; Yang, D.; Liu, Y. Improved Edge Detection Algorithm Based on Canny Operator. Comput. Eng. Appl. 2003, 39, 113–115. [Google Scholar] [CrossRef]
- Zheng, X.; Ding, T. Improved Adaptive Threshold Canny Edge Detection. Opto-Electron. Eng. 2009, 36, 106–111. [Google Scholar]
- Wang, Z.; Liu, X.; Xue, L. An Improved Method for Edge Detection of Canny Operator. Comput. Eng. Appl. 2010, 46, 202–205. [Google Scholar]
- Jin, Y.; Meng, J. An Improved Edge Detection Algorithm Based on Canny Operator. Chongqing High. Educ. Res. 2011, 30, 27–30. [Google Scholar]
- Zhang, Z.; Xi, J.; Liu, Y. Research on Canny Operator Based on GCV Criterion and Otsu Method. Comput. Sci. 2013, 6, 279–282. [Google Scholar]
- Wang, R.; Gao, L.; Chai, Y.; Tian, L. Edge Detection Method Combining Canny Method and Wavelet Transform. J. Northeast. Univ. 2005, 26, 1131–1133. [Google Scholar]
- Bai, T.; Deng, C.; Geng, Y. Image Edge Detection Method Based on Fusion of Wavelet Transform and Canny Operator. J. Harbin Univ. Sci. Technol. 2010, 15, 44–47. [Google Scholar]
- Ouahabi, A. A review of wavelet denoising in medical imaging. In Proceedings of the 8th International Workshop on Systems, Signal Processing and Their Applications (IEEE/WoSSPA), Algiers, Algeria, 12–15 May 2013; pp. 19–26. [Google Scholar]
- Canny, J. A Computational Approach to Edge Detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, PAMI-8, 679–698. [Google Scholar] [CrossRef]
- Wang, W.; Wang, L.; Yuan, Z. Canny Edge Detection Algorithm Based on Maximum Category Posterior Probability. Comput. Appl. 2009, 29, 962–965. [Google Scholar]
- Jin, W.; Guo, Y.; Ying, Y.; Liu, Y.; Peng, Q. Fast Non-Local Algorithm for Image Denoising. In Proceedings of the IEEE International Conference on Image Processing, Atlanta, GA, USA, 8–11 October 2006. [Google Scholar]
Parameter Name | Parameter Value |
---|---|
batch | 16 |
subdivisions | 8 |
iterations | 5000 |
steps | 4000 times and 4500 times |
img-size | 640 × 640 |
depth_multiple | 0.67 |
width_multiple | 0.75 |
nms | 0.25 |
Type of Impurity | Sample Size | Number of Wrong/Missing Samples | Recognition Accuracy/% |
---|---|---|---|
Bell housing | 186 | 3 | 98.388 |
Cotton branch | 174 | 2 | 98.851 |
Weeds | 221 | 6 | 97.285 |
Blackjack | 946 | 25 | 97.357 |
Material Type | Density (g/cm3) |
---|---|
Bell shell | 0.461 |
Cotton branch | 0.152 |
Weeds | 0.803 |
Leaf crumbs | 0.642 |
Machine-picked seed cotton in a natural fluffy state | 0.481 |
Single-Thread Processing Time (s) | Multithreaded Processing Time (s) |
---|---|
0.501 | 0.285 |
0.531 | 0.293 |
0.522 | 0.301 |
0.512 | 0.299 |
0.522 | 0.297 |
0.523 | 0.281 |
0.531 | 0.296 |
Detection Method | Improved Canny Operator | Traditional Canny Operator | K-Means Clustering | SVM Segmentation | Quality Standard |
---|---|---|---|---|---|
Sample 1 | 6.26377 | 7.63346 | 7.72711 | 4.17013 | 5.37385 |
Sample 2 | 6.76638 | 6.6714 | 6.72257 | 4.56455 | 6.99251 |
Sample 3 | 6.71422 | 7.30694 | 10.0976 | 5.2115 | 6.84337 |
Sample 4 | 6.12833 | 6.35443 | 6.48337 | 5.11429 | 5.12907 |
Sample 5 | 6.71352 | 6.89394 | 7.8915 | 4.38055 | 6.55075 |
Sample 6 | 6.349 | 7.54174 | 6.30183 | 5.94764 | 6.1273 |
Sample 7 | 6.79262 | 6.40658 | 13.16772 | 4.71404 | 6.70949 |
Sample 8 | 6.03854 | 6.66527 | 7.15422 | 6.7967 | 6.01452 |
Sample 9 | 6.33458 | 7.19902 | 7.19294 | 5.49516 | 6.86348 |
Sample 10 | 6.18918 | 6.47001 | 11.00082 | 5.42304 | 6.98239 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhang, C.; Li, T.; Li, J. Detection of Impurity Rate of Machine-Picked Cotton Based on Improved Canny Operator. Electronics 2022, 11, 974. https://doi.org/10.3390/electronics11070974
Zhang C, Li T, Li J. Detection of Impurity Rate of Machine-Picked Cotton Based on Improved Canny Operator. Electronics. 2022; 11(7):974. https://doi.org/10.3390/electronics11070974
Chicago/Turabian StyleZhang, Chengliang, Tianhui Li, and Jianyu Li. 2022. "Detection of Impurity Rate of Machine-Picked Cotton Based on Improved Canny Operator" Electronics 11, no. 7: 974. https://doi.org/10.3390/electronics11070974
APA StyleZhang, C., Li, T., & Li, J. (2022). Detection of Impurity Rate of Machine-Picked Cotton Based on Improved Canny Operator. Electronics, 11(7), 974. https://doi.org/10.3390/electronics11070974