Abstract
In this paper, we propose a classification model by analyzing raw material images recorded using a color CCD camera to automatically classify good and defective agricultural products such as rice, coffee, and green tea. To resolve the problems of existing human-dependent commercial products, we propose a vision-based automatic raw material classification combining mean shift clustering and stepwise region merging algorithms. The image is divided into N cluster regions by applying the mean-shift clustering algorithm. Representative regions are selected, and a stepwise region-merging method is applied to integrate similar cluster regions by comparing both color and positional proximity. The merged objects are expressed in 2D color distributions (RG, GB, BR), and a threshold is used to detect good and defective products based on color distribution ellipses. Experimental results show improved classification accuracy and reduced need for artificial manipulation compared to existing methods.
Introduction
In the agricultural and recycling industries, classifying raw materials—such as separating high-quality coffee beans from defective ones—has traditionally relied on skilled manual labor. However, human performance degrades over time due to fatigue and the repetitive nature of the task. While automated systems exist, they face several technical hurdles:
- Color Complexity: Early systems used monochromatic data, which fails for materials with diverse color profiles like coffee or green tea.
- Parameter Sensitivity: Standard algorithms like K-means require pre-defined cluster counts and are highly sensitive to initial conditions.
- Manual Calibration: Many commercial systems require manual adjustment of color threshold boundaries, which is inefficient and prone to error when material color distributions shift.
The proposed system aims to create a "hands-off," noise-resistant solution capable of handling complex color distributions automatically within a physical sorting environment.
Proposed Methodology
The authors propose a multi-stage computer vision pipeline designed for object-centric classification rather than simple pixel-wise analysis. This approach allows the system to build statistical models based on entire objects, making it more robust to noise.
1. Preprocessing
The system removes the background and applies morphological erosion (using a 5x5 kernel) to clean up the edges of the raw materials. This ensures that background pixels do not bleed into the material's color profile, enhancing the purity of the training data.
2. Mean Shift Clustering
Unlike K-means, Mean Shift is a non-parametric clustering technique. It finds local maxima in the color-position probability density without requiring a pre-defined number of clusters. This makes it ideal for segmenting objects with irregular shapes and unpredictable color variations.
3. Stepwise Region Merging
Because a single bean might be split into multiple clusters due to highlights or shadows, a merging step is implemented. A "seed" region is selected and merged with neighboring clusters based on Euclidean color similarity and spatial proximity.
4. 2D Color Distribution & Ellipse Thresholding
Once objects are merged, their pixels are mapped into three 2D color spaces: RG, GB, and BR. The system calculates the centroid and the tilt angle (using the least moment of inertia) to draw an automatic threshold ellipse around the "good" material. Any future material falling outside these ellipses is flagged as defective.
Experimental Evaluation
The algorithm was evaluated using 14 color images collected from a commercial sorting environment, containing 62 rice grains, 14 coffee beans, and 11 plastic pieces. Performance was benchmarked against a standard K-means algorithm and a commercial sorting system from Daewon GSI Co., Ltd.
Key Results
- Proposed Method: Achieved an average accuracy of 84.9%.
- Commercial System: Achieved 41.4%. The proposed method improved upon this by roughly 40% by automating the thresholding process that usually requires manual human adjustment.
- K-means Clustering: Achieved only 3.47%. K-means failed due to high sensitivity to noise and random initial cluster centers, leading to poor extraction of material regions.
The system performed best on coffee and rice but was slightly less accurate on plastic due to more diverse and unpredictable color profiles.
Conclusion
This paper introduces a robust pipeline for automatic material sorting. By combining Mean Shift clustering with stepwise region merging, the system automatically defines optimal color thresholds, significantly outperforming existing solutions. Future work will focus on optimizing the algorithm for faster classification rates and smaller memory footprints to meet the demands of real-world industrial sorting, where thousands of items pass per minute.
Summary updated