Image segmentation of green vegetable impurities based on SSA-Kmeans clustering algorithm
In order to solve the problem of online detection of impurities in green vegetable packaging production line during processing,a green vegetable impurity image segmentation algorithm based on SSA-Kmeans is proposed.Firstly,the color image is enhanced by histogram equalization to reduce the effect of illumination.Secondly,the initial clustering center is optimized based on the sparrow search algorithm,and the ab two-dimensional data containing color information is selected for Kmeans clustering according to the best clustering center obtained.After that,the clustered image is binarized and corrected by morphological filtering method to finally complete the image segmentation.Using this algorithm for image segmentation experiments on impurities such as fallen leaves,dead leaves and yellow leaves,the average matching rate of impurities is 93.22%,the average misclassification rate is 0.70%,and the average accuracy rate is 92.52%.The comparison experiments with FCM algorithm,Kmeans algorithm and PSO-Kmeans algorithm show that the segmentation accuracy of the algorithm in this paper is better,and the segmentation of different impurities shows good robustness,which provides a new method to support the realization of automatic picking of impurities in green vegetable and has certain practical value to improve the mechanized production of green vegetable.
green vegetable productionimpurity detectionKmeans clusteringsparrow search algorithm