= =
=
(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
(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.