Anda di halaman 1dari 8

Image processing methods facilitate the objective,

non-destructive and low-cost assessment of wheat[1],


cereal grain[2], corn[3], and rice[4]. Because of the
demand for effectiveness, consistency, faster speed and
higher accuracy, the challenge of developing new
methods is needed.
In rice quality evaluation, existing technique
processes the grain samples in bulk[5] using neural
network model. Although this approach has been
Oliver C. Agustin*, Byung-Joo Oh*
This work was supported by Research Grant from Hannam University(2009) and the Security Engineering Research
Center, granted by the Korea Ministry of Knowledge Economy
Abstract
This paper proposes an automatic evaluation method for the quality of milled rice. Shape descriptors determine the
quantity of headrice, broken kernels, and brewers in milled rice samples using six geometric features. Color
histograms of rice kernels in RGB and Cielab color channels are used to extract 24 color features. A probabilistic
neural network (PNN) is then used to classify rice kernels according to rice defectives using this color features. The
accuracy of the classifier is 94%. Linear regression model is developed for estimating individual kernel weight given
a blob area. We obtained a very promising result with a coefficient of determination, R2 of 0.991 between the
measured and estimated weight. The regression model may provide incorrect results when the blob area is less than
the minimum threshold value(0.96mm2).

.
6 , , . RGB
Cielab 24 .
. 94% .
.
0.991 R2 .
(0.96mm2) .
Key words
Milled rice analysis, milled rice classification, linear regression, probabilistic neural network
* Department of Electronic Engineering, Hannam University.
First Author: Oliver C. Agustin, Corresponding Author: Byung-Joo Oh
Received: November 28, 2008, Revised: 1 - December 24, 2008, Accepted: June 10, 2009
utilized successfully in the past, some information
cannot be extracted from the image sample. The
reason for this is because of the lack of information
about the individual milled rice kernels. In[6], a
different milled rice grading metrics is required to
determine the quality of milled rice. The standards
require that the number of kernels belonging to each
rice defectives and the total weight of rice kernels in
each category must be provided. Moreover, the
representation of grade factors should be presented in
terms of weight ratio against the total milled rice
weight sample. This paper attempts to fill the gap
and solve this problem.
The goal of this paper is to a) develop a
framework for reliable milled-rice quality evaluation by
processing each individual rice kernel, b) build a
linear regression model to correlate rice blob area
(mm2) into weight(g) and, c)build a classifier for
determining the grade factors.
The paper defines and describes milled rice
defectives and the new framework for automatic
milled rice quality evaluation. This paper is an
extended version of the paper presented in the
conference[11].
In this paper we discussed the overview of milled
rice quality analysis. In section 2, we describe the
materials and methods used for milled rice analysis
including image acquisition and feature extraction. In
section 3 discussed evaluation of results and section 4
deals with the conclusion of our study.
In this section, we define the categories of milled
rice quality. A brief overview about the proposed
framework is discussed with its different subsystems
described in details.
Rice quality defectives are classified as discolored,
chalky, broken, immature, red, and damaged kernels.
Headrice is a kernel or piece of kernel with its length
equal to or greater than 75% of the average length
(grain size) of unbroken kernel. Broken kernels are
kernels whose lengths are 75% of the grain size.
Brewers are small pieces or particles of kernels that
pass through a sieve having round perforations of 1.4
millimeters in diameter.
Different grades vary in terms of rice defectives
contents. For example, the premium grade of rice
must not contain more than 5% broken, 0.1% brewers,
0.5% damaged, 0.5% discolored, 4% chalky, 0.2%
immature, 1% red kernel, 10% paddy (per 1000
grams). More information about rice defectives and
grading criteria can be found in reference[6].
The method for milled rice quality analysis consists
of the steps as shown in the block diagram of Fig 1.
Stages for the rice quality evaluation are milled-rice
image acquisition, pre-processing for background
segmentation, color blob extraction, classification of
rice kernels, estimating kernel weight from blob areas.
The consolidated grade factors in final stage is
used to draw quality evaluation based on the criteria
specified in[6].
Image Acquisition
(uncompressed
RGB)
Background
Segmentation
(CieLab)
Color Blob
Extraction
Classification
(Defectives)
Area Weight
Linear Regression
Features
Extraction
1
2
3
4
5
6
Quality
Evaluation
Result
2.2.1 Image Acquisition
The image acquisition library, WIA SDK[7] is used
for integrating image acquisition functionality to the
milled rice quality evaluation software. Flatbed scanner
is used for acquiring images providing a resolution of
1391 x 1795 pixels in 24-bit uncompressed bitmap
format with vertical and horizontal resolution of 200
pixels (7.87 pixels /mm). The library is capable of
acquiring image from any imaging devices.
2.2.2 Background Segmentation
The choice of correct background color prior to
image acquisition is critical. The color should be able
to create a maximum separation between the color
histogram of the milled rice and its background. To
successfully segment the background, a point-wise
transformation in Cielab color space is necessary using
D65 as the XYZ tristimulus reference value. Then,
color values outside the threshold range are replaced
with zeros.
Fig 2 shows the result of the segmentation in RGB
(a) and Cielab (b). In the left images, portions of the
damaged kernels (dark spots) were filtered together
with the background. Some of the features are lost
and the classifier will not be able to detect some
defective type of kernels in the image. This case
happens for red and damaged kernels. As shown in
the figure to the right, all features are preserved
without any loss of color features.
2.2.3 Color Blob Extraction
Color blob extraction is one of the most important
processes in our approach. It involves extracting color
pixels directly from the original image as a result of
connected-component labeling in binary image.
In this paper, we ignore groups of touching rice
kernels but we present a method for determining them.
Touching kernels can be characterized by taking the
ratio of blob area against the inertial equivalent ellipse
[8], [9].
1 1
1
( , )
M N
i j
I i j
MN
ab

