automatic milled rice quality evaluation by image analysis

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

Upload: harpreet-kaur

Post on 24-Oct-2014

47 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Automatic Milled Rice Quality Evaluation by Image Analysis

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 andhigher accuracy, the challenge of developing newmethods is needed.

In rice quality evaluation, existing techniqueprocesses the grain samples in bulk[5] using neuralnetwork 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 ResearchCenter, 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 thequantity of headrice, broken kernels, and brewers in milled rice samples using six geometric features. Colorhistograms of rice kernels in RGB and Cielab color channels are used to extract 24 color features. A probabilisticneural network (PNN) is then used to classify rice kernels according to rice defectives using this color features. Theaccuracy of the classifier is 94%. Linear regression model is developed for estimating individual kernel weight givena blob area. We obtained a very promising result with a coefficient of determination, R2 of 0.991 between themeasured and estimated weight. The regression model may provide incorrect results when the blob area is less thanthe minimum threshold value(0.96mm2).

요 약

.6 , , . RGBCielab 24 .

. 94% ..

0.991 R2 .(0.96mm2) .

Key wordsMilled 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‧

Page 2: Automatic Milled Rice Quality Evaluation by Image Analysis

utilized successfully in the past, some informationcannot be extracted from the image sample. Thereason for this is because of the lack of informationabout the individual milled rice kernels. In[6], adifferent milled rice grading metrics is required todetermine the quality of milled rice. The standardsrequire that the number of kernels belonging to eachrice defectives and the total weight of rice kernels ineach category must be provided. Moreover, therepresentation of grade factors should be presented interms of weight ratio against the total milled riceweight sample. This paper attempts to fill the gapand solve this problem.

The goal of this paper is to a) develop aframework for reliable milled-rice quality evaluation byprocessing each individual rice kernel, b) build alinear regression model to correlate rice blob area(mm2) into weight(g) and, c)build a classifier fordetermining the grade factors.

The paper defines and describes milled ricedefectives and the new framework for automaticmilled rice quality evaluation. This paper is anextended version of the paper presented in theconference[11].

In this paper we discussed the overview of milledrice quality analysis. In section 2, we describe thematerials and methods used for milled rice analysisincluding image acquisition and feature extraction. Insection 3 discussed evaluation of results and section 4deals with the conclusion of our study.

In this section, we define the categories of milledrice quality. A brief overview about the proposedframework is discussed with its different subsystemsdescribed 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 lengthequal to or greater than 75% of the average length(grain size) of unbroken kernel. Broken kernels arekernels whose lengths are 75% of the grain size.Brewers are small pieces or particles of kernels thatpass through a sieve having round perforations of 1.4millimeters in diameter.

Different grades vary in terms of rice defectivescontents. For example, the premium grade of ricemust 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 1000grams). More information about rice defectives andgrading criteria can be found in reference[6].

The method for milled rice quality analysis consistsof the steps as shown in the block diagram of Fig 1.Stages for the rice quality evaluation are milled-riceimage acquisition, pre-processing for backgroundsegmentation, color blob extraction, classification ofrice kernels, estimating kernel weight from blob areas.

The consolidated grade factors in final stage isused to draw quality evaluation based on the criteriaspecified 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

Page 3: Automatic Milled Rice Quality Evaluation by Image Analysis

2.2.1 Image Acquisition

The image acquisition library, WIA SDK[7] is usedfor integrating image acquisition functionality to themilled rice quality evaluation software. Flatbed scanneris used for acquiring images providing a resolution of1391 x 1795 pixels in 24-bit uncompressed bitmapformat with vertical and horizontal resolution of 200pixels (7.87 pixels /mm). The library is capable ofacquiring image from any imaging devices.

2.2.2 Background Segmentation

The choice of correct background color prior toimage acquisition is critical. The color should be ableto create a maximum separation between the colorhistogram of the milled rice and its background. Tosuccessfully segment the background, a point-wisetransformation in Cielab color space is necessary usingD65 as the XYZ tristimulus reference value. Then,color values outside the threshold range are replacedwith zeros.

