Professional Documents
Culture Documents
FPGA-based Real-Time Citrus Classification System
FPGA-based Real-Time Citrus Classification System
Cesar Torres-Huitzil
Josue Jimenez-Arteaga
CINVESTAV-Tamaulipas,
Instituto de Estudios Superiores
Ciudad Victoria, Tamaulipas, Mexico
de Tamaulipas,
Universidad Politecnica de Victoria,
Email: ctorres@tamps.cinvestav.mx Av. Dr. Burton E. Grossman 501 Pte,
Av. Nuevas Tecnologas 5902,
Altamira, Tamaulipas, Mexico
Ciudad Victoria, Tamaulipas, Mexico
Email: josue.jimenez@icest.edu.mx
Email: {mnunom,yhernandezm}@upv.edu.mx
I. I NTRODUCTION
Currently, the state of Tamaulipas is the second larger
producer of citrus in Mexico. In 2011, the total production
was approximately 500,000 tonnes [1]. Post-harvest treatment
has become an essential stage in the marketing of fresh fruits
in order to maintain the freshness of the product and reach
the consumer in the best conditions. Commonly, citrus quality
grading is performed by humans manually by visual inspection
of external visible criteria, such as size, shape and color.
Manual inspection implies several problems to maintain consistency in grading and uniformity in sorting due to observer
subjectivity. Thus an embedded automatic vision system for
citrus classication in the industry is highly desirable.
An automatic citrus grading machine based on computer
vision faces some technical issues, such as: 1) high resolution
images make difcult to apply image processing operators in
real-time (30 fps); 2) accurate classication demands very high
computational resources and since the application requires
a high-performance embedded implementation, conventional
computer and traditional microcontrollers are unsuitable for
implementing the classication system. However, image preprocessing operations can be performed using a dedicated
hardware implementation, which might exhibit a faster processing, by performing several tasks in parallel with the
additional advantages of low power consumption and small
size [2]. Considering the latter issues, FPGAs are suitable
for the addressed application since they potentially provide
c 2014 IEEE
978-1-4799-2507-0/14/$31.00
and green (a*) and its position between yellow and blue (b*).
Conversion of the RGB image pixel values to the CIELab color
space is performed in two stages [9]. Firstly, a conversion of
RGB image pixel values to the CIE-XYZ tri-stimulus values
is performed by using the matrix transformation given by
equation 1.
0.412
X
Yt = 0.213
Z
0.019
0.358
0.715
0.119
0.180
R
0.072 G
0.950
B
(1)
(4)
(t)1/3 ,
7.787t + 16/116,
if (t > 0.008856)
if (t 0.008856)
(5)
B. Spatial ltering
Image spatial ltering consists in displacing a lter mask,
w(x, y), over every pixel f (x, y) of an image. At each pixel
coordinate (x, y), the response of the lter mask w(x, y) is
calculated by a predened relationship, given by a sum of
products. For a mask of m n, it can be assumed that m =
2a+1 and n = 2b+1, where a and b are non-negative integers.
In general, lineal ltering of an image f of M N pixels with
a lter mask of m n is given by equation 6 [10]:
g(x, y) =
a
b
w(s, t)f (x + s, y + t)
(6)
s=a t=b
D. Binary morphology
Erosion is one of the two basic operators in the area of
mathematical morphology, the other one being dilation. The
basic effect of erosion on a binary image is to reduce the
boundaries of regions of foreground pixels. The basic effect
of dilatation on a binary image is to enlarge the boundaries
of regions of foreground pixels. When an erosion operator
is applied to an image, followed by dilation, it is called a
morphological opening lter [11]. The opening lter is used
to smooth contours (round corners), reduce image noise, and
separate objects in narrow areas.
E. Pixel Classication
For the compactness of the proposed architecture, a very
simple scheme is proposed. Every pixel of the original image
masked by the binarized image is compared to 5 xed color
patterns. The pattern with the largest number of pixels is the
nal classication given to the object. In cases where none of
the color patterns have the largest number of the pixels, an
unknown color is assigned by the classier.
III. P ROPOSED SYSTEM
A. System Overview
The proposed citrus classication architecture has 6 hardware modules that implements the algorithm briey described
in section II. Figure 1 shows the dataow and conguration
of the main blocks of the proposed system.
B. Modules of the proposed architecture
In this section, only the complex modules of the proposed
architecture are explained. The thresholding module is excluded due to its simplicity. Only three modules are explained
in detail, because Gaussian Filtering, Mean Filtering, and
Opening are performed by three different instances of the same
module, each one with a different conguration.
1) RGB to CIELab Module: This module takes as input
the RGB pixels of the input image and converts them to the
CIELab color space, where only the b* component is used.
In gure 2, the internal structure of this module is shown.
For the proposed operation, a xed-point representation is
used. The xed point format used is U (16, 16), which is
suitable to perform the required mathematical operations with
an acceptable error. Constants for equation 5 are computed
at compilation time. To compute the cube root, a LUT is
implemented, each value using the U (16, 16) representation.
The main components of this module are:
Cube Root Module LUT (LU T CBRT ). To optimize
hardware resource utilization, the input range is divided
into 512 values. The cube root is computed and stored in
each RAM location.
Address Translation Module (Y and Z). This module
performs the conversion of each input value to a valid
address where its cube root is stored.
Combinational Components Module. This module comprises a Comparator (C), a Multiplexer (M), a Multiplier
(X), an Adder (+) and a Subtractor (-).
IV. R ESULTS
The implemented prototype was tested under a controlled
environment, aiming to develop a fruit selection system for
the citrus industry. To reduce the image processing needed,
Resource
Utilization
(Total)
Slice
registers
(184,307)
Slice
LUTs
(92,152)
Occupied
Slices
(23,038)
18KB
BlockRAMs
(268)
DSP48A1
Slices
(180)
RGBCIELab
Gaussian
or median
ltering
174
Pixel
classif.
Overall
75
Morphological
lt
163
94
735
480
735
718
523
4,550
125
274
189
175
1,714
28
25
64
(b) Binarization of 5a
(c) Classication of 5a
(e) Binarization of 5d
(f) Classication of 5d