= =
=

(1)
The numerator in computing the total number of
pixels in which
( , ) 0 I i j
. M and N are the
dimension of the rice blob image, the denominator is
the total pixels inside the fitted ellipse,
a
and
b are the major and minor axis, of the fitted
ellipse, respectively, and

is the degree of
overlap where
0 1
. The degree of overlap
below the threshold value ( e.g.,
0 . 8 0 =
) is
considered touching kernels and under goes further
image segmentation processing. Binary image of rice
kernels above the threshold value will undergo feature
extraction.
Another straightforward approach to touching rice
kernel detection is to employ a priori information
about the shape description s of rice image under
analysis. For example, we can determine in advance
the grain size or average length (see section 2.5) of
the rice sample, and we know that the average length
of long milled rice kernel[6] will never exceed 7.4
mm with a blob area of around 13 mm2. Therefore,
any rice blobs having an area larger than this
information could have been occluded rice kernel. In
this paper, we use these known facts to decide
whether a blob under processing is occluded or not.
2.2.4 Feature Extraction
This section discusses geometric features and color
features extraction. Characterizations of rice kernels for
in-depth analysis are performed by obtaining shape
descriptions and image statistics in RGB and Cielab
color format. Extracted features from each milled rice
kernel will be the basis for evaluating rice quality.
(1). Geometric Features
Area, perimeter, and length are important shape
parameters that determine the total number of kernels
in the image sample. They are described in the
succeeding paragraph.
Area,
( ) A S
:the area of a region in the
plane is defined as
( ) ( , )
x y
A S I x y d y d x =

(2)
where
( , ) 1 I x y =
if the pixel is within a
shape,
( , ) x y S
, and 0 otherwise. In
practice, (2) can be discretized as
( ) ( , )
x y
A S I x y A =

(3)
where A is the area of one pixel. Pixel
aspect ratio is set to 1 ( 1 A = ).
Perimeter,
( ) P S
: if
( ) x t
and
( ) y t
denote the parametric co-ordinates of a curve
enclosing a region S, then the perimeter of the region
is defined as
2 2
( ) ( ) ( )
t
P S x t y t d t = +

