Inspection and classification of wheat quality using image processing

Junsong Zhu1,2, Jianrong Cai1, Baosheng Sun3, Yongjian Xu1, Feng Lu1,2, Haile Ma1,2*

1School of Food and Biological Engineering, Jiangsu University, 301 Xuefu Road, Zh enjiang, Jiangsu 212013, China;

2Institute of Food Physical Processing, Jiangsu University, 301 Xuefu Road, Zhenjiang, Jiangsu 212013, China;

3Monitor Institute of the Quality of Grain and Oil of Taizhou, Taizhou, Jiangsu 225300, China


Wheat plays an important role in our daily life and industrial production. Several computer vision approaches have been proposed for classifying wheat quality, but there were some methods focusing on the problem of cohesive wheats while image processing. In this paper, we designed a single kernel guide groove to separate the cohesive wheats, which could simplify the algorithm of image processing and improve the accuracy rate of classification. For the method followed while recording the data, the image information must be converted into digital information, and the results are provided using appropriate image processing algorithms. Image preprocessing steps such as binarization, image enhancement, image segmentation, and morphological processing were used to reduce noise. For image segmentation, we proposed the following new segmentation methods: (1) extracting wheat region by converting image to H channel and (2) watershed algorithm based on Euclidean distance transformation. For the classification model, 22 features of 7 different qualities of wheat were inputted in the Back Propagation (BP) neural network and Support Vector Machine (SVM) model, and the overall correct classification rates were determined to be 91% and 97% for SVM and BP neural network, respectively. The BP neural network was more suitable for wheat appearance quality detection.

Key words: BP neural network, image processing, inspect, single granulation guide groove, SVM, wheat

*Corresponding Author: Haile Ma, School of Food and Biological Engineering, Jiangsu University, 301 Xuefu Road, Zhenjiang, Jiangsu 212013, China. Email: [email protected]

Received: 12 October 2022; Accepted: 23 April 2023; Published: 1 July 2023

DOI: 10.15586/qas.v15i3.1220

