Color sorter impurity distinguishing method based on texture feature extraction
By combining the texture feature extraction method of gray-level co-occurrence matrix and Gabor wavelet transform, and combining principal component analysis and support vector machine classification model, the problem of insufficient accuracy of traditional color sorters in sorting impurities with similar colors but different textures is solved, and efficient and stable impurity differentiation and sorting is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-03
AI Technical Summary
Traditional color sorters lack sufficient sorting accuracy when separating impurities that are similar in color but different in texture, and cannot meet the needs of sorting high-end materials.
A texture feature extraction method combining gray-level co-occurrence matrix and Gabor wavelet transform is adopted. Combined with principal component analysis and support vector machine classification model, the method achieves accurate distinction of impurities through image preprocessing, feature optimization and classification recognition.
It improves the accuracy of distinguishing impurities with similar colors but different textures, enhances sorting efficiency and stability, and adapts to the needs of different material types and sorting scenarios.
Smart Images

Figure CN121776144A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of color sorter technology, and particularly relates to a method for distinguishing impurities in color sorters based on texture feature extraction. Background Technology
[0002] A color sorter is a device that uses photoelectric technology to detect and remove impurities in materials. It is widely used in the sorting of materials in industries such as grain, ore, and plastics. Traditional color sorters mainly distinguish between materials and impurities based on the color difference between them. By collecting the color characteristics of the materials (such as RGB values, HSV values, etc.) and comparing them with preset thresholds, impurities can be identified and removed.
[0003] However, in practical applications, some impurities are highly similar in color to materials, making it difficult to accurately distinguish them based solely on color characteristics. This leads to misjudgments or missed judgments. For example, in the rice color sorting process, some rice grains that are not completely moldy are similar in color to normal rice grains, but their textures are significantly different. In plastic recycling and sorting, different types of plastic particles may have the same color, but different surface textures. This defect of traditional color sorters limits the improvement of their sorting accuracy and cannot meet the needs of high-end material sorting. Summary of the Invention
[0004] This invention provides a method for distinguishing impurities in color sorters based on texture feature extraction. It aims to solve the problem that different types of plastic particles may have the same color but different surface textures. This deficiency of traditional color sorters limits the improvement of their sorting accuracy and fails to meet the needs of high-end material sorting.
[0005] This invention is implemented as follows: a method for distinguishing impurities in a color sorter based on texture feature extraction, comprising the following steps:
[0006] S1. Image Acquisition: The original image of the material to be inspected is acquired through the industrial camera of the color sorter. The original image is then subjected to grayscale processing, Gaussian filtering for noise reduction, and image enhancement processing in sequence to obtain a preprocessed image.
[0007] S2. Texture Feature Extraction: Perform gray-level co-occurrence matrix operations and Gabor wavelet transform on the preprocessed image respectively: calculate four texture feature parameters of the image based on the gray-level co-occurrence matrix: energy, contrast, entropy and correlation; extract the direction-selective texture feature parameters of the image in four directions and three scales based on Gabor wavelet transform, and merge them to obtain the initial texture feature set;
[0008] S3. Feature optimization: Principal component analysis algorithm is used to reduce the dimensionality of the initial texture feature set, remove redundant features, and select the principal components with a cumulative contribution rate of more than 90% as the optimal texture feature vector.
[0009] S4. Classification and Recognition: Construct a support vector machine classification model, train the model using a labeled dataset containing material samples and impurity samples, input the optimal texture feature vector into the trained support vector machine classification model, and output the classification result of the material or impurity.
[0010] S5. Result Output: Based on the classification results, the color sorter's control system drives the jet actuator to precisely remove impurities.
[0011] Preferably, the grayscale processing uses a weighted average method with weighting coefficients of R = 0.299, G = 0.587, and B = 0.114 to convert the original RGB image into a grayscale image.
[0012] Preferably, the convolution kernel size of the Gaussian filter is set to 3×3, and the standard deviation is set to 0.8-1.2; the image enhancement processing is implemented using a histogram equalization algorithm.
[0013] Preferably, the construction parameters of the gray-level co-occurrence matrix are: distance d = 1-3 pixels, angle θ = 0°, 45°, 90°, 135°, and gray level = 256.
[0014] Preferably, the parameters of the Gabor wavelet transform are set as follows: the center frequency is 0.125, 0.25, or 0.5; the direction angle is 0°, 45°, 90°, or 135°; and the ratio of the standard deviation of the Gaussian window to the wavelength is set to 0.56. The mean of the result after the convolution operation is taken as the feature value.
[0015] Preferably, the processing procedure of the principal component analysis algorithm is as follows: first, calculate the covariance matrix of the initial texture feature set, then solve for the eigenvalues and eigenvectors, and select the principal components in descending order of eigenvalues.
[0016] Preferably, the kernel function of the support vector machine classification model is a radial basis function kernel function, and the penalty coefficient C and kernel function parameter γ of the model are optimized by cross-validation, with the cross-validation fold number set to 5 folds.
[0017] Preferably, the preset delay is calculated using the formula t = L / v, where L is the distance between the camera and the jet actuator, and v is the material movement speed.
[0018] Beneficial effects
[0019] Compared with existing technologies, the beneficial effects of this invention are as follows: This invention provides a method for distinguishing impurities in color sorters based on texture feature extraction. This invention integrates two texture extraction algorithms, gray-level co-occurrence matrix and Gabor wavelet transform, to extract texture features from two dimensions: spatial distribution and directional scale. Compared with single texture extraction methods, it can more comprehensively reflect the texture differences between materials and impurities, especially for impurities with similar colors but different textures, which has higher discrimination accuracy. Furthermore, this invention uses principal component analysis to reduce the dimensionality of the initial texture features, effectively eliminating redundant features, reducing the computational load of the classification model, improving the sorting efficiency of the color sorter, and meeting the needs of high-speed material sorting. At the same time, it adopts a support vector machine classification model and combines cross-validation to optimize model parameters, improving the model's generalization ability and classification stability, and can adapt to the needs of different material types and sorting scenarios. Attached Figure Description
[0020] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0022] Please see Figure 1 This invention provides a technical solution: a method for distinguishing impurities in a color sorter based on texture feature extraction, comprising the following steps:
[0023] S1. Image Acquisition: The original image of the material to be inspected is acquired through the industrial camera of the color sorter. The original image is then subjected to grayscale processing, Gaussian filtering for noise reduction, and image enhancement processing in sequence to obtain a preprocessed image.
[0024] S2. Texture Feature Extraction: Perform gray-level co-occurrence matrix operations and Gabor wavelet transform on the preprocessed image respectively: calculate four texture feature parameters of the image based on the gray-level co-occurrence matrix: energy, contrast, entropy and correlation; extract the direction-selective texture feature parameters of the image in four directions and three scales based on Gabor wavelet transform, and merge them to obtain the initial texture feature set;
[0025] S3. Feature optimization: Principal component analysis algorithm is used to reduce the dimensionality of the initial texture feature set, remove redundant features, and select the principal components with a cumulative contribution rate of more than 90% as the optimal texture feature vector.
[0026] S4. Classification and Recognition: Construct a support vector machine classification model, train the model using a labeled dataset containing material samples and impurity samples, input the optimal texture feature vector into the trained support vector machine classification model, and output the classification result of the material or impurity.
[0027] S5. Result Output: Based on the classification results, the color sorter's control system drives the jet actuator to precisely remove impurities.
[0028] The grayscale conversion process uses a weighted average method with weighting coefficients of R = 0.299, G = 0.587, and B = 0.114 to convert the original RGB image into a grayscale image.
[0029] The Gaussian filter convolution kernel size is set to 3×3, and the standard deviation is set to 0.8-1.2; the image enhancement processing is implemented using a histogram equalization algorithm.
[0030] The construction parameters of the gray-level co-occurrence matrix are: distance d = 1-3 pixels, angle θ is 0°, 45°, 90°, 135°, and gray level is set to 256 levels.
[0031] The parameters of the Gabor wavelet transform are set as follows: center frequency of 0.125, 0.25, 0.5, direction angle of 0°, 45°, 90°, 135°, and the ratio of Gaussian window standard deviation to wavelength of 0.56; the mean of the result after convolution is taken as the feature value.
[0032] The processing procedure of the principal component analysis algorithm is as follows: first, calculate the covariance matrix of the initial texture feature set, then solve for the eigenvalues and eigenvectors, and select the principal components in descending order of eigenvalues.
[0033] The kernel function of the support vector machine classification model is the radial basis function. The penalty coefficient C and kernel function parameter γ of the model are optimized by cross-validation, and the cross-validation fold number is set to 5 folds.
[0034] The preset delay is calculated using the formula t = L / v, where L is the distance between the camera and the jet actuator, and v is the material movement speed.
[0035] The color sorter uses a 1280×960 resolution CCD industrial camera with a frame rate of 50fps. The distance between the camera lens and the material conveyor belt is 30cm. The camera is calibrated using a standard grayscale calibration plate to ensure that the grayscale error is within ±2%. When the rice moves to the camera's shooting area with the conveyor belt, the camera captures the original RGB image. The original image is preprocessed as follows: a weighted average method (R=0.299, G=0.587, B=0.114) is used to convert it into a grayscale image; a Gaussian filter with a 3×3 convolution kernel and a standard deviation of 1.0 is used to remove noise from the image; and a histogram equalization algorithm is used to enhance the image contrast, resulting in a preprocessed image.
[0036] Next, gray-level co-occurrence matrix operations and Gabor wavelet transforms were performed on the preprocessed image. The gray level was set to 256 levels, the pixel distance d = 2 pixels, and the angles θ = 0°, 45°, 90°, and 135°. The gray-level co-occurrence matrices in four directions were calculated, and four feature parameters, namely energy, contrast, entropy, and correlation, were extracted from each matrix. The average value of the four directions was taken as the final gray-level co-occurrence matrix feature parameters, for a total of four features.
[0037] The center frequencies of the Gabor wavelets were set to f1 = 0.125, f2 = 0.25, and f3 = 0.5, and the direction angles were set to θ1 = 0°, θ2 = 45°, θ3 = 90°, and θ4 = 135°. The ratio of the standard deviation of the Gaussian window to the wavelength was 0.56. Twelve groups (3 scales × 4 directions) of Gabor wavelet convolution operations were performed on the preprocessed image. The mean of each convolution result was taken as the feature value of that group, resulting in a total of 12 features.
[0038] By merging the gray-level co-occurrence matrix features and Gabor wavelet features, an initial texture feature set containing 16 features is obtained;
[0039] Principal component analysis (PCA) was used to reduce the dimensionality of the 16 initial features. After calculating the feature covariance matrix, the eigenvalues and eigenvectors were obtained. The eigenvalues were sorted from largest to smallest, and the principal components with a cumulative contribution rate of over 90% were selected to form the optimal texture feature vector.
[0040] A support vector machine (SVM) classification model was constructed, with the radial basis function (RBF) kernel function selected. The model was trained using a labeled dataset containing normal rice samples, partially moldy rice samples, small stone samples, and rice husk samples. The dataset was divided into training and test sets in a 7:3 ratio. The model parameters were optimized using 5-fold cross-validation, yielding an optimal penalty coefficient C = 10 and a kernel function parameter γ = 0.1. The optimal texture feature vector from the test set was input into the model, and the classification result for the material or impurity was output.
[0041] Based on the speed of the rice moving on the conveyor belt and the distance between the camera and the jet actuator, the delay time is calculated. When the model detects impurities, the control system controls the jet actuator to spray high-pressure gas after the delay to remove the impurities.
[0042] The working principle and usage process of this invention: This invention constructs a full-link technology system of "multimodal texture feature fusion + intelligent optimization + accurate classification + dynamic execution": Addressing the texture differences between materials and similar-colored impurities, it innovatively employs a dual-algorithm fusion strategy of gray-level co-occurrence matrix and Gabor wavelet transform to extract features. The gray-level co-occurrence matrix, through parameter settings of distance d = 1-3 pixels and angles of 0° / 45° / 90° / 135°, captures the spatial distribution pattern of pixels and outputs four major statistical features: energy, contrast, entropy, and correlation, reflecting basic attributes such as texture uniformity and clarity. The Gabor wavelet transform, with its combination of parameters across three scales and four directions, accurately extracts direction-selective texture features, overcoming the limitations of single-dimensional algorithms. To improve computational efficiency, it uses principal component analysis to calculate the feature covariance matrix, solve for eigenvalues and eigenvectors, and select the optimal eigenvector, removing redundant information while retaining key texture differences. The classification stage employs a radial basis function kernel support vector machine model, optimizing the penalty coefficient C and kernel parameter γ through 5-fold cross-validation. Leveraging its advantages in small-sample, high-dimensional data classification, it achieves accurate discrimination. Finally, the dynamic range is calculated using the formula t = L / v. The time delay ensures that the jet actuator is synchronized with the trajectory of the impurities, achieving precise removal. Its operation can be divided into four closed-loop stages: First, pre-calibration is performed using a high-resolution CCD industrial camera. Geometric distortion correction and grayscale calibration are completed using a standard grayscale calibration plate to ensure image acquisition consistency. Second, model training is conducted by constructing a labeled dataset covering the target material and various impurities. After preprocessing with weighted average grayscale conversion, 3×3 Gaussian filtering for noise reduction, and histogram equalization, dual-algorithm feature extraction and PCA dimensionality reduction are performed. Model parameters are optimized through 5-fold cross-validation, and training is completed. The process involves several steps: First, online sorting. A camera captures real-time images of high-speed moving materials and performs preprocessing. Pre-stored parameters are used to quickly extract features and reduce dimensionality. The trained model is then input to output classification results. The control system triggers the jet actuator based on dynamic delay parameters. Finally, dynamic adjustment is implemented. By monitoring indicators such as missed rejection rate and false rejection rate, the system periodically replenishes sample increments to train the model or adjusts filtering and feature extraction parameters to adapt to changing working conditions. This ensures high-speed sorting requirements are met while achieving high-precision differentiation of impurities of similar colors through comprehensive texture feature representation, making it suitable for various industry applications such as grain, plastics, and ore.
[0043] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for distinguishing impurities in a color sorter based on texture feature extraction, characterized in that: Includes the following steps: S1. Image Acquisition: The original image of the material to be inspected is acquired through the industrial camera of the color sorter. The original image is then subjected to grayscale processing, Gaussian filtering for noise reduction, and image enhancement processing in sequence to obtain a preprocessed image. S2. Texture feature extraction: Perform gray-level co-occurrence matrix operations and Gabor wavelet transform on the preprocessed image respectively: calculate the four texture feature parameters of the image based on the gray-level co-occurrence matrix: energy, contrast, entropy and correlation. Based on Gabor wavelet transform, orientation-selective texture feature parameters of the image are extracted in 4 directions and 3 scales, and then merged to obtain an initial texture feature set; S3. Feature optimization: Principal component analysis algorithm is used to reduce the dimensionality of the initial texture feature set, remove redundant features, and select the principal components with a cumulative contribution rate of more than 90% as the optimal texture feature vector. S4. Classification and Recognition: Construct a support vector machine classification model, train the model using a labeled dataset containing material samples and impurity samples, input the optimal texture feature vector into the trained support vector machine classification model, and output the classification result of the material or impurity. S5. Result Output: Based on the classification results, the color sorter's control system drives the jet actuator to precisely remove impurities.
2. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The grayscale conversion process uses a weighted average method with weighting coefficients of R = 0.299, G = 0.587, and B = 0.114 to convert the original RGB image into a grayscale image.
3. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The Gaussian filter convolution kernel size is set to 3×3, and the standard deviation is set to 0.8-1.2; the image enhancement processing is implemented using a histogram equalization algorithm.
4. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The construction parameters of the gray-level co-occurrence matrix are: distance d = 1-3 pixels, angle θ is 0°, 45°, 90°, 135°, and gray level is set to 256 levels.
5. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The parameters of the Gabor wavelet transform are set as follows: center frequency of 0.125, 0.25, 0.5, direction angle of 0°, 45°, 90°, 135°, and the ratio of Gaussian window standard deviation to wavelength of 0.56; the mean of the result after convolution is taken as the feature value.
6. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The processing procedure of the principal component analysis algorithm is as follows: first, calculate the covariance matrix of the initial texture feature set, then solve for the eigenvalues and eigenvectors, and select the principal components in descending order of eigenvalues.
7. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The kernel function of the support vector machine classification model is the radial basis function. The penalty coefficient C and kernel function parameter γ of the model are optimized by cross-validation, and the cross-validation fold number is set to 5 folds.
8. The method for distinguishing impurities in a color sorter based on texture feature extraction as described in claim 1, characterized in that: The preset delay is calculated using the formula t = L / v, where L is the distance between the camera and the jet actuator, and v is the material movement speed.