Fig 2 shows the result of the segmentation in RGB(a) and Cielab (b). In the left images, portions of thedamaged kernels (dark spots) were filtered togetherwith the background. Some of the features are lostand the classifier will not be able to detect somedefective type of kernels in the image. This casehappens for red and damaged kernels. As shown inthe figure to the right, all features are preservedwithout any loss of color features.

2.2.3 Color Blob Extraction

Color blob extraction is one of the most importantprocesses in our approach. It involves extracting colorpixels directly from the original image as a result ofconnected-component labeling in binary image.

In this paper, we ignore groups of touching ricekernels but we present a method for determining them.Touching kernels can be characterized by taking theratio of blob area against the inertial equivalent ellipse[8], [9].

1 1

1 ( , )M N

i jI i j

MNab

ζπ= ==∑ ∑

(1)

The numerator in computing the total number ofpixels in which ( , ) 0I i j ≠ . M and N are thedimension of the rice blob image, the denominator isthe total pixels inside the fitted ellipse, a and

b are the major and minor axis, of the fittedellipse, respectively, and ζ is the degree ofoverlap where 0 1ζ≤ ≤ . The degree of overlap

below the threshold value ( e.g., 0 .8 0ζ = ) isconsidered touching kernels and under goes furtherimage segmentation processing. Binary image of ricekernels above the threshold value will undergo featureextraction.

Another straightforward approach to touching ricekernel detection is to employ a priori informationabout the shape description s of rice image underanalysis. For example, we can determine in advancethe grain size or average length (see section 2.5) ofthe rice sample, and we know that the average lengthof long milled rice kernel[6] will never exceed 7.4mm with a blob area of around 13 mm2. Therefore,any rice blobs having an area larger than thisinformation could have been occluded rice kernel. Inthis paper, we use these known facts to decidewhether a blob under processing is occluded or not.

Page 4: Automatic Milled Rice Quality Evaluation by Image Analysis

2.2.4 Feature Extraction

This section discusses geometric features and colorfeatures extraction. Characterizations of rice kernels forin-depth analysis are performed by obtaining shapedescriptions and image statistics in RGB and Cielabcolor format. Extracted features from each milled ricekernel will be the basis for evaluating rice quality.

(1). Geometric FeaturesArea, perimeter, and length are important shape

parameters that determine the total number of kernelsin the image sample. They are described in thesucceeding paragraph.

Area, ( )A S :the area of a region in theplane is defined as

( ) ( , )x y

A S I x y d y d x= ∫ ∫ (2)

where ( , ) 1I x y = if the pixel is within a

shape, ( , )x y S∈ , and 0 otherwise. Inpractice, (2) can be discretized as

( ) ( , )x y

A S I x y A= Δ∑ ∑ (3)

where AΔ is the area of one pixel. Pixelaspect ratio is set to 1 ( 1AΔ = ).

Perimeter, ( )P S : if ( )x t and ( )y t

denote the parametric co-ordinates of a curveenclosing a region S, then the perimeter of the regionis defined as

2 2( ) ( ) ( )t

P S x t y t d t= +∫ (4)

Equation (4) refers to the sums of all theinfinitesimal 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 thelength of the edge boundary.

2 21 1( ) ( ) ( )i i i i

i

P S x x y y− −= − + −∑

(5)

where ix and iy represent the co-ordinates of the ith pixel forming the curve.

Major axis, a and minor axis, b: the informationabout the minor and major axis of the fitted ellipsecan be derived by first using the second order centralmoments to construct a covariance matrix. Theeigenvalues of this matrix can be easily calculatedusing 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 00M :

1 002a λ μ= (6)

2 002b λ μ= (7)

00 001 1

( , )M N

x yM I x yμ

= =

= = ∑∑ (8)

Note that (3) is the same as the blob area obtainedin (8) when 1AΔ = . Further details about thederivation of equation (6) and (7) is found in[9].

Feret diameter, dF , is the equivalent diameterof a circle having the same area as the object. It isdefined as:

4 ( )d

A SFπ

= (9)

Circularity, C : in order to characterize an

Page 5: Automatic Milled Rice Quality Evaluation by Image Analysis

object from different scale, it is important to useshape descriptions that do not depend on the size ofthe object on the image plane. Circularity is given by