(4)
Equation (4) refers to the sums of all the
infinitesimal arcs that define the curve. In discrete
case,
( ) x t
and
( ) y t
are defined by a set of
pixels in the image and will be equivalent to the
length of the edge boundary.
2 2
1 1
( ) ( ) ( )
i i i i
i
P S x x y y

= +

(5)
where i
x
and i
y
represent the co-
ordinates of the ith pixel forming the curve.
Major axis, a and minor axis, b: the information
about the minor and major axis of the fitted ellipse
can be derived by first using the second order central
moments to construct a covariance matrix. The
eigenvalues of this matrix can be easily calculated
using quadratic formula, the major axis and minor
axis of an ellipse where 1 2
>
and 00

is the second order central moments, also equivalent


to the first raw moment 00
M
:
1 00
2 a =
(6)
2 00
2 b =
(7)
00 00
1 1
( , )
M N
x y
M I x y
= =
= =

(8)
Note that (3) is the same as the blob area obtained
in (8) when 1 A = . Further details about the
derivation of equation (6) and (7) is found in[9].
Feret diameter, d
F
, is the equivalent diameter
of a circle having the same area as the object. It is
defined as:
4 ( )
d
A S
F

=
(9)
Circularity, C : in order to characterize an
object from different scale, it is important to use
shape descriptions that do not depend on the size of
the object on the image plane. Circularity is given by
2
( )
( )
P S
C
A S
=
(10)
where P(S) and A(S) are given in(3) and(5),
respectively.
Geometric features obtained in (3), (5), (6), (7), (9)
and(10) determine the shape and size that characterize
rice kernels into broken, headrice, and brewer rice
kernels.
(2) Color Features
Image statistics such as mean, variance, range, and
standard deviation for each channel in RGB (Red,
Green, Blue) and Cielab (L, *a, *b) color space are
used to describe the defectives classification of milled
rice kernel. Initially, individual histograms are created
using 256 bins in one-dimensional array. Pixels are
examined to identify their color values and then
increment the corresponding bin positions accordingly.
Statistical range, R, is defined as the difference of the
maximum and minimum number of frequency in the
histogram,
x
:
max( ) min( ) R x x =
(11)
Other statistical measures are used in this paper are
defined as follows:
Mean:
1
1
N
i
i
x x
N
=
=

(12)
Standard Deviation:
( )
2
1
1

N
i
i
x x
N

=
=

(13)
Median is defined as the middle value in the image
histogram corresponding to the
( 1) / 2 N +
bin
position.
( 1) / 2 N
Median x
+
=
(14)
Equation (11), (12), (13) and (14) are used to
obtain image statistics from each components of RGB
and Cielab color spaces providing us with 24 color
features.
2.2.5 Classification
From the existing rice standards given in [6], the
grade factors of milled rice are determined by
processing rice blobs as shown in Fig 3.
Total # of kernels, KT
(sorted from longest to
shortest)
Broken,K
B
Brewer,K
W
Unbroken kernels
5mm 8mm
Headrice,K
H
Top 80% of N
average length ,lave L
i
0.75l
ave
Pieces of kernel whose
diameter is 1.4mm
Li 0.75lave
Average grain size, ave
l
is the average length
of the top 80% of the sorted kernels from longest to
shortest in rice sample, R. K
H
, K
L
, K
W
is the
sum of blob weight of headrice, broken kernels and
brewers, respectively.
1
1
( ),
N
ave i S VL
i
l K L L L L
N
=
=

(15)
K
H

i 1
N
K(L
i
), L
i
|
cc
(16)
K
L

i 1
N
K(L
i
), L
i
0.7 |
cc
(17)
K
W

