Proceeding of the 5
th
International Symposium on Mechatronics and its Applications (ISMA08), Amman, Jordan, May 2729, 2008
ISMA081
WAVELETBASED FEATURE EXTRACTION TECHNIQUE FOR FRUIT SHAPE CLASSIFICATION
Slamet Riyadi, Asnor Juraiza Ishak, Mohd Marzuki Mustafa, Aini Hussain
Universiti Kebangsaan Malaysia Department of Electrical, Electronics and System Engineering Bangi 43600 Selangor Malaysia
riyadi@vlsi.eng.ukm.my
ABSTRACT
For export, papaya fruit should be free of defects and damages. Abnormality in papaya fruit shape represents a defective fruit and is used as one of the main criteria to determine suitability of the fruit to be exported. This paper describes a waveletbased technique used to perform feature extraction to extract unique features which are then used in the classification task to discriminate deformed papaya fruits from well formed fruits using image processing approach. The extracted features, when used in the classification task using linear discriminant analysis (LDA), afford accuracy of more than 98%.
1.
INTRODUCTION
Prior to export, fruits such as papayas are subjected to inspection. In the case of the papaya fruits, high grade papayas should have uniform size prior to packaging and free from defects and damages on their surfaces [1]. Presence of defect can be detected which includes detection of deformed papaya shape as shown in Figure 1(b). Currently, fruit inspection processes are performed manually. Manual inspection involves labor intensive work and the decision made can be very subjective depending on the mood and condition of the person involved. Furthermore, this manual procedure can be very time consuming and inefficient especially when dealing with high production volume. (a) (b) Figure 1.
Example of wellformed and deformed of papaya shape
Machine vision system has been used extensively in the food and agricultural industries due to quality inspection and grading [2] & [3]. Many of these vision based inspection systems rely on color, texture and/or shape information. In developing the machine vision system for papaya fruit inspection, shape will be the best basis for inspection. The most popular technique in shape recognition and used by many researchers is the Fourier Descriptor (FD). Tao et al indicated that the first seven FD coefficients are sufficient to represent the boundary for shape discrimination of potatoes [4]. Heinemann et al [5] and Noordam et al [6] have developed an automated machine vision for shape classification of potatoes. Another successful work using FD was reported by Paulus et. al. on shape classification of apple [7]. However, since FD is obtained by decomposition of an integral expression over the whole object boundary then its capability to locate different singularity is questionable. In addition, local and sharp irregularities of boundary are not well captured by Fourier analysis [8]. Alternatively, a recent signal processing technique such as wavelet has shown great promise to solve this kind of problem. In the last decade, wavelet has become a powerful tool for shape representation and discrimination of various objects. ParisiBaradad et al studied the robustness and affine of wavelet transform to discriminate five species of otolith shape [8]. Rube et al introduced a new waveletbased function which is affine and invariant for shape representation [9]. The proposed waveletbased method by Shen et al has the ability to classify seemingly similar 2D objects with subtle differences [10]. Generally, implementation of wavelet in shape classification produces wavelet coefficients which represent the boundary of object. In this paper, discrete wavelet transform (DWT) is used to decompose the papaya image contour using a simple mother of wavelet, Daubechies1. Some basic statistical properties of the wavelet coefficients are then computed and used as feature vectors to discriminate between wellformed and deformed papaya using LDA.
2.
METHODOLOGY
This classification technique involves procedures which can be summarized in Figure 2
.
2.1.
Data Acquisition
Papaya samples of various sizes were collected from an orchard. Immediately after harvest, the fruits were quickly transported to the laboratory so that the fruits can be digitally weighed and measured. The images of papayas were then captured at random orientation from perpendicular views. The camera was setup in a fixed position to get an appropriate silhouette of the object as shown in Figure 3. A bright yellow paper was used as background surface to facilitate and simplify the segmentation task.
Proceeding of the 5
th
International Symposium on Mechatronics and its Applications (ISMA08), Amman, Jordan, May 2729, 2008
ISMA082
Figure 2.
The classification process
Figure 3.
The image acquisition set up
2.2.
Image Preprocessing
The preprocessing task involves some procedures to prepare the image to be ready for image processing. Firstly, the images were normalized to produce uniformity in term of image size and to reduce the processing time. The srcinal image with 640x480 dimensions was resized to be one third of its normal size. Then, the RGB image was converted to grayscale level and followed by segmentation using Otsu method to distinguish the papaya object and the background. The segmented blackwhite image is then converted to its contour.
2.3.
Contour Signature
In this work, papaya shape is determined by detecting its boundary which is defined as the contour signature. As such, contour signature represents the boundary pixel coordinates
C
n
(
x
n
,
y
n
) for every single pixel
n
at boundaries, where
x
n
is the row coordinate and
y
n
is the column coordinate of
n
th boundary pixel. To have an elaborate feature, the contour signature is decomposed by defining it in terms of the row and column components. Graphical displays of the contour signature components in which both plots of the row and column signatures for both wellformed and deformed papayas, are as shown in Figure 4(a) and 4(b), respectively. It can be observed that the column signatures for wellformed and deformed papaya shapes differ where as the row signatures are similar. The column signature of wellformed shape has relatively smooth signature curve as compared to the deformed shape signature. The difference, although noticeable, is still difficult to use for the task to discriminate between the two shapes. Figure 4.
Contour signatures of (i) row and (ii) column for (a) wellformed papaya (b) deformed shaped papaya
2.4.
Wavelet Representation
Wavelet transforms the signal into timescale representation. In wavelet analysis, a scalable modulated window is shifted along the signal and for every position the spectrum is calculated. A scalable modulated window, or also known as mother of wavelet, is the key point in which wavelet can be used to represent discontinuities or sharp spikes of a signal. The transform is defined by a series of wavelet coefficients which are generated using the wavelet mother function of equation (1)
⎟ ⎠ ⎞⎜⎝ ⎛ −=
abt at
ba
ψ ψ
1
)(
,
(1) where
a
is scaling parameter,
b
is a shifting parameter, and
a
1/2
is for energy normalization across the different scales. The continuous wavelet transform of function
f
(
t
) is then computed using equation (2)
∫
∞∞−
=
dt t t f baC
ba
)()(),(
,
ψ
(2) Since the parameters {
a
,
b
} are continuous value, the transform is called continuous wavelet transform (CWT). Wavelet transform can be performed efficiently using discrete wavelet transform (DWT) [11]. Having a discrete function
f
(
n
), the DWT can be obtained using equation (3).
∑
∈
==
Z nk j
nn f k jC baC
)()(),(),(
,
ψ
(3) where
k j
,
ψ
is a discrete wavelet which is defined by
Papaya contour
0501001502030405060708090Row signatureNo. of boundary pixel
R o w o f b o u n d a r y p i x e l
0501001503035404550556065Column signatureNo. of boundary pixel
C o l u m n o f b o u n d a r y p i x e l
(a) (i) (ii)
Papaya contour
0100200102030405060708090100Row signatureNo. of boundary pixel
R o w o f b o u n d a r y p i x e l
010020001020304050Column signatureNo. of boundary pixel
C o l u m n o f b o u n d a r y p i x e l
(b) (i) (ii) Data acquisition Image preprocessing 
Resizing 
Segmentation using Otsu’s method

Boundary detection & contour signature extraction
Image processing and features extraction 
DWT 
Statistical properties extraction Wellformed and deformed shape classification using LDA
Object Camera
Proceeding of the 5
th
International Symposium on Mechatronics and its Applications (ISMA08), Amman, Jordan, May 2729, 2008
ISMA083
)()(
/ ,
k nn
j jk j
−=
−−
22
2
ψ ψ
(4) To be useful, wavelet transform should be applied with a fast algorithm such as multiresolution analysis. In term of signal processing, this analysis is called pyramidal or subband coding algorithm which decomposes
a signal into hierarchical set of approximation and details coefficients as depicted by Figure 5.
At each level
j
, DWT builds approximation at level
j
,
cA
j
, and detail at level
j
,
cD
j
. Approximation coefficients are obtained by convolving the signal with the lowpass filter Lo_D, whereas the detail coefficients are convolved with the highpass filter Hi_D, followed by dyadic decimation. The algorithm is graphically depicted in Figure 6.
S = signal
Figure 5.
Hierarchical set of DWT coefficients
Figure 6.
The algorithm of DWT to determine wavelet coefficients
In this work, this algorithm has been applied on the previously extracted contour signatures of the papaya image to decompose into its approximate and detail coefficients. Figure 7 depicts example of the graphical display of the approximation and detail coefficients at level 1 when DWT was applied to the signature contour of papaya image. Since the approximation was obtained by lowpass filtering, these coefficients cannot represent the presence of nonsmooth part of the signature contour. The detail coefficients which correspond to the high frequency components are more appropriate to be used and supposed to have discriminant information.
2.5.
Statistical Properties Extraction
Next, the extracted detail coefficients of both row and column signatures are processed further in which three basic statistical properties are computed. The computed statistical properties are sum, standard deviation (STD) and mean of the detail coefficients for both row and column signatures. Feature fusion approach is then adopted by fusing two statistical properties at a time. Graphically, these fused features are shown in the form of scatter plots shown in Figure 8. The fused feature pairs are (a) sumstandard deviation
(
SumSTD) (b) SumMean and (c) standard deviationmean
(STDmean).
0200400050100150Row signatureNo. of boundary
R o w o f b o u n d a r y
010020000.0050.010.015No. of boundary
A 1 c o e f f i c i e n t
010020042024x 10
5
No. of boundary
D 1 c o e f f i c i e n t
0200400406080100120Colomn signatureNo. of boundary
C o l u m n o f b o u n d a r y
01002004681012x 10
3
No. of boundary
A 1 c o e f f i c i e n t
010020010.500.51x 10
4
No. of boundary
D 1 c o e f f i c i e n t
(a)
0100200020406080100Row signatureNo. of boundary
R o w o f b o u n d a r y
05010000.0050.010.015No. of boundary
A 1 c o e f f i c i e n t
05010010.500.51x 10
4
No. of boundary
D 1 c o e f f i c i e n t
010020001020304050Colomn signatureNo. of boundary
C o l u m n o f b o u n d a r y
05010000.0050.010.015No. of boundary
A 1 c o e f f i c i e n t
05010021012x 10
4
No. of boundary
D 1 c o e f f i c i e n t
(b) Figure 7.
Graphical display of DWT coefficients of contour signature, (a). wellformed shape, (b). deformed shape
2.6.
Linear Classification
The fused features are then used to discriminate the papaya according to its shape whether it is deformed or wellformed. In this work, we have used LDA to perform the shape classification task [12]. As seen in Figure 8, all three fused feature pairs formed were able to form two separate clusters representing the wellformed and deformed papaya shapes. The results of feature fusion indicate that the extracted fused feature pairs can characterize the papaya shape uniquely resulting in two distinct characteristics of wellformed and deformed shapes. Having these distinct features, shape classification is made simple and as such there is no need for a complex classifier. Consequently, the LDA technique was used to automatically perform the task. The following linear function was used
Signal Hi_D Lo_D
Proceeding of the 5
th
International Symposium on Mechatronics and its Applications (ISMA08), Amman, Jordan, May 2729, 2008
ISMA084
y(x
1
, x
2
) = w
T
[x
1
x
2
] + c = 0
(5) where
w
is the weight vector,
c
is a constant value
.
The
variables
x
1
and
x
2
represent the fused feature pairs. In the case of sumSTD features fusion,
x
1
represents sum and
x
2
represents STD of the detail coefficients. Figure 8.
Scatter plot of features fusion and its linear discriminant line
3.
RESULTS
In this study, a total of 30 images consisting of wellformed and deformed shapes were used for training to determine the discriminant function and another 538 images were used for testing. All images in the database were captured using the same data acquisition set up. Firstly, the selected samples of wellformed and deformed papayas were classified and used as reference for the expert visual inspector. Then, the rest of the images were classified using the predetermined linear function obtained during training. For all three cases of fused feature pairs, the linear functions work well as shown in Figure 8. During training, three discriminant lines were obtained using equation (3) for each of the fused feature pairs. The linear discriminant function for sumSTD fused features pair is 9
x
1
+ 0.481
x
2
+ 7.508 = 0 (6) where
x
1
and
x
2
represent sum and the standarddeviation of the detail coefficients, respectively. The linear discriminant function for the second pair is 9
x
1
+ 0.590
x
2
+ 6.747 = 0
(7)
where the sum and mean of detail coefficients are represented by
x
1
and
x
2
, respectively. The next linear discriminant function is obtained for the STDmean fused pair. 3.190
x
1
+ 1.513
x
2
– 43.299 = 0
(8) where
x
1
is the standarddeviation and
x
2
is the mean of the detail coefficients. To discriminate the shape, we implemented the following rules:
For discriminant function (6) and (7) If
y
> 0 then papaya shape = wellformed else papaya shape = deformed For discriminant function (8) If
y
< 0 then papaya shape = wellformed else papaya shape = deformed
The results of papaya shape classification using the fused features pairs are tabulated in Table 1. The classification results for the fused features pairs of sumSTD and summean yield similar result. The best classification result was obtained using the fused feature pair of STDmean. Table 1. Result of papaya shape classification % classification accuracy Pair fused features Wellformed Deformed Total SumSTD 100 97.03 98.51 SumMean 100 97.03 98.51 STDMean 100 99.70 99.35
4.
CONCLUSIONS
This paper has described the use of wavelet transform and feature fusion to perform papaya shape classification for possible implementation of papaya fruits inspection system. DWT was applied to the contour signature of papaya made of the boundary information. Three basic statistical properties (i.e. sum, standard deviation (STD) and mean) were extracted from the wavelet detail coefficients and next, feature fusion approach was adopted. The three fused features pairs are the sumSTD, summean and STDmean. All three derived feature sets can be regarded successful since classification using them as input features yield an almost perfect classification of more than 98%. In conclusion, this work has successfully extracted useful and meaningful features to uniquely represent shapes for classification purposes.
50055060065070075080078910111213Sum of D1
S T D o f D 1
Deformed shapeWellformed shape
9
x
1
+0.481
x
2
+7.508=0
(a)
500550600650700750800567891011Sum of D1
M e a n o f D 1
Deformed shapeWellformed shape
9
x
1
+0.590
x
2
+6.747=0
789101112135.566.577.588.599.51010.5STD of D1
M e a n o f D 1
Deformed shapeWellformed shape
3.190
x
1
+1.513
x
2
–43.299=0
(c) (b)
Proceeding of the 5
th
International Symposium on Mechatronics and its Applications (ISMA08), Amman, Jordan, May 2729, 2008
ISMA085
5.
ACKNOWLEDGMENT
The authors would like to acknowledge the Ministry of Science, Technology and Innovation Malaysia (Project No. 030102SF0178) for the support of this research.
6.
REFERENCES
[1]
Federal Agricultural Marketing Authority: Quality guidelines series of Exotica Papaya,
www.famaexchange.org
, in Malay (2004) [2]
T. Brosnan and D.W. Sun. Inspection and grading of agricultural and food products by computer vision system – a review.
Computer and Electronics in agriculture
, 36 : 193 – 213. 2002. [3]
Blasco, J., Aleixos, N. and Molto, E. Computer vision detection of peel defects in citrus fruit by means of a region oriented segmentation algorithm.
Journal of Food Engineering
81(2007): 535 – 543. 2007. [4]
Tao, Y., Morrow, C.T., Heinemann, P.H. and Sommer H.J. III, “Fourierbased separation technique for shape grading of potatoes using machine vision”,
Transaction of ASAE
. Vol 38, pp. 949 – 957, 1995 [5]
P.H. Heinemann, N.P. Pathare and Ch.T. Morrow: An automated inspection station for machinevision grading of potatoes,
Machine Vision and Applications Journal
, 9, 1419. 1996. [6]
Noordam, J.C., Otten, G.W., Timmermans, A.J.M., and Zwol, B. van, "Highspeed potato grading and quality inspection based on a color vision system",
Proceeding of SPIE  Machine vision application in industrial inspection VIII
, pp 206 – 217, 2000. [7]
Paulus, I., Busscher, R.D and Schrevens, E., ”Use of image analysis to investigate human quality classification of apple“,
Journal of Agric. Engng Res
Vol 68, pp 341 – 353, 1997. [8]
ParisiBaradad, V., Lombarte, A., GarciaLadona, E., Cabestany, J., Piera, J and Chic, O., “Otolith shape contour analysis using affine transformation invariant wavelet transform and curvature scale space representation”,
Marine and Freshwater Research
, Vol 56, pp 795 – 804, 2005 [9]
Rube, I., Ahmed, M. and Kamel, M., “Wavelet approximationbased affine invariant shape representation functions“,
Transaction on Pattern Analysis and Machine Intelligent
, Vol 28:2, pp. 323 – 327, 2006 [10]
Shen, D. and Horace, H.S. “Discriminative wavelet shape descriptor for recognition of 2D patterns”,
Pattern Recognition
32, pp 151 – 165, 1999 [11]
Mallat, S.G., “A theory for multiresolution signal decomposition: The wavelet representation”,
IEEE Transaction on Pattern Recognition and Machine Intelligent
, Vol. 11, No 7, pp. 674693, 1989. [12]
Pydipati, R., Burks, T.F. and Lee, W.S. Identification of citrus disease using color features and discriminant analysis.
Computer and Electronics in Agriculture
52(2006): 49 – 59. 2006.