© 2023 Codon Publications
This is an Open Access article distributed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0). License (


Wheat plays an important role in human diet and industrial production. It belongs to the family Gramineae (wild grass), native to parts of western Asia (Dhua et al., 2021). Wheat quality is not only related to its varieties and growth conditions, but also to the its storage environment. If wheat is not well stored, its quality will alter and causes the following changes (1) reduction in protein content and (2) infections due to fungi, viruses, or insect -erosion. With the improvement of people's living standards, their requirement for better wheat quality is increasing. Therefore, it is very important to inspect the quality of wheat before it reaches the market. Wheat kernels that were damaged yet worthy of use were defined as imperfect grains, including the grains affected by fusarium gibberellic disease kernel (FGDK), moldy kernel (MK), black germs kernel (BGK), sprouting kernel (SK), insect erosion kernel (IEK) and damaged kernel (DK). At present, many wheat quality inspection agencies and enterprises use manual inspection methods to conduct random inspections and quality monitoring. The efficiency of manual detection methods is low, and the detection result is greatly affected by subjective factors (Wang et al., 2019).

In recent years, some non-destruction technologies such as near-infrared spectroscopy (Femenias et al., 2021), hyperspectral imaging (Pandiselvam et al., 2020; Ravikanth et al., 2015), acoustic, electronic nose (Qian et al., 2021), and fusion of artificial senses (Kiani et al., 2016) have been used to inspect the appearance and quality of wheat. Machine vision replacing manual inspection methods can improve the efficiency to a certain extent, which has positive significance for wheat quality classification and grading (Mahanti et al., 2022; Vithu et al., 2016). Image acquisition can be performed using cameras or flat-bed scanners. Cameras may be color or monochrome, with charge coupled device (CCD) or complementary metal–oxide–semiconductor sensors (CMOS), and are selected based on retrieval interphase, image format, resolution, and noise-pixel ratio requirements (Liu et al., 2022). The quality of the digital image is improved prior to image analysis (termed as image pre-processing) using methods such as image resizing, image enhancement, noise removal, edge detection, and filtering (Davies, 2009).

Majumdar et al. (1999) determined the color or -color-band combination that gave the highest classification accuracies in cereal grains. The shape and size are critical to distinguish between wheat and winter wheat (Ma et al., 2020). Seed color of the bean varieties are very similar, and a total of 16 features were extracted to completed the classification model building (Koklu et al., 2020). The machine vision system detects flawed rice kernels, that is, broken, chalky, damaged, or spotted, and the inspection accuracy reaches 93% (Chen et al., 2019). Automatic inspection machine uses spatial information of maize kernels to enhance the accuracy rate, which achieves 98.2% (Ni et al., 2019). Using computer vision inspects, changes in the internal color and texture of fermented cocoa beans can be detected, which could evolve into an industrial application with a proper integration framework (Oliveira et al., 2021). The CNN-ANN classifier was observed to perform the best among the support vector machine.. the accuracy rates of k-nearest--neighbor (KNN) and convolutional neural network (CNN) reached 98.2% for detecting the corn (Javanmardi et al., 2021), while SVM has the highest accuracy results for inspecting beans, which reaches 93.13% (Koklu and Ozkan, 2020). The deep learning architectures trained with a fine-tuning can lead to higher classification rates in comparison to other approaches, which reaches 93.82% accuracy rate for classifying soybean pest images (Tetila et al., 2020). A combination of terahertz spectral imaging and convolutional neural network is proposed to detect impurities in wheat rapidly and effectively (Shen et al., 2021). The artificial neural networks (ANN) classified foreign materials from wheat kernels using a total of 236 morphological, color, wavelet, and gaborlet features, and the maximum classification accuracy is 93.46% (Kaya et al., 2019). Although many scholars performed research on wheat quality using machine vision, they usually focused on classification accuracy but ignored the detection equipment. It is significant to design a single granulation guide groove for separating cohesive wheat before inspecting.

In this study, the objectives and novelty are as follows: (1) Establishing image acquisition system for wheat appearance quality, (2) designing a single granulation guide groove for separating cohesive wheats, (3) optimizing image processing, and (4) comparing the image processing algorithm and choosing the best algorithm for wheat appearance quality inspection.

Materials and methods

Samples preparation

Taizhou Grain and Oil Quality Supervision Institute, Jiangsu province, China, provided some experience samples, including FGDK, MK, BGK, SK, IEK, DK and perfect kernels (PK), which belong to Yang Wheat No. 23. The samples were randomly taken from the supervision institute and stored in a refrigerator at 4°C to prevent quality changes. A total of 250 kernels of each type of wheat were prepared for image processing, of which 150 kernels were used to establish the model and 100 kernels were used to verify the inspection accuracy of the model. Figure 1 shows the characteristics of various wheat.

Figure 1. Appearance characteristics of various wheat: (A) fusarium gibberellic disease kernel; (B) black germs kernel; (C) moldy kernel; (D) insect erosion kernel; (E) sprouting kernel; (F) damaged kernel; (G) perfect kernel.

Wheat appearance quality detection platform

Figure 2 shows the self-developed machine vision system for wheat appearance quality inspection, which is composed of an industrial digital camera, a line illuminant, a conveyor, and a computer. Line-scan Digital CMOS camera (Dalsa, Canada) with resolution of 8192 × 2 pixels was used to obtain the image data that was in the center of the photo box and 22 cm from the height of the conveyor belt. Illuminant (Daheng, China) that is mounted diagonally below the camera provided light for the sample. Computer (2.6 GHz Intel Core i5 CPU, with 4 GB RAM, Lenovo, China) connected to the camera received the image information and processed the data to complete the classification and inspection of wheat.

Figure 2. Wheat appearance quality inspection system: (A), design drawing of the wheat appearance quality inspection system; (B) real picture of the wheat appearance quality inspection system; 1, hopper; 2, chute; 3, stents; 4, conveyor belt; 5, single kernel guide groove; 6, shading box; 7, camera; 8, illuminant; 9, wheat collecting box; 10, image acquisition card; 11, monitor; 12, computer; 13, rack; 14, governor.

The single kernel guide groove

The problem of cohesive wheats is a troublesome situation in image process, which affects the classification accuracy. The computer possibly recognized cohesive wheats as one, which caused the image data to be read incorrectly. If the image processing algorithm such as watershed segment is used to deal with the cohesive wheats image processing, it will take more time and occupy more computer memory. To solve this problem of adhesion between wheat kernel, when wheats fall on the conveyor, the single kernel guide groove was designed to separate the cohesive wheats.

Figure 3 shows the single kernel guide groove and the real separation procedure after passing through the single kernel guide groove. The single kernel guide groove consists of three sections, which were composed of multiple channels. The left-right channels or sections were arranged in by dislocation, and the separation of the adhesion wheat could be completed by relative friction between single kernel guide groove and wheat. The width of normal wheat is about 5 mm, hence, the channel was designed 6 mm to allow only a single wheat to pass through and separate the cohesion wheats. If the separation of cohesive wheats were not completed during the first time, then they can be separated in the next two sections to achieve the separation goal.

Figure 3. Single kernel guide groove: (A) design drawing of the single kernel guide groove; (B) real picture of the single kernel guide groove; (C) picture of wheat before separation; (D) Picture of wheat after separation.

Image preprocessing

Images are processed using Halcon software (Mvtec, German). Image preprocessing was performed to ensure the extracted region was clear and effective before extracting the wheat feature information. After the wheat appearance quality detection platform acquired the image of wheat successfully, the computer obtained lots of image data, which contained a lot of miscellaneous and redundant information. It was necessary to eliminate these noises to obtain more accurate wheat feature information by image preprocessing. Image preprocessing included binarization, image enhancement, image segmentation, morphological processing (L. Li et al., 2022).


The color camera used in this study generated images containing the color, brightness, saturation and other information of wheat, which was redundant to get the wheat region, so binarization was used in image preprocessing. The calculation method of gray value was shown in Eq. (1)

gray=0.299×red+0.587×green+0.114×blue 1

where , and were the three channels pixel value of a color point.

Image enhancement

The process of image enhancement was also the process of image filtering. During the transmission process of image information data, noise generated due to equipment or environment affects the quality of image generation (Hamdi et al., 2021). Filtering methods were used to remove the noise of the image to enhance its quality and subsequently facilitate image processing. There are various image enhancement methods such as mean filtering, median filtering, Gaussian filtering, which were used in this study and they were compared to select a better filtering method for subsequent research.

Mean filtering is a linear filtering method (Yugander et al., 2020), where a pixel point overlaps with the filter center of a certain size, and the mean value of the pixels within the filter range is calculated, then, replace the original pixel value of the point with the new pixel value that was obtained. The mean filter passed each pixel in the image, and the pixels of the original image changed after filtering, then the noise in the image were blurred and smoothed after filtering. The calculation function of mean filtering was as follows:

fx,y=1Ngi,j,i,jW 2

Where is the point pixel value after mean filtering, is the pixel value of point in the range of the mean filter, N is the number of pixels in the range of mean filter, W is the size of the mean filter.

Median filtering is a non-linear filtering method (Singh et al., 2022), where a pixel point overlaps with the filter center of a certain size, and sort the pixels within the filter range in the order of largest to smallest, then take the median pixel to replace the original pixel value of the point. The calculation function of median filtering was as follows:

fx,y=mediangxk,yl,k,lW 3

Where is the point pixel value after median filtering, is the pixel value of point in the range of the median filter. W is the size of the median filter.

Gaussian filtering is a linear filter (Srinivasa et al., 2021), which filters the image data information based on mean filtering. The difference between Gaussian filtering and mean filtering is that the idea of weighted average was used in Gaussian filtering. The weight coefficient nearing the filter center increases, while the weight coefficient away from the filter center decreases. The calculation formula of two-dimensional Gaussian function was as follows:

Gx,y=12πσ2ex2+y22σ2 4

Where is the weight value of various position in the Gaussian filter. The size of σ determines the width of the Gaussian function. The larger σ is, the more effective the Gaussian filter is.

Image segmentation

After image enhancement, the wheat image could be segmented according to the gray value. The wrong date generated by image segmentation was used in the mathematical modeling, which increased the difficulty of model building and reduced the accuracy of wheat inspection. Common image segmentation methods were as follow: segmentation based on threshold, segmentation based on watershed algorithm, segmentation based on image edge, and other methods.

Threshold method was to select an appropriate threshold range according to the difference of the gray level of the whole image and divide the image into target area and background area, which is the simplest image segmentation method (Lei et al., 2019). The threshold segmentation function was as follow:

gx,y=0fi,j<T1255T1<fi,j<T20fi,j>T2 5

Where T1 and T2 are thresholds of wheat region gray value. After threshold segmentation, the gray value of wheat was 255, and the gray value of background was 0.

Usually, threshold segmentation extracts wheat region directly from gray image, but in this study, original image was converted to three channels for extracting wheat region, and chose the best channel to extract wheat region by comparing the effect of extraction.

The concept of watershed comes from topography (Zhang et al., 2019). The main drawback of the watershed algorithm was the over-segmentation. To avoid the over-segmentation, watershed algorithm based on Euclidean distance transformation was used in this study.

There was a large difference between the pixels of wheat region and the pixels of background region. The edge of wheat has the most drastic pixel mutation in the image, and the first-order and second-order differentials were suitable for processing the pixels with these mutations. Common operators are Prewitt operator, Sobel operator, Canny operator and so on (Mohd Ali et al., 2020).

Morphology treatment

After image segmentation, most of the wheat area has been extracted successfully, but there was still noise or holes. The morphological treatment can retain the original information in the image while removing the noise points, and wheat skeleton has good continuity and less breakpoints after processing.

Features extraction

After segmentation and morphological treatment step, images containing separated wheats were obtained. It was important to extract features in building a reliable model to identify the wheat appearance quality correctly (Septiarini et al., 2021). In this study, the shape, color, and texture features were extracted. The size of wheat was generally 6 mm × 3 mm, and it was not convenient to measure the appearance features of wheat in the physical coordinate system. Therefore, the pixel coordinate system was used to describe the appearance features of wheat, and the information was calculated in pixel units. It was feasible to use the shape features of wheat as the classification and recognition basis of wheat appearance quality.

There were differences in the shape feature of wheat. For example, the surface of FGDK was dry, and the area of damaged kernel was reduced, and the shape of wheat sprouts was irregular. In this study, six wheat shape features were selected, including area, roundness, rectangularity, perimeter, compactness and eccentricity. The formulas for calculating wheat shape parameters were given in Eqs. (6)–(11)

Area=D1x,yD 6

where D is the region where the wheat pixel is located; is the specific coordinate in the region where the wheat pixel is located

Perimeter=Na+2Nd 7

where is the number of four connected domains; is the number of eight connected domains

Circularity=Aπ*max2 8

where is the furthest distance from the center of the wheat to the contour

Compatness=P24Aπ 9
Rectangularity=AArec 10

where Arec is the area of the outer rectangle of wheat region

Eccentricity=RaRb 11

where Ra is the short radius distance, Rb is the long radius distance.

RGB color model was the basis of many color models, but HSI color model can describe the color features from the hue and saturation aspects. The calculation formulas of wheat color parameters are in Eqs. (12)–(15).

Hue=θBG2πθB>G 12
θ=arccos12RG+RBRG2+RBGB12 13
Saturation=13R+G+BminR,G,B 14
Intensity=13R+G+B 15

The gray image was used to extract texture features by using gray-level co-occurrence matrix (GLCM) method (Lin et al., 2020). If the distance between and is d and the angle between them and the horizontal axis of coordinates is , then the GLCM of various distances and angles can be expressed as Based on GLCM, the texture feature vectors, -including energy, contrast correlation, and homogeneity can -comprehensively represent the condition of gray co--occurrence matrix, were extracted. The calculation -process was in Eqs. (16)–(23).

Energy=ijpi,j|d,θ2 16
Contrast=kk2ijpi,j|d,θ,k=ij 17
Correlation=ijijpi,j|d,θuxuyσx2σy2 18
ux=iijpi,j|d,θ2 19
uy=jjipi,j|d,θ2 20
σx2=iiux2jpi,j|d,θ 21
σy2=jjux2ipi,j|d,θ 22
Homogeneity=ij11+ij2pi,j|d,θ 23

Principle component analysis (PCA)

PCA is a process of data mining and data dimension reduction. After receiving adequate data information, if all the data are calculated directly, the whole analysis process calculation will be too large, and the accuracy of the calculation will decrease (Islabudeen et al., 2021). PCA converts indicators to independent comprehensive index, and reduces the number of indicators. After transformation, each comprehensive index has an eigenvalue. The larger the eigenvalue was, the more original data information it contained, and there was also a variance contribution rate corresponding to the eigenvalue. Generally, when the cumulative variance contribution rate reaches 95% or more, it was considered that the selected comprehensive index covers most of the original data information. The remaining comprehensive indexes with small variance contribution rate were regarded as jumbled original data and have little influence on the analysis results.

Pattern recognition

The color, shape, and texture features of wheat can effectively reflect the appearance feature of wheat, and the mathematical model can be built by using the feature information to classify the appearance quality of wheat. In this study, BP neural network model and SVM model were constructed respectively, and the effectiveness and stability of the two models were verified through the construction of training set and test set.

BP neural network model is a multi-layer feedforward network with error back propagation (Suresh et al., 2020), including input layer, hidden layer and output layer. There were two processes in training model: forward propagation of training set data and back propagation of errors between actual output and expected output. If the actual error exceeds the pre-set acceptable error range, the error will be sent back to the input layer through the network nodes of the hidden layer, and the weight of each network node will be adjusted through the back propagation of the error.

SVM model is a generalized linear classifier based on statistical learning theory, which is widely used in data classification and regression analysis (dos Santos et al., 2016). SVM adopts the kernel function method to find the optimal hyperplane between the two categories, which maximize the edge distance between the two categories or the maximum blank area on both sides of the hyperplane.

Results and Discussion

Image preprocessing

In theory, each filtering method had its own features: the mean filtering had the fastest calculation speed and had a significant smoothing effect on the noise points, but it was easy to blur the image (Liu et al., 2021); the median filtering could remove some isolated noise points in the image and retained the edge features of the wheat in the image; the Gaussian filtering could not only smoothen the noise points, but also alleviated the fuzzy problems caused by mean filtering, but the computation was large (Li et al., 2021). According to the experiment, the median filtering can not only remove the noise but also retain the edge information of the image. Therefore, median filtering was selected as the filtering method of wheat image in this study, and 3*3 template was selected.

The method of segmentation based on the threshold converted the obtained wheat images to R, G, B, H, S and I channels. After the original image was converted to each channel, the gray histogram could be used to observe the gray distribution of different levels from 0 to 255. It could be seen from the figure that the distribution rule of gray histogram was different in various channels. In the experiment, it was found that when the image was transformed into H channel and the threshold interval was set as [80,120], the wheat region in the image had a better separation effect from the background region.

Each step of Segmentation based on watershed algorithm is shown in Figure 4, It is known that the result of segmentation is effective and the original shape of wheat is preserved well.

Figure 4. Each step of Segmentation based on watershed algorithm: (A) Euclidean distance transformation; (B) transformation of date type; (C) inverting pixel value; (D) increasing contrast; (E) Watershed algorithm; (F) wheat image after segmenting.

All the methods of segmentation based on edge could find wheat edges, but there differed in processing details of wheat edges. After Canny operator processing, there were more small protrusions and some holes at the edge of wheat. Sobel operator and Prewitt operator made use of the first derivative of digital image for edge detection, which can reflect the outline of wheat. The wheat image processed by Sobel operator contained a lot of information on the surface of wheat, but when the image was magnified by some times, the edge of the wheat had some small protrusions, which belonged to redundant information. After comparing the three edge segmentation methods, the segmentation effect of Prewitt operator was better.

Comparing the three categories of image segmentation methods, there were mainly considerations of advantages and disadvantages as follows: (1) the processing speed of thresholding based on image segmentation was the fastest, and the processing effect of wheat image was good by converting wheat image to H channel. (2) The watershed algorithm based on Euclidean distance transformation could effectively segment cohesive wheats and extract wheat features more accurately, but it took a long time. For example, it took 1562 ms to segment an image with watershed algorithm, while it took 94 ms to segment an image based on threshold. (3) In the wheat image segmentation method based on edge, the Prewitt operator was better than other edge segmentation operators, but the wheat region obtained by this method was smaller than the actual wheat region. In summary, the method of segmentation based on thresholding was used to extract wheat regions in this study, which had high extraction efficiency, fast speed and completed information.

In the early image processing, wheat region was extracted relatively completely, and there were no large holes and protrusions, which only needed simple morphology processing. The corrosion and dilation operations could easily change the actual size of the wheat region in the image (Li et al., 2020). Therefore, this study combined the opening operation and the closing operation to remove the protrusions existing on the edge of the wheat in the image and fill the holes in the region, which ensured the original shape and size of the wheat as much as possible.

Features extraction

It can be seen from Table 1 that the surface of FGDK was a little red, therefore the R and I components were the largest. The surface of BGK had black spots, hence the R component and I component were the lowest. The surface of MK had white color characteristics, and the values of each component of RGB were similar. In the RGB color model or HSI color model, the color components of the IEK and PK were similar, but the quality of insect and perfect grains was poor and the color of the surface was uneven, so the variance of the color component of the IEK was bigger than that of the PK.

Table 1. Wheat color characteristic data.

R mean G mean B mean R variance G variance B variance H mean S mean V mean H variance S variance V variance
FGDK 133.0079 101.835 70.06282 61.02754 44.68093 32.33225 27.9062 120.7526 133.7063 23.96443 21.6336 59.91245
BGK 32.44153 24.03178 17.31597 22.38067 16.28262 11.82918 25.11093 116.1372 32.73697 28.08456 25.47592 22.2366
MK 77.00235 66.99058 52.2284 34.44008 26.60092 21.39615 32.78141 80.70293 77.93302 21.16128 25.19742 33.56833
IEK 102.7311 73.89789 49.61292 49.43308 36.23138 27.38614 24.46051 133.2965 103.2018 18.67734 27.45342 48.73324
SK 108.7247 85.09459 54.66357 60.23975 45.96117 32.32103 31.70702 127.3198 110.241 24.17082 32.40017 58.90954
DK 112.4525 90.81515 59.95253 56.4553 44.3176 33.14519 31.44941 121.538 113.3383 21.57924 28.80175 55.32606
PK 101.7517 76.68234 48.31594 41.86753 30.56333 21.80007 27.11445 134.8096 102.3086 17.7533 17.7533 40.90772

It can be seen from Table 2 that the surface of DK had defects, hence the area was the smallest. There were raised buds on the surface of the SK, so the roundness and rectangularity of the SK were the lowest. Therefore, it is feasible to use the shape characteristic parameters of wheat as the basis of wheat classification and recognition.

Table 2. Wheat shape characteristic data.

Area Perimeter Circularity Compactness Rectangularity Eccentricity
FGDK 45352.96 883.5871 0.487079 1.378465 0.801234 1.950658
BGK 71241.46 1285.126 0.426107 1.865448 0.768499 1.959184
MK 101426.8 1767.182 0.394974 2.487556 0.700092 1.82521
IEK 47408.11 893.1668 0.492673 1.345874 0.808019 1.898066
SK 68261.19 1972.926 0.217213 4.846695 0.556162 1.921592
DK 30138.32 704.5436 0.608486 1.322324 0.767624 1.298779
PK 44297.98 854.2184 0.523838 1.317262 0.791349 1.774293

It can be seen from Table 3 that FGDK had the lowest energy value, the highest contrast and the lowest local uniformity; the surface of PK was the most glossy and smooth, so its energy value was the largest; the surface of the BGK had obvious black spots, and the contrast was the highest. Different wheat showed different texture characteristics, so it is feasible to apply texture characteristics to wheat appearance quality detection in this study.

Table 3. Wheat texture feature data.

Energy Correlation Homogeneity Contrast
FGDK 0.008086 0.997527 0.69957 1.031285
BGK 0.084237 0.99504 0.910503 0.188725
MK 0.024617 0.996747 0.859325 0.311682
IEK 0.012821 0.997921 0.778284 0.561056
SK 0.008074 0.99779 0.720867 0.948948
DK 0.009078 0.997986 0.73522 0.75393
PK 0.019437 0.99732 0.811738 0.54172


In early wheat feature extraction, 12 color features, 6 shape features and 4 texture features were extracted from wheat. In this study, PCA was conducted on the extracted wheat features, and 22 wheat features were converted into 22 principal components. It can be seen from Table 4 that former 9 cumulative variance contribution ratio of the principal components can reach more than 95%, which could contain most of the wheat appearance characteristics information. The former 9 principle component could be taken in the process of mathematical model building.

Table 4. PCA feature optimization.

PCA variance contribution rate (%) Cumulative variance contribution rate (%)
1 0.4245 0.4245
2 0.2309 0.6554
3 0.0749 0.7302
4 0.0621 0.7923
5 0.0535 0.8458
6 0.0456 0.8914
7 0.0300 0.9215
8 0.0217 0.9432
9 0.0155 0.9586
10 0.0128 0.9714
11 0.0081 0.9795
12 0.0071 0.9867
13 0.0053 0.9919
14 0.0038 0.9957
15 0.0019 0.9976
16 0.0018 0.9995
17 0.0002 0.9997
18 0.0002 0.9998
19 0.0001 0.9999
20 3.33E-05 0.9999
21 3.67E-06 0.9999
22 5.27E-07 1

The cumulative variance contribution rate of the former 9 principal components can reach more than 95%. It was considered that these 9 principal components contained most of the information of wheat appearance features. The 22 features of wheat could be replaced by the 9 principal components in mathematical model building.

Pattern recognition

It can be seen from Table 5 that the average classification accuracy of 7 wheat varieties was 97%, which reached the expected result. The recognition accuracy of IEK was the highest (99%), and the recognition accuracy of FGKD was 92%. Because individual wheat that had both the characteristic information of FGDK and the other types of wheat, it was easy to cause classification errors when using the BP neural network model.

Table 5. Identification accuracy of wheat appearance quality based on BP neural network model.

Actual classification Average classification accuracy (%)
FGDK (%) BGK (%) MK (%) IEK (%) SK (%) DK (%) PK (%) Classification accuracy (%)
Prediction classification FGDK 92 0 0 3 0 3 2 92 97
BGK 0 98 0 2 0 0 0 98
MK 0 0 98 1 0 1 0 98
IEK 0 0 0 99 0 1 0 99
SK 0 0 0 1 97 1 1 97
DK 0 0 0 2 0 98 0 98
PK 0 0 0 1 1 0 98 98

It can be seen from Table 6 that the average classification accuracy of 7 wheat varieties was 91%, which was lower than the BP neural network model. The classification accuracy of IEK was the highest, which was 94%. The ranking of wheat category recognition accuracy from high to low will be found to be the same as that of BP neural network model, because the experimental wheat belonged to the same batch. The same result verified that the both model pattern recognition models were accurate for the wheat classification.

Table 6. Identification accuracy of wheat appearance quality based on SVM model.

Actual classification Average classification accuracy (%)
FGDK (%) BGK (%) MK (%) IEK (%) SK (%) DK (%) PK (%) Classification accuracy (%)
Prediction classification FGDK 88 0 0 8 0 2 2 88 91
BGK 0 92 0 4 2 0 2 92
MK 0 0 90 5 0 2 3 90
IEK 1 0 0 94 2 2 1 94
SK 0 2 0 1 90 3 4 90
DK 1 3 3 0 0 92 1 92
PK 1 2 0 2 1 1 93 93

The recognition model of wheat appearance quality was established by using BP neural network model and SVM model, and the recognition accuracy of the model was tested through the construction of training set and test set.


We proposed a solution that cohesive wheats could be separated by using the single kernel guide groove. The segmentation method of extracting wheat region by converting image to H channel was good, which could extract wheat region completely and processing speed was fast. After a series of image processing, the features of wheats were acquired and inputted to the BP neural network and SVM model, and the results showed that the recognition rate of BP neural network model was higher in the wheat appearance inspection. This shooting system can only shoot one side of wheat. We also need to improve the mechanical part to complete both sides of shooting wheat to improve the accuracy of recognition.

Declarations of Interest

The authors declare that there is no conflict of interest.


This work was supported by Jiangsu modern agriculture (wheat) industry technology system storage and processing innovation team (JATS [2019] 468), the National Natural Science Foundation of China (51975259).


Chen, S., Xiong, J., Guo, W., Bu, R., Zheng, Z., Chen, Y., Yang, Z., and Lin, R. 2019. Colored rice quality inspection system using machine vision. Journal of Cereal Science 88: 87–95. 10.1016/j.jcs.2019.05.010

Davies, E.R. 2009. The application of machine vision to food and agriculture: a review. Imaging Science Journal 57(4): 197–217. 10.1179/174313109X454756

Dhua, S., Kumar, K., Kumar, Y., Singh, L., and Sharanagat, V.S. 2021. Composition, characteristics and health promising prospects of black wheat: A review. Trends in Food Science and Technology 112: 780–794. 10.1016/j.tifs.2021.04.037

dos Santos, C.M., Escobedo, J.F., Teramoto, É.T., and da Silva, S.H.M.G. 2016. Assessment of ANN and SVM models for estimating-normal direct irradiation (Hb). Energy Conversion and Management 126: 826–836. 10.1016/j.enconman.2016.08.020

Femenias, A., Gatius, F., Ramos, A. J., Sanchis, V., and Marín, S. 2021. Near-infrared hyperspectral imaging for deoxynivalenol and ergosterol estimation in wheat samples. Food Chemistry 341: 128206. 10.1016/j.foodchem.2020.128206

Hamdi, A., Chan, Y.K., and Koo, V.C. 2021. A New Image Enhancement and Super Resolution technique for license plate recognition. Heliyon 7(11): e08341. 10.1016/j.heliyon.2021.e08341

Islabudeen, M., Vigneshwaran, P., Sindhu Madhuri, G., Muthu Kumar, B., Ragaventhiran, J., and Sharmila, G. 2021. Feature extraction of underwater images using principle component analysis with image registration. Materials Today: Proceedings. 10.1016/j.matpr.2021.03.341

Javanmardi, S., Miraei Ashtiani, S.H., Verbeek, F.J., and Martynenko, A. 2021. Computer-vision classification of corn seed varieties using deep convolutional neural network. Journal of Stored Products Research 92: 101800. 10.1016/j.jspr.2021.101800

Kaya, E., and Saritas, İ. 2019. Towards a real-time sorting system: Identification of vitreous durum wheat kernels using ANN based on their morphological, colour, wavelet and gaborlet features. Computers and Electronics in Agriculture 166: 105016. 10.1016/j.compag.2019.105016

Kiani, S., Minaei, S., and Ghasemi-Varnamkhasti, M. 2016. Fusion of artificial senses as a robust approach to food quality-assessment. Journal of Food Engineering 171: 230–239. 10.1016/j.jfoodeng.2015.10.007

Koklu, M., and Ozkan, I.A. 2020. Multiclass classification of dry beans using computer vision and machine learning techniques. Computers and Electronics in Agriculture 174: 105507. 10.1016/j.compag.2020.105507

Lei, B., and Fan, J. 2019. Image thresholding segmentation method based on minimum square rough entropy. Applied Soft Computing 84: 105687. 10.1016/j.asoc.2019.105687

Li, C., Zhang, X., Huang, Y., Tang, C., and Fatikow, S. 2020. A novel algorithm for defect extraction and classification of mobile phone screen based on machine vision. Computers & Industrial Engineering 146: 106530. 10.1016/j.cie.2020.106530

Li, L., Chen, S., Deng, M., and Gao, Z. 2022. Optical techniques in non-destructive detection of wheat quality: A review. Grain & Oil Science and Technology 5(1): 44–57. 10.1016/j.gaost.2021.12.001

Li, Y., Otsubo, M., Kuwano, R., and Nadimi, S. 2021. Quantitative evaluation of surface roughness for granular materials using Gaussian filter method. Powder Technology 388: 251–260. 10.1016/j.powtec.2021.04.068

Lin, X., Xu, J.L., and Sun, D.W. 2020. Evaluating drying feature differences between ginger slices and splits during microwave-vacuum drying by hyperspectral imaging technique. Food Chemistry 332: 127407. 10.1016/j.foodchem.2020.127407

Liu, R., Li, Y., Wang, H., and Liu, J. 2021. A noisy multi--objective optimization algorithm based on mean and Wiener filters. Knowledge-Based Systems 228: 107215. 10.1016/j.knosys.2021.107215

Liu, Z., Zhang, R., Yang, C., Hu, B., Luo, X., Li, Y., and Dong, C. 2022. Research on moisture content detection method during green tea processing based on machine vision and near--infrared spectroscopy technology. Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy 271: 120921. 10.1016/j.saa.2022.120921

Ma, J., Li, Y., Du, K., Zheng, F., Zhang, L., Gong, Z., and Jiao, W. 2020. Segmenting ears of winter wheat at flowering stage using digital images and deep learning. Computers and Electronics in Agriculture 168: 105159. 10.1016/j.compag.2019.105159

Mahanti, N.K., Pandiselvam, R., Kothakota, A., Ishwarya, S.P., Chakraborty, S.K., Kumar, M., and Cozzolino, D. 2022. Emerging non-destructive imaging techniques for fruit damage detection: Image processing and analysis. Trends in Food Science & Technology 120: 418–438. 10.1016/j.tifs.2021.12.021

Majumdar, S., and Jayas, D.S. 1999. Classification of Bulk Samples of Cereal Grains using Machine Vision. Journal of Agricultural Engineering Research 73(1): 35–47. 10.1006/jaer.1998.0388

Mohd Ali, M., Hashim, N., Aziz, S.A., and Lasekan, O. 2020. Emerging non-destructive thermal imaging technique coupled with chemometrics on quality and safety inspection in food and agriculture. Trends in Food Science & Technology 105: 176–185. 10.1016/j.tifs.2020.09.003

Ni, C., Wang, D., Vinson, R., Holmes, M., and Tao, Y. 2019. Automatic inspection machine for maize kernels based on deep convolutional neural networks. Biosystems Engineering 178: 131–144. 10.1016/j.biosystemseng.2018.11.010

Oliveira, M.M., Cerqueira, B.V., Barbon, S., and Barbin, D.F. 2021. Classification of fermented cocoa beans (cut test) using computer vision. Journal of Food Composition and Analysis 97: 103771. 10.1016/j.jfca.2020.103771

Pandiselvam, R., Mayookha, V.P., Kothakota, A., Ramesh, S.V., Thirumdas, R., and Juvvi, P. 2020. Biospeckle laser technique-A novel non-destructive approach for food quality and safety detection. Trends in Food Science & Technology 97: 1–13. 10.1016/j.tifs.2019.12.028

Qian, K., Bao, Y., Zhu, J., Wang, J., and Wei, Z. (2021). Development of a portable electronic nose based on a hybrid filter-wrapper method for identifying the Chinese dry-cured ham of different grades. Journal of Food Engineering 290: 110250. 10.1016/j.jfoodeng.2020.110250

Ravikanth, L., Singh, C.B., Jayas, D.S., and White, N.D.G. 2015. Classification of contaminants from wheat using near-infrared hyperspectral imaging. Biosystems Engineering 135: 73–86. 10.1016/j.biosystemseng.2015.04.007

Septiarini, A., Sunyoto, A., Hamdani, H., Kasim, A.A., Utaminingrum, F., and Hatta, H.R. 2021. Machine vision for the maturity classification of oil palm fresh fruit bunches based on color and texture features. Scientia Horticulturae 286: 110245. 10.1016/j.scienta.2021.110245

Shen, Y., Yin, Y., Li, B., Zhao, C., and Li, G. 2021. Detection of impurities in wheat using terahertz spectral imaging and convolutional neural networks. Computers and Electronics in Agriculture 181: 105931. 10.1016/j.compag.2020.105931

Singh, P., Bhandari, A.K., and Kumar, R. 2022. Naturalness-balance contrast enhancement using adaptive gamma with cumulative histogram and median filtering. Optik 251: 168251. 10.1016/j.ijleo.2021.168251

Srinivasa R.K., and Jaya, T. 2021. De-noising and enhancement of MRI medical images using Gaussian filter and histogram equalization. Materials Today: Proceedings. 10.1016/j.matpr.2021.03.144

Suresh K.P., Behera, H.S., Kumari, A.K., Nayak, J., and Naik, B. 2020. Advancement from neural networks to deep learning in software effort estimation: Perspective of two decades. Computer Science Review 38: 100288. 10.1016/j.cosrev.2020.100288

Tetila, E.C., Machado, B.B., Astolfi, G., Belete, N.A.d.S., Amorim, W.P., Roel, A.R., and Pistori, H. 2020. Detection and classification of soybean pests using deep learning with UAV images. Computers and Electronics in Agriculture 179: 105836. 10.1016/j.compag.2020.105836

Vithu, P., and Moses, J.A. 2016. Machine vision system for food grain quality evaluation: A review. Trends in Food Science and Technology 56: 13–20. 10.1016/j.tifs.2016.07.011

Wang, A., Zhang, W., and Wei, X. 2019. A review on weed detection using ground-based machine vision and image processing techniques. Computers and Electronics in Agriculture 158: 226–240. 10.1016/j.compag.2019.02.005

Yugander, P., Tejaswini, C.H., Meenakshi, J., Kumar, K.S., Varma, B.V.N.S., and Jagannath, M. 2020. MR Image Enhancement using Adaptive Weighted Mean Filtering and Homomorphic Filtering. Procedia Computer Science 167: 677–685. 10.1016/j.procs.2020.03.334

Zhang, H., Tang, Z., Xie, Y., Gao, X., and Chen, Q. 2019. A watershed segmentation algorithm based on an optimal marker for bubble size measurement. Measurement 138: 182–193. 10.1016/j.measurement.2019.02.005