i 1
N
K(L
i
), L
i
1.40:: (18)
i
L
refers to the length of ith rice kernel,
S
L
is the minimum length of short rice kernel
(typical value is 5mm), VL
L
the maximum length
of very long rice kernel whose value is typically 8
mm. The function
(.) K
is the regression
equation given in section 2.6. Alternatively, a direct
method to calculate B
K
is to subtract
H
K
from the total weight, T
K
, that is,
B T H
K K K =
.
Classification according to defectives categories
employs a neural network classifier which is a lot
more complicated than the approach used in (15) -
(18) to determine grade factors that depend on shape
and size. We built a probabilistic neural network
classifier consisting of 24 inputs and 7 outputs that
correspond to different rice defectives (see section 2.1)
similar to the methods performed in[10]. As shown in
Table 1, the total training data is 23,227 kernels.
The dataset were randomly sampled, 75% for training
data in column 3, 20% as validation set in column 4,
and the remaining 5% are production set in column 5.
Categories # of Sample Training(%) Valid.(%) Prod(%)
Damaged 1757 1319 351 87
Good 4081 3061 816 204
Paddy(Palay) 1165 874 233 58
Chalky 6506 4880 1301 325
Discolored 4090 3068 818 204
Immature 1866 1400 373 93
Red Kernel 3762 2822 752 188
Total: 23227 17424 4644 1159
Validation set is used together with the training set
to prevent over fitting of the PNN model. Moreover,
we use the production set to test the accuracy of the
classifier in dealing with unseen data.
2.2.6 Linear Regression
In this paper, we develop a model to find a
relationship for predicting the weight of rice given a
calculated blob area (mm2) of rice kernel image. The
regression equation shown in (19) was obtained by
actual measurements of 341 rice samples having
different sizes, shapes, weights and belonging to
different rice defectives categories. The resulting
coefficient of determination
2
R was found to be
0.991.
( ) 0.165 0.16, A 1
i i i
K A A = >
(19)
In the above equation, K(Ai) is the weight of ith
rice kernel in grams and Ai is the area of ith blob
computed according to in terms of mm2.
A software implementation of the framework
presented in this paper is built in Microsoft Visual
C#. Result showing background segmentation is
presented in Fig 4 below. We have not considered
segmentation problem of touching grains in this study.
It is assumed that rice kernels are properly positioned
away from each other so that no occlusion is present.
Very small blobs and unnatural blob shapes are
automatically removed from the image.
Fig 5 shows some of the extracted milled rice
kernels. These rice kernels are analyzed individually
by presenting respective color features to the neural
network classifier in order to sort them according to
grade factors.
By applying the regression model using the
geometric features, we obtained the estimated weight
for each rice kernels and calculated the accumulated
weight of kernels for each defectives category.
Moreover, it becomes possible to count the number of
kernels. This is different from the conventional method
of performing neural network classification of rice
grains in bulk[5].
In the regression equation of (19), the minimum
acceptable value of blob area is, A
i
0.90::
2
.
The model behaves as predicted when this condition is
satisfied. However, even if the condition was not
satisfied, the impact to overall accuracy is very small.
This occurrence can be prevented by ignoring rice
blobs whose area is less than 1mm. Table 2 shows
the result of applying our classification
Measured(g) GrainSize(mm) Estimated(g)* HeadRice(%) Broken(%) Brewers(%)
4.5 6.73 4.49 75.73 24.27 0.001
5.0 6.58 5.05 87.89 12.21 0.000
6.0 6.52 6.14 90.40 9.60 -0.001
7.0 6.5 7.09 82.83 17.17 -0.001
Note *Estimated is the weight prediction using the the regression model. The last
three columns are expressed in terms of percentage
scheme as discussed in 2.5. The first column is the
actual weight measurements of milled rice samples.
Grain size, headrice, broken and brewer columns are
the result of calculating ave
l
, H
K
, B
K
and W
K
, respectively.
In this study, framework for automatic milled rice
quality analysis is developed for automatic evaluation
of milled rice quality.
Linear regression model developed in this
framework showed promising results by correlating the
calculated blob area (mm2) of milled rice grain into
weight in grams (g). However, good prediction
accuracy is limited to the range of training value of
2.42 mm2 ~ 14.19 mm2; otherwise, estimated results
may provide incorrect results.
Selection of threshold value in Cielab color space
during background segmentation is crucial because it
leads to loss of color features leading to rice kernels
having dark spots. Consequently, it affects the result
of the estimated weight of the regression model. In
the color filtering range in Cielab having L={0-255},
a={0-165} and b={0-255}, if the range of a increased,
e.g. {0-175}, the predicted weight increases in direct
proportion. In future research, a good segmentation
algorithm capable of dealing with occluding groups of
long rice kernels is worth pursuing.
This work was supported by Research Grant from
Hannam University(2009) and the Security Engineering
Research Center, granted by the Korea Ministry of
Knowledge Economy.
Milled rice image samples, courtesy of the Bureau
of Post-Harvest Research Extension, Muoz City,
Philippines.
[1] I. Y. Zayas, C. R. Martin, J. L. Steele, and A.
Katsevich, "Wheat classification using image
analysis and crush force parameters," Transactions
of the ASAE, Vol. 6, pp. 2199-2004, 1996.
[2] R. Choudhary, J. Paliwal, and D. S. Jayas,
"Classification of cereal grains using wavelet,
morphological, colour, and textural features of
non-touching kernel images " Biosystems
Engineering, Vol. 99 pp. 330-337, 2008.
[3] B. Ni, M. R. Paulsen, K. Liao, and J. F. Reid,
"Design of an automated corn kernel inspection
system for machine vision," Transactions of the
ASAE, Vol. 40, pp. 491 497, 1997.
[4] B. K. Yadav and V. K. Jindal, "Monitoring
Milling Quality of Rice by Image Analysis,"
Computers and Electronics in Agriculture, Vol. 33,
pp.19-33, December 2001.
[5] N. S. Visen, J. Paliwal, and N. D. G. White,
"Image analysis of bulk grain samples using
neural networks," Canadian Biosystems
Engineering, Vol. 46, pp. 7.11-7.15, 2004.
[6] "Philippine Grains Standardization Program,"
National Food Authority, 2002.
[7] Microsoft WIA Library, http://msdn. microsoft.
com /en-us/ library/ ms630827 (VS. 85). aspx
[8] N. S. Visen, N. S. Shashidhar, J. Paliwal, and D.
S. Jayas, "Identification and Segmentation of
Occluding Groups of Grain Kernels in a Grain
Sample Image," Journal of Agricultural
Engineering Research, Vol. 79, pp. 159-166, 2001.
[9] R. Mukundan and K. R. Ramakrishnan, Moment
Functions in Image Analysis: Theory and
Applications: World Scientific, 1998.
[10] O. C. Agustin and B. J. Oh, "Applications of
Ward Network and GRNN for Corn Quality
Classification," Journal of Korean Institute of
Information Technology, Vol. 5, pp. 218-225,
2007.
[11] O. C. Agustin and B. J. Oh, "Automatic Milled
Rice Quality Analysis," 2008 Second International
Conference on Future Generation Communication
and Networking, Hainan, China, Vol. II, pp.
112-115, Dec. 13~15, 2008.
Oliver C. Agustin
1995 : BSECE, Wesleyan
University, Philippines
2005 : MS, Hannam University
1997 ~ 2000 : Lecturer,
Wesleyan University,
Philippines
2005 ~ present : Graduate
student in Hannam University
Interest Area : Neural network applications, Computer
vision.
Oh, Byung-Joo
1976 : B.S. Electronic Eng.,
Busan National University,
1983 : M.S. Electri. & Computer
Engineering, University of New
Mexico.
1988 : Ph.D, Electrical &
Computer Engineering,
University of New Mexico.
1988 ~ 1992. 2 : Senior Researcher, ETRI.
1992 ~ Present : Professor in Electronic Engineering,
Hannam University.
Interest Area : Adaptive control, Neural network,
Fuzzy logic, Robot control and vision, Face
detection and recognition, People counting.

Anda mungkin juga menyukai