Journal of Textile Research ›› 2024, Vol. 45 ›› Issue (03): 36-43.doi: 10.13475/j.fzxb.20221006501

• Fiber Materials • Previous Articles     Next Articles

Cotton color detection method based on machine vision

BAI Enlong1, ZHANG Zhouqiang1,2(), GUO Zhongchao1, ZAN Jie1   

  1. 1. School of Mechanical and Electrical Engineering, Xi'an Polytechnic University, Xi'an, Shaanxi 710600, China
    2. Shaanxi Provincial Key Laboratory of Functional Garment Fabrics, Xi'an Polytechnic University, Xi'an, Shaanxi 710600, China
  • Received:2022-12-31 Revised:2023-05-23 Online:2024-03-15 Published:2024-04-15
  • Contact: ZHANG Zhouqiang E-mail:zhangzhouqiang208@126.com

Abstract:

Objective At present, most of the domestic cotton testing instruments are adopted to detect cotton grades, but the specifications of instruments and equipment are expensive and cannot be used in a wider range. At present, fewer methods of using machine vision are adopted to detect the color grade of cotton, and the accuracy is not high. Therefore, in view of the above situation, a cotton color grade detection method based on machine vision was designed.

Method An experimental platform was firstly built. The light source was fixed to the aluminum profile frame and sealed. Cotton was collected in real time through a camera connected to a computer. The collected cotton sample image was transmitted to a computer and preprocessed, and the preprocessed image was cropped using Halcon software and divided into subregions. The albedo (Rd) and yellowness (+b) values of each subregion were calculated by the conversion of color space values, and the color value of each subregion was clustered by the K-means algorithm to obtain the color average of the overall image of cotton. Finally, it was compared with the national standard cotton color grade map to determine the final grade of cotton. Four different color grades of cotton were selected for impurity removal and non-impurity treatment, and the color parameters obtained after impurity removal and without impurity removal were calculated by Halcon software. For the same impurity removed cotton, the Rd value and +b value was calculated, and compared with the detection of MCG-1 detection instrument, the detection results were counted, and scatter plotted by using Origin software to observe the linear relationship between the two detection methods. In order to explore the stability of the test results under different durations, cotton was continuously tested in the time periods of 0 h, 12 h, 24 h, and 36 h in the same environment under the condition that the equipment was not turned off and the lights were not turned off. Finally, in order to explore whether the overall color value of cotton can represent the color grade of the entire cotton sample, two different color grades of white cotton and light yellow dyed cotton were selected for testing, and under the same conditions, the color value of each sub-region of the two cotton was calculated by using software, and the value of each sub-region was placed in the national standard cotton color grade chart for comparison to observe the distribution of the color grade of each sub-region.

Results It is found that the Rd value and +b value detected in the cotton after impurity removal were higher than those detected before impurity removal, but the Rd value increased more and the +b value increased less. For the same cotton, the color value of cotton detected by image processing method was compared with the color value obtained by MCG-1 cotton detector, and the two results were highly correlated and linear, indicating that the results detected by the two methods were consistent. Cotton was continuously tested at different lengths of 0-72 h, and it was found that the test results were stable at each duration, and all were in the same area. Compared with the MCG-1 test results, they were all the same grade cotton. The results of the K-means algorithm were compared with the mean detection, and the results of the K-means algorithm were closer to the results obtained by the MCG-1 cotton detection instrument, and the detection accuracy was better than the results obtained by the mean detection.

Conclusion Using machine vision methods to inspect cotton color grades improves the simplicity, efficiency, and accuracy of inspection. This technology not only solves the problem of expensive cotton testing instruments, but also solves the problem of fewer methods and insufficient accuracy of using image processing to detect cotton grades, and can replace the instrument used in practical cases. With the continuous development and maturity of machine vision technology, the technology could be made more useful in the field of cotton testing in the future, and in machine vision methods for cotton color detection. It is expected that this method can be used as a basis for image processing to detect cotton grades, and can be further improved and optimized.

Key words: cotton, color detection, machine vision, threshold segmentation, zoning, K-means algorithm, color grade

CLC Number: 

  • TS111.9

Fig.1

Color calibration of camera"

Fig.2

Cotton samples collected at two observation positions. (a) 0/45 irradiation conditions; (b) 45/0 irradiation conditions"

Fig.3

Experimental setup"

Fig.4

Preprocessing of cotton images. (a) Original sample image; (b) Grayscale image; (c) Threshold segmentation image; (d) Image after processing"

Fig.5

Zone segmentation"

Fig.6

Programming flowchart of K-means algorithm"

Fig.7

National standard cotton color grade map"

Fig.8

Influence of impurity on Rd value (a) and +b values (b)"

Fig.9

Comparison of Rd (a) and +b (b) values detected by image processing and MCG-1 instrument"

Tab.1

Test results under different time"

序号 0 h 12 h 24 h 36 h
Rd +b Rd +b Rd +b Rd +b
1 78.9 9.1 77.6 9.3 81.2 9.6 81.5 9.0
2 80.3 9.2 79.7 9.2 79.3 8.5 78.9 8.6
3 73.2 9.5 71.1 9.7 70.6 9.5 72.8 8.9
4 67.8 8.1 66.4 8.3 67.5 7.6 66.2 7.3
5 73.3 10.9 72.8 11.4 70.8 10.9 72.7 11.8
6 63.5 10.7 62.0 9.6 60.8 10.5 63.3 10.5
7 78.6 10.5 82.4 11.1 77.9 10.8 78.2 9.4
8 63.7 7.1 63.5 7.5 64.2 6.9 65.1 6.3
9 56.3 7.4 55.4 7.4 57.5 8.0 58.4 7.7
10 66.9 9.7 67.7 9.8 66.8 10.2 67.5 10.1
11 62.2 12.9 62.8 13.6 63.2 13.0 64.3 13.1
12 58.7 12.9 59.4 12.8 57.9 11.6 58.2 12.9

Tab.2

MCG-1 test results"

棉花序号 Rd +b
1 80.1 9.5
2 78.2 8.6
3 73.0 9.2
4 66.7 7.7
5 72.4 11.1
6 62.8 10.2
7 79.4 10.1
8 65.5 6.6
9 55.6 7.7
10 67.1 10.6
11 64.7 13.5
12 58.4 12.8

Fig.10

Scatter plots of color grades in sub-regions of two different cotton sample images. (a) White cotton image; (b) Light yellow dyed cotton image"

Fig.11

Comparison of results of testing same cotton sample by different detection methods"