2( )( )

P SCA 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 characterizerice kernels into broken, headrice, and brewer ricekernels.

(2) Color FeaturesImage statistics such as mean, variance, range, and

standard deviation for each channel in RGB (Red,Green, Blue) and Cielab (L, *a, *b) color space areused to describe the defectives classification of milledrice kernel. Initially, individual histograms are createdusing 256 bins in one-dimensional array. Pixels areexamined to identify their color values and thenincrement the corresponding bin positions accordingly.Statistical range, R, is defined as the difference of themaximum and minimum number of frequency in thehistogram, x :

m ax( ) m in( )R x x= − (11)

Other statistical measures are used in this paper aredefined as follows:

Mean:

1

1 N

ii

x xN =

= ∑ (12)

Standard Deviation:

( )2

1

1 N

ii

x xN

σ=

= −∑ (13)

Median is defined as the middle value in the image

histogram corresponding to the ( 1) / 2N + binposition.

( 1) / 2NM edian x += (14)Equation (11), (12), (13) and (14) are used to

obtain image statistics from each components of RGBand Cielab color spaces providing us with 24 colorfeatures.

2.2.5 ClassificationFrom the existing rice standards given in [6], the

grade factors of milled rice are determined byprocessing rice blobs as shown in Fig 3.

Total # of kernels, KT(sorted from longest to

shortest)

Broken,KB

Brewer,KW

Unbroken kernels5mm – 8mm

Headrice,KH

Top 80% of N

average length ,laveLi ≤ 0.75lave

Pieces of kernel whose diameter is 1.4mm

Li ≥ 0.75lave

Average grain size, avel is the average lengthof the top 80% of the sorted kernels from longest toshortest in rice sample, R. , , is the

sum of blob weight of headrice, broken kernels andbrewers, respectively.

1

1 ( ), N

a ve i S V Li

l K L L L LN =

= ≤ ≥∑ (15)

, ≥ (16)

, ≤ (17)

Page 6: Automatic Milled Rice Quality Evaluation by Image Analysis

, ≤ (18)

iL refers to the length of ith rice kernel,

SL is the minimum length of short rice kernel

(typical value is 5mm), V LL the maximum lengthof very long rice kernel whose value is typically 8

mm. The function (.)K is the regressionequation given in section 2.6. Alternatively, a direct

method to calculate BK is to subtract

HK from the total weight, TK , that is,

B T HK K K= − .Classification according to defectives categories

employs a neural network classifier which is a lotmore complicated than the approach used in (15) -(18) to determine grade factors that depend on shapeand size. We built a probabilistic neural networkclassifier consisting of 24 inputs and 7 outputs thatcorrespond to different rice defectives (see section 2.1)similar to the methods performed in[10]. As shown inTable 1, the total training data is 23,227 kernels.The dataset were randomly sampled, 75% for trainingdata 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 87Good 4081 3061 816 204Paddy(Palay) 1165 874 233 58Chalky 6506 4880 1301 325Discolored 4090 3068 818 204Immature 1866 1400 373 93Red Kernel 3762 2822 752 188

Total: 23227 17424 4644 1159

Validation set is used together with the training setto prevent over fitting of the PNN model. Moreover,we use the production set to test the accuracy of theclassifier in dealing with unseen data.

2.2.6 Linear Regression

In this paper, we develop a model to find arelationship for predicting the weight of rice given acalculated blob area (mm2) of rice kernel image. Theregression equation shown in (19) was obtained byactual measurements of 341 rice samples havingdifferent sizes, shapes, weights and belonging todifferent rice defectives categories. The resulting

coefficient of determination 2R was found to be0.991.

( ) 0 .1 6 5 0 .1 6 , A 1i i iK A A= − > (19)

In the above equation, K(Ai) is the weight of ithrice kernel in grams and Ai is the area of ith blobcomputed according to in terms of mm2.

A software implementation of the frameworkpresented in this paper is built in Microsoft VisualC#. Result showing background segmentation ispresented in Fig 4 below. We have not consideredsegmentation problem of touching grains in this study.It is assumed that rice kernels are properly positionedaway from each other so that no occlusion is present.Very small blobs and unnatural blob shapes areautomatically removed from the image.

