A material sorting method and system for a color sorter
By combining RGB digital image processing with multiple classification models, the problem of insufficient accuracy and versatility in material identification of traditional color sorters has been solved, and high-precision material classification has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2026-03-20
AI Technical Summary
Traditional color sorters are insufficient in terms of material identification accuracy and versatility, and it is difficult to effectively utilize color and texture features for high-precision classification.
RGB digital image processing technology is used to extract texture features through gray-level co-occurrence matrix. Combined with support vector machine, K-nearest neighbor, multilayer perceptron and Naive Bayes model, color and texture features are fused for material classification. Retinex color vision theory is used to remove shadows, Otsu global thresholding method is used for binary segmentation, and connected component labeling is used to remove interference images.
It improves the accuracy and versatility of material classification, can adapt to the identification needs of different materials, and ensures the accuracy and precision of classification results.
Smart Images

Figure CN116493292B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of color sorting machines, and particularly relates to a material classification method and system for a color sorting machine. BACKGROUND
[0002] A color sorting machine is a product combining the fields of optics, machinery, software development, image acquisition and processing. Because it has the characteristics of high classification accuracy, fast sorting speed and strong adaptability of sorting algorithm, the color sorting machine is widely used in the sorting of materials such as grains, tea and ores. When the color sorting machine is used, a large amount of material to be sorted is sent to the image acquisition and sorting device by the conveying mechanism. The real-time image information of the material is obtained by the image acquisition device such as a linear array CCD. After image processing and sorting rule classification, when the unqualified material flows through the rejection device, the air valve is opened to separate the material. However, in the traditional method, some color sorting machines identify by color features, some by texture features, and some by color and texture features. The versatility of the color sorting machine is low, and the recognition accuracy needs to be improved. SUMMARY
[0003] To solve the technical problems in the background art, the present application provides a material classification method and system for a color sorting machine.
[0004] The material classification method for a color sorting machine provided by the present application comprises the following steps:
[0005] obtaining an image of the material to be classified;
[0006] preprocessing the obtained image of the material to be classified to obtain an RGB digital image of the material to be classified;
[0007] extracting features from the RGB digital image of the material to be classified to obtain a feature set;
[0008] classifying the material to be classified according to the feature set and a pre-trained classification model;
[0009] In the feature extraction from the RGB digital image of the material to be classified to obtain the feature set, the method specifically comprises:
[0010] extracting color features from the RGB digital image of the material to be classified to obtain a first feature set;
[0011] extracting texture features from the RGB digital image of the material to be classified to obtain a second feature set;
[0012] concatenating and fusing the first feature set and the second feature set to obtain a third feature set.
[0013] Preferably, texture features are extracted from the RGB digital images of the materials to be classified to obtain a second feature set, specifically including:
[0014] Texture features are extracted from the RGB digital images of the materials to be classified using the gray-level co-occurrence matrix to obtain a second feature set.
[0015] Preferably, the calculation formula for extracting specific texture features through the gray-level co-occurrence matrix is as follows:
[0016] Contrast:
[0017] Correlation:
[0018] Arc second moment:
[0019] Uniformity:
[0020] Preferably, the materials to be classified are classified according to the feature set and the pre-trained classification model, specifically including:
[0021] Different classification models are pre-built;
[0022] The first feature set, the second feature set, and the third feature set are respectively input into different pre-built classification models for training to obtain the classification accuracy.
[0023] Based on the classification accuracy, the classification model with the highest classification accuracy is selected as the final classification model for the material to be classified, and the feature set input by the final classification model when the classification accuracy is the highest is selected as the classification feature for the material to be classified.
[0024] The materials to be classified are classified according to the classification characteristics and the final classification model.
[0025] Preferably, the different pre-built classification models include Support Vector Machine (SVM) model, K-Nearest Neighbors (KNN) model, Multilayer Perceptron (MLP) model, and Naive Bayes (NB) model.
[0026] Preferably, the acquired image of the material to be classified is preprocessed to obtain an RGB digital image of the material to be classified, specifically including:
[0027] Remove the shadows from the acquired images of the materials to be classified to obtain shadow-free images;
[0028] Binar segmentation is performed on the shadowless image to obtain a binarized image;
[0029] Connected region labeling is performed on the binarized image to remove interference images and obtain the RGB digital image of the material to be classified.
[0030] Preferably, before the binarized image is subjected to a connected region labeling process, the interference image in the binarized image is removed, and an RGB digital image of the material to be classified is obtained.
[0031] The binarized image is subjected to a morphological process to obtain a denoised binarized image.
[0032] The application also provides a material classification system for a color sorter, comprising:
[0033] An image acquisition module for acquiring an image of the material to be classified;
[0034] A preprocessing module for preprocessing the acquired image of the material to be classified to obtain an RGB digital image of the material to be classified;
[0035] A feature extraction module for extracting features from the RGB digital image of the material to be classified to obtain a feature set;
[0036] A classification module for classifying the material to be classified according to the feature set and a pre-trained classification model;
[0037] The feature extraction module comprises:
[0038] A first feature extraction submodule for extracting color features from the RGB digital image of the material to be classified to obtain a first feature set;
[0039] A second feature extraction submodule for extracting texture features from the RGB digital image of the material to be classified to obtain a second feature set;
[0040] A feature fusion submodule for concatenating and fusing the first feature set and the second feature set to obtain a third feature set.
[0041] Preferably, the classification module comprises:
[0042] A model construction submodule for pre-construction of different classification models;
[0043] A model training submodule for inputting the first feature set, the second feature set, and the third feature set into the pre-constructed different classification models for training to obtain classification accuracies; and selecting the classification model with the highest classification accuracy as the final classification model for the material to be classified, and selecting the feature set inputted into the final classification model when the classification accuracy is the highest as the classification feature for the material to be classified;
[0044] A classification submodule for classifying the material to be classified according to the classification feature and the final classification model.
[0045] Preferably, the preprocessing module comprises:
[0046] a shadow removing submodule configured to remove the shadow in the obtained image of the material to be classified to obtain a shadow-free image;
[0047] an image segmentation submodule configured to perform binary segmentation on the shadow-free image to obtain a binary image;
[0048] a connected region marking processing submodule configured to perform connected region marking processing on the binary image to remove interference images in the binary image, and obtain an RGB digital image of the material to be classified.
[0049] The present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the material classification method for a color sorter according to any one of the above.
[0050] The present application also provides a computer readable storage medium having a computer program stored thereon, wherein the program is executed by a processor to implement the material classification method for a color sorter according to any one of the above.
[0051] In the present application, the material classification method and system for a color sorter are proposed, the image of the material to be classified is obtained first, and the obtained image of the material to be classified is preprocessed to improve the accuracy of subsequent feature extraction and avoid the interference of shadows, noises and the like, then the material to be classified is classified according to the first feature set, the second feature set and the third feature set obtained through feature extraction and the pre-trained classification model, which is high in universality and can greatly improve the classification accuracy of the material to be classified. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 A flowchart of the material classification method for a color sorter is provided in the present application. DETAILED DESCRIPTION
[0053] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments.
[0054] REFERENCE Figure 1 The material classification method for a color sorter provided by the present application includes:
[0055] obtaining an image of a material to be classified;
[0056] preprocessing the obtained image of the material to be classified to obtain an RGB digital image of the material to be classified;
[0057] performing feature extraction on the RGB digital image of the material to be classified to obtain a feature set;
[0058] According to the feature set and the pre-trained classification model, the material to be classified is classified.
[0059] The RGB digital image of the material to be classified is subjected to feature extraction to obtain a feature set, specifically including:
[0060] The RGB digital image of the material to be classified is subjected to color feature extraction to obtain a first feature set.
[0061] The RGB digital image of the material to be classified is subjected to texture feature extraction to obtain a second feature set.
[0062] The first feature set and the second feature set are concatenated and fused to obtain a third feature set.
[0063] In specific use of the present application, the image of the material to be classified is first acquired, and the acquired image of the material to be classified is preprocessed to improve the accuracy of subsequent feature extraction and avoid interference of shadows, noises and the like, and then the first feature set, the second feature set and the third feature set obtained through feature extraction and the pre-trained classification model are used to classify the material to be classified, which greatly improves the classification accuracy of the material to be classified and has high universality.
[0064] In the present embodiment, the material to be classified is classified according to the feature set and the pre-trained classification model, specifically including:
[0065] Different classification models are pre-constructed;
[0066] The first feature set, the second feature set and the third feature set are respectively input into the pre-constructed different classification models for training to obtain classification accuracy rates;
[0067] According to the classification accuracy rates, the classification model with the highest classification accuracy rate is selected as the final classification model of the material to be classified, and the feature set input into the final classification model at the time of the highest classification accuracy rate is selected as the classification feature of the material to be classified;
[0068] The material to be classified is classified according to the classification feature and the final classification model.
[0069] In this way, a suitable feature and a suitable classifier can be selected to separate the material to be classified for different materials to be classified, further ensuring the accuracy and precision of the classification result.
[0070] In further embodiments, the pre-constructed different classification models include a support vector machine (SVM) model, a K-nearest neighbor (KNN) model, a multi-layer perceptron (MLP) model and a naive Bayes (NB) model.
[0071] In further embodiments, the RGB digital image of the material to be classified is subjected to texture feature extraction to obtain a second feature set, specifically including:
[0072] The texture features of the RGB digital image of the material to be classified are extracted by a gray level co-occurrence matrix to obtain a second feature set.
[0073] In a further embodiment, the calculation formula for extracting specific texture features by a gray level co-occurrence matrix is as follows:
[0074] Contrast:
[0075] Correlation:
[0076] Angular second moment:
[0077] Uniformity:
[0078] Since the image acquisition device usually acquires images in an outdoor or light environment, the surface of each material to be classified may have a shadow, and the shadow can be easily misclassified as a part of the material to be classified, which can affect the feature extraction and classification results. Therefore, in order to solve this problem, in the embodiment, the acquired image of the material to be classified is preprocessed to obtain an RGB digital image of the material to be classified, specifically including:
[0079] The shadow in the acquired image of the material to be classified is removed to obtain a shadow-free image.
[0080] The shadow-free image is subjected to binary segmentation to obtain a binary image.
[0081] The binary image is subjected to connected region labeling processing to remove interference images in the binary image to obtain an RGB digital image of the material to be classified.
[0082] In specific implementation, the shadow in the image of the material to be classified is removed first, and then the image is segmented and subjected to connected region labeling processing to remove interference images in the binary image, so that only the RGB digital image of the material to be classified is left, which facilitates feature extraction and classification in the later stage and is conducive to improving the recognition accuracy.
[0083] In one specific embodiment, the shadow in the acquired image of the material to be classified is removed to obtain a shadow-free image, specifically including:
[0084] The Finlayson shadow removal method based on the Retinex color theory is used to remove the shadow in the acquired image of the material to be classified to obtain a shadow-free image.
[0085] In one specific embodiment, the shadow-free image is subjected to binary segmentation to obtain a binary image, specifically including:
[0086] The non-shading image is binarized by using an Otsu global threshold method to obtain a binary image.
[0087] In addition, since the binary image may have noise regions or holes, in order to remove the noise regions or holes, in a further embodiment, before the binary image is subjected to a connected region labeling process to remove interference images in the binary image to obtain the RGB digital image of the material to be classified, it further includes:
[0088] The binary image is subjected to a morphological process to obtain a denoised binary image.
[0089] The application also provides a material classification system for a color sorter, comprising:
[0090] An image acquisition module is configured to acquire an image of the material to be classified.
[0091] A preprocessing module is configured to preprocess the acquired image of the material to be classified to obtain an RGB digital image of the material to be classified.
[0092] A feature extraction module is configured to extract features from the RGB digital image of the material to be classified to obtain a feature set.
[0093] A classification module is configured to classify the material to be classified according to the feature set and a pre-trained classification model.
[0094] The feature extraction module comprises:
[0095] A first feature extraction submodule is configured to extract color features from the RGB digital image of the material to be classified to obtain a first feature set.
[0096] A second feature extraction submodule is configured to extract texture features from the RGB digital image of the material to be classified to obtain a second feature set.
[0097] A feature fusion submodule is configured to concatenate and fuse the first feature set and the second feature set to obtain a third feature set.
[0098] In specific use, the image acquisition module is used to acquire the image of the material to be classified, and the preprocessing module is used to preprocess the acquired image of the material to be classified, which can improve the accuracy of subsequent feature extraction and avoid interference from shadows, noise, etc. Then, the first feature set, the second feature set, and the third feature set extracted by the feature extraction module, and the pre-trained classification model in the classification module are used to classify the material to be classified, which can greatly improve the classification accuracy of the material to be classified.
[0099] In a further embodiment, the second feature extraction sub-module is configured to perform texture feature extraction on the RGB digital image of the material to be classified by a gray level co-occurrence matrix to obtain a second feature set.
[0100] In a further embodiment, the texture features include contrast, correlation, angular second moment and uniformity.
[0101] The calculation formula of the contrast is
[0102]
[0103] The calculation formula of the correlation is
[0104]
[0105] The calculation formula of the angular second moment is
[0106]
[0107] The calculation formula of the uniformity is
[0108]
[0109] In the embodiment, the classification module includes:
[0110] a model construction sub-module configured to construct different classification models in advance;
[0111] a model training sub-module configured to input the first feature set, the second feature set and the third feature set into the different classification models constructed in advance respectively to train the classification models and obtain classification accuracies, select a classification model with the highest classification accuracy as a final classification model of the material to be classified according to the classification accuracies, and select a feature set input into the final classification model when the final classification model has the highest classification accuracy as a classification feature of the material to be classified;
[0112] a classification sub-module configured to classify the material to be classified according to the classification feature and the final classification model.
[0113] In this way, the classification module can select a suitable feature and a suitable classifier to identify and classify the material to be classified according to different materials to be classified, thereby further ensuring the accuracy and precision of the classification result.
[0114] In a further embodiment, the different classification models constructed in advance include a support vector machine (SVM) model, a K-nearest neighbor (KNN) model, a multi-layer perception (MLP) model and a naive Bayes (NB) model.
[0115] To facilitate feature extraction and classification in the later stage and thereby improve the identification accuracy, in the embodiment, the preprocessing module includes:
[0116] The shadow removal submodule is configured to remove the shadow in the obtained material image to be classified to obtain a shadow-free image.
[0117] The image segmentation submodule is configured to perform binary segmentation on the shadow-free image to obtain a binary image.
[0118] The connected region marking processing submodule is configured to perform connected region marking processing on the binary image, remove the interference image in the binary image, and obtain an RGB digital image of the material to be classified.
[0119] The present application further provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor executes the program to implement the material classification method for the color sorter.
[0120] The present application further provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the material classification method for the color sorter.
[0121] The above description is only the preferred embodiment of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can make equivalent replacements or changes to the technical solution and the inventive concept of the present application within the technical range disclosed by the present application, and all of them should be covered within the protection scope of the present application.
Claims
1. A material sorting method for a color sorter, characterized in that, include: Obtain images of the materials to be classified; The Finlayson shadow removal method based on Retinex color vision theory is used to remove shadows from the acquired images of materials to be classified, resulting in shadow-free images. Binar segmentation is performed on the shadowless image to obtain a binarized image; Morphological processing is performed on the binarized image to obtain a denoised binarized image; Connected component labeling is performed on the denoised binarized image to remove interference images from the binarized image, thus obtaining the RGB digital image of the material to be classified. Feature extraction is performed on the RGB digital images of the materials to be classified to obtain a feature set; The materials to be classified are classified based on the feature set and a pre-trained classification model. In this process, feature extraction is performed on the RGB digital images of the materials to be classified to obtain a feature set, which specifically includes: Color features are extracted from the RGB digital images of the materials to be classified to obtain the first feature set; Texture features are extracted from the RGB digital images of the materials to be classified to obtain a second feature set; The first feature set and the second feature set are concatenated and fused to obtain the third feature set; The classification process, which involves classifying materials based on a feature set and a pre-trained classification model, specifically includes: Different classification models are pre-built; the first feature set, the second feature set, and the third feature set are respectively input into the pre-built different classification models for training, and the classification accuracy is obtained; Based on the classification accuracy, the classification model with the highest classification accuracy is selected as the final classification model for the material to be classified. The feature set input by the final classification model when the classification accuracy is the highest is selected as the classification feature for the material to be classified. The material to be classified is classified according to the classification feature and the final classification model.
2. The material sorting method for a color sorter according to claim 1, characterized in that, Different pre-built classification models include Support Vector Machine (SVM), K-Nearest Neighbors (KNN), Multilayer Perceptron (MLP), and Naive Bayes (NB).
3. The material sorting method for a color sorter according to claim 1, characterized in that, Texture features are extracted from the RGB digital images of the materials to be classified to obtain a second feature set, which specifically includes: Texture features are extracted from the RGB digital images of the materials to be classified using the gray-level co-occurrence matrix to obtain a second feature set.
4. A material sorting system for a color sorter, characterized in that, include: The image acquisition module is used to acquire images of the materials to be classified. The preprocessing module is used to remove shadows from the acquired images of materials to be classified using the Finlayson shadow removal method based on Retinex color vision theory, so as to obtain shadow-free images. Binar segmentation is performed on the shadowless image to obtain a binarized image; Morphological processing is performed on the binarized image to obtain a denoised binarized image; connected component labeling is performed on the denoised binarized image to remove interference images in the binarized image, and an RGB digital image of the material to be classified is obtained. The feature extraction module is used to extract features from the RGB digital images of the materials to be classified, and obtain a feature set. The classification module is used to classify the materials to be classified based on the feature set and the pre-trained classification model; The feature extraction module includes: The first feature extraction submodule is used to extract color features from the RGB digital image of the material to be classified, and obtain the first feature set; The second feature extraction submodule is used to extract texture features from the RGB digital images of the materials to be classified, and obtain a second feature set. The feature fusion submodule is used to concatenate and fuse the first feature set and the second feature set to obtain the third feature set; The classification module includes: The model building submodule is used to pre-build different classification models; The model training submodule is used to input the first feature set, the second feature set, and the third feature set into different pre-built classification models for training to obtain the classification accuracy. Based on the classification accuracy, the classification model with the highest classification accuracy is selected as the final classification model for the material to be classified, and the feature set input by the final classification model with the highest classification accuracy is selected as the classification feature for the material to be classified. The classification submodule is used to classify materials to be classified based on classification features and the final classification model.
5. The material sorting system for a color sorter according to claim 4, characterized in that, Texture features include contrast, correlation, arcsecond moment, and uniformity.
6. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the material sorting method for a color sorter as described in any one of claims 1-3.
7. A computer-readable storage medium, characterized in that, It stores a computer program that is executed by a processor to implement the material sorting method for a color sorter as described in any one of claims 1-3.
Citation Information
Patent Citations
A fruit classification method based on image multi-feature fusion and application thereof
CN109002851A