[1] YAN Lv, YING Gao. Cotton appearance grade classification based on machine learning[J]. Procedia Computer Science, 2020, 174(5) :729-734.
doi: 10.1016/j.procs.2020.06.149
[2] CUI X, CAI Y, RODGERS J, et al. An investigation into the intra-sample variation in the color of cotton using image analysis[J]. Textile Research Journal, 2014, 84(2): 214-222.
doi: 10.1177/0040517513490055
[3] KHAN N, VIK M, VIKOVA M. Color measurement of cotton samples with feasibility of traceable color standards[C]// Svetlenka Workshop for Ph.D. Students Faculty of Textile Engineering. Liberec: Technical University of Liberec, 2015:1-20.
[4] 衡冲, 沈华, 陈丽君, 等. 扫描仪在棉纤维颜色检测的适用性[J]. 东华大学学报(自然科学版), 2020, 46(1):29-34.
HENG Chong, SHEN Hua, CHEN Lijun, et al. Applicability of scanner in cotton fiber color detection[J]. Journal of Donghua University(Natural Science), 2020, 46(1):29-34.
[5] HENG Chong, CHEN Lijun, SHEN Hua, et al. Study on the measurement and evaluation of cotton color using image analysis[J]. Materials Research Express, 2020, 7(7):8-9.
[6] RODGERS J E, FORTIER C A, CUI X, et al. Preliminary assessments of portable color spectrophotometer measurements of cotton color[C]// Proceedings of Beltwide Cotton Conferences. Atlanta: The National Cotton Council, 2012: 1313-1318.
[7] 王欣, 李道亮, 杨文注, 等. 基于可见光机器视觉的棉花伪异性纤维识别方法[J]. 农业机械学报, 2015, 46(8):7-14.
WANG Xin, LI Daoliang, YANG Wenzhu, et al. Identification method of pseudo-anisotropic fiber in cotton based on visible machine vision[J]. Transactions of the Chinese Society for Agricultural Machinery, 2015, 46(8):7-14.
[8] YANG Wenzhu, LU Sukui, WANG Sile, et al. Fast recongnition of foreign fibers in cotton lint using machine vision[J]. Mathematical and Computer Modelling, 2010(3):10-12.
[9] 华才健, 苏真伟, 乔丽, 等. 基于线激光的棉花中白色异性纤维检测[J]. 农业工程学报, 2012, 43(2):181-185.
HUA Caijian, SU Zhenwei, QIAO Li, et al. Detection of white anisosexual fibers in cotton based on line laser[J]. Transactions of the Chinese Society of Agricultura Engineering, 2012, 43(2):181-185.
[10] DEMPSTER A P, LAIRD N M, RUBIN D B. Maximum likelihood from incomplete data via the EM algorithm[J]. Journal of the Royal Statistical Society: Series B(Methodological), 1977, 39(1):1-22.
[11] MUSTAFIC A, LI C. Classification of cotton foreign matter using color features extracted from fluorescent images[J]. Textile Research Journal, 2015, 85(12): 1209-1220.
doi: 10.1177/0040517514561923
[12] 陆永良, 袁裕禄, 李云飞. 基于国际颜色模型(CIELAB)的棉花颜色级测试方法研究[J]. 中国纤检, 2016(3):90-93.
LU Yongliang, YUAN Yulu, LI Yunfei. Research on cotton color grade test method based on international color model (CIELAB)[J]. China Fiber Inspection, 2016(3):90-93.
[13] VIK M, KHAN N, VIKOVA M. LED utilization in cotton color measurement[J]. Journal of Natural Fibers, 2017, 14(4):574-585.
[14] ARISTIDIS Likas, NIKOS Vlassis. The global K-means clustering algorithm[J]. Pattern Recognition, 2003(36) : 451-461.
[1] LI Lili, YUAN Liang, TANG Yuxia, YANG Wenju, WANG Hao. Tea pigment dyeing of cotton fabric modified with polydopamine/chitosan and its antibacterial and anti-ultraviolet properties [J]. Journal of Textile Research, 2024, 45(03): 106-113.
[2] TIAN Boyang, WANG Xiangze, YANG Yiwen, WU Jing. Preparation and thermal management properties of asymmetric structured fibrous membranes [J]. Journal of Textile Research, 2024, 45(02): 11-20.
[3] LI Ping, ZHU Ping, LIU Yun. Preparation and properties of flame-retardant polyester-cotton fabrics with chitosan-based intumescent flame retardant system [J]. Journal of Textile Research, 2024, 45(02): 162-170.
[4] GU Jiahua, DAI Xinxin, ZOU Zhuanyong, LIU Shiyi, ZHANG Xiantao, HAN Xu, LU Bin, ZHANG Yinjiang. Preparation and properties of surface-etched/polysiloxane-modified cotton spunlace materials [J]. Journal of Textile Research, 2024, 45(02): 189-197.
[5] GE Sumin, LIN Ruibing, XU Pinghua, WU Siyi, LUO Qianqian. Personalized customization of curved surface pillows based on machine vision [J]. Journal of Textile Research, 2024, 45(02): 214-220.
[6] MA Chengnuo, JIANG Kaixiang, CHEN Chunhui, LIU Yuanling, ZHANG Youqiang. Analysis on mechanical properties and fracture morphology of Xinjiang long-staple cotton fiber [J]. Journal of Textile Research, 2024, 45(02): 36-44.
[7] GU Jinjun, WEI Chunyan, GUO Ziyang, LÜ Lihua, BAI Jin, ZHAO Hanghuiyan. Preparation and performonce of cotton stalk bast microcrystalline cellulose/modified graphene oxide composite flame-retardant fiber [J]. Journal of Textile Research, 2024, 45(01): 39-47.
[8] CHEN Shun, QIAN Kun, LIANG Fuwei, GUO Wenwen. Preparation and properties of flame retardant hydrophobic cotton fabric with eugenol-based composite coating [J]. Journal of Textile Research, 2023, 44(12): 115-122.
[9] CHEN Bei, REN Lipei, XIAO Xingfang. Preparation and pH-detection properties of Tb-metal-organic frameworks modified cotton fabric [J]. Journal of Textile Research, 2023, 44(12): 123-129.
[10] SHI Hongyu, WEI Yingjie, GUAN Shengqi, LI Yi. Cotton foreign fibers detection algorithm based on residual structure [J]. Journal of Textile Research, 2023, 44(12): 35-42.
[11] SHI Weimin, HAN Sijie, TU Jiajia, LU Weijian, DUAN Yutang. Empty yarn bobbin positioning method based on machine vision [J]. Journal of Textile Research, 2023, 44(11): 105-112.
[12] LIU Juntao, SUN Ting, TU Hu, HU Min, ZHANG Ruquan, SUN Lei, LUO Xia, JI Hua. Optimization of plasma cold pad-batch degreasing/bleaching process for cotton spunlace nonwoven by response surface method [J]. Journal of Textile Research, 2023, 44(11): 132-141.
[13] ZHENG Xianhong, TANG Jinhao, LI Changlong, WANG Wei. Preparation and electromagnetic shielding performance of hollow magnetic Fe3O4 nanosphere/MXene composite cotton fabrics [J]. Journal of Textile Research, 2023, 44(11): 142-150.
[14] WANG Luyan, ZHANG Caining, ZHAO Qianqian, MA Zhihao, WANG Xuman. Preparation and properties of superhydrophobic cotton fabrics with ultraviolet/ammonia dual responsiveness [J]. Journal of Textile Research, 2023, 44(11): 160-166.
[15] QIAN Yaowei, YIN Lianbo, LI Jiawei, YANG Xiaoming, LI Yaobang, QI Dongming. Preparation and properties of flame retardant cotton fabrics by layer-by-layer assembly of polyvinylphosphonic acid and polyethylene polyamine [J]. Journal of Textile Research, 2023, 44(09): 144-152.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!