Page 7: Automatic Milled Rice Quality Evaluation by Image Analysis

Fig 5 shows some of the extracted milled ricekernels. These rice kernels are analyzed individuallyby presenting respective color features to the neuralnetwork classifier in order to sort them according tograde factors.

By applying the regression model using thegeometric features, we obtained the estimated weightfor each rice kernels and calculated the accumulatedweight of kernels for each defectives category.Moreover, it becomes possible to count the number ofkernels. This is different from the conventional methodof performing neural network classification of ricegrains in bulk[5].

In the regression equation of (19), the minimum

acceptable value of blob area is, ≥ .

The model behaves as predicted when this condition issatisfied. However, even if the condition was notsatisfied, the impact to overall accuracy is very small.This occurrence can be prevented by ignoring riceblobs whose area is less than 1mm. Table 2 showsthe 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.0015.0 6.58 5.05 87.89 12.21 0.0006.0 6.52 6.14 90.40 9.60 -0.0017.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 theactual weight measurements of milled rice samples.Grain size, headrice, broken and brewer columns are

the result of calculating avel , HK , BK

and WK , respectively.

In this study, framework for automatic milled ricequality analysis is developed for automatic evaluationof milled rice quality.

Linear regression model developed in thisframework showed promising results by correlating thecalculated blob area (mm2) of milled rice grain intoweight in grams (g). However, good predictionaccuracy is limited to the range of training value of2.42 mm2 ~ 14.19 mm2; otherwise, estimated resultsmay provide incorrect results.

Selection of threshold value in Cielab color spaceduring background segmentation is crucial because itleads to loss of color features leading to rice kernelshaving dark spots. Consequently, it affects the resultof the estimated weight of the regression model. Inthe 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 directproportion. In future research, a good segmentationalgorithm capable of dealing with occluding groups oflong rice kernels is worth pursuing.

This work was supported by Research Grant fromHannam University(2009) and the Security EngineeringResearch Center, granted by the Korea Ministry ofKnowledge Economy.

Milled rice image samples, courtesy of the Bureauof Post-Harvest Research Extension, Muñoz City,Philippines.

Page 8: Automatic Milled Rice Quality Evaluation by Image Analysis

[1] I. Y. Zayas, C. R. Martin, J. L. Steele, and A.Katsevich, "Wheat classification using imageanalysis and crush force parameters," Transactionsof 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 ofnon-touching kernel images " BiosystemsEngineering, Vol. 99 pp. 330-337, 2008.

[3] B. Ni, M. R. Paulsen, K. Liao, and J. F. Reid,"Design of an automated corn kernel inspectionsystem for machine vision," Transactions of theASAE, Vol. 40, pp. 491 497, 1997.–

[4] B. K. Yadav and V. K. Jindal, "MonitoringMilling 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 usingneural networks," Canadian BiosystemsEngineering, 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 ofOccluding Groups of Grain Kernels in a GrainSample Image," Journal of AgriculturalEngineering Research, Vol. 79, pp. 159-166, 2001.

[9] R. Mukundan and K. R. Ramakrishnan, MomentFunctions in Image Analysis: Theory andApplications: World Scientific, 1998.

[10] O. C. Agustin and B. J. Oh, "Applications ofWard Network and GRNN for Corn QualityClassification," Journal of Korean Institute ofInformation Technology, Vol. 5, pp. 218-225,2007.

[11] O. C. Agustin and B. J. Oh, "Automatic MilledRice Quality Analysis," 2008 Second InternationalConference on Future Generation Communicationand Networking, Hainan, China, Vol. II, pp.112-115, Dec. 13~15, 2008.

Oliver C. Agustin

1995 : BSECE, WesleyanUniversity, Philippines2005 : MS, Hannam University1997 ~ 2000 : Lecturer,Wesleyan University,Philippines2005 ~ present : Graduate

student in Hannam UniversityInterest Area : Neural network applications, Computervision.

Oh, Byung-Joo

1976 : B.S. Electronic Eng.,Busan National University,

1983 : M.S. Electri. & ComputerEngineering, University of NewMexico.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, Facedetection and recognition, People counting.