首页|基于机器视觉的棉花颜色检测方法

基于机器视觉的棉花颜色检测方法

扫码查看
针对国内目前通过图像处理测量棉花颜色等级方法较少的现状,设计了一种基于机器视觉的棉花颜色检测方案.为提高棉花样本的拍摄质量及高效性,使用Halcon软件连接CMOS工业相机进行实时采集.首先对采集的棉花样本图进行预处理,通过阈值分割算法将棉花样本图转化为二值图像,且使用高斯滤波去噪声从而去除棉花中的杂质信息,并对预处理后的图像进行区域划分.然后通过RGB值转换为CIE XYZ颜色空间值,得到各子区域棉花颜色参数值,并引入K均值算法聚类各子区域颜色值以确定棉花最终颜色参数值,从而确定棉花颜色等级.最后通过实验验证及数据分析,将本文检测方法与MCG-1 棉花检测仪器检测结果进行对比,结果表明 2 种方法检测结果一致;并通过在不同时间下持续对棉花样本进行数据检测,验证了本文方法的稳定性和精确性.本文检测方法可行且检测成本较低,可代替昂贵的仪器检测方法供企业使用.
Cotton color detection method based on machine vision
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.

cottoncolor detectionmachine visionthreshold segmentationzoningK-means algorithmcolor grade

白恩龙、张周强、郭忠超、昝杰

展开 >

西安工程大学 机电工程学院,陕西 西安 710600

西安工程大学 陕西省功能性服装面料重点实验室,陕西 西安 710600

棉花 颜色检测 机器视觉 阈值分割 区域划分 K均值算法 颜色等级

国家自然科学基金青年科学基金陕西省教育厅重点科学研究项目西安工程大学柯桥纺织产业创新研究院项目陕西省自然科学基础研究计划

6170138420JS05119KQYB032023-JC-YB-288

2024

纺织学报
中国纺织工程学会

纺织学报

CSTPCD北大核心
影响因子:0.699
ISSN:0253-9721
年,卷(期):2024.45(3)
  • 14