Character Recognition Using Fuzzy c

Character Recognition Using Fuzzy c-Means Classification
K. Vipindas, Dr. K.P. Ravindran and Dr. N. Ramachandran*
Department of Mechanical Engineering
National Institute of Technology Calicut, India-673601.
[email protected] , [email protected], [email protected]
Abstract
The main challenge in character recognition is
infinite variety of writing styles of different individuals.
This paper proposes a feature extraction method and a
fuzzy logic based character recognition method. The
proposed feature vector is invariant under scaling and
translation of the character image. Its invariance
under small inclinations is also tested. Fuzzy c-Mean
classification and nearest center classifier methods are
used for recognition purpose. The effectiveness of the
adopted method is experimented with English
alphabets written in capital letters. Further, Bayesian
classifier method is chosen to compare the results of
the proposed method.
Keywords: Character recognition; Fuzzy c-Means
classification; Nearest center classifier; Multivariate
Bayesian classifier
1. Introduction
The objective of the character recognition is the
recognition of data that describe handwritten objects.
Character recognition is an area of pattern recognition
that is useful in many fields such as document analysis,
mailing address interpretation, bank check processing,
signature identification, document verification, etc.
Character recognition applications are either online or
offline. Online recognition systems use a pressure
sensitive pad that records the pen’s pressure and
velocity, which would be the case with for example, a
personal digital assistant. In offline recognition, the
system input is a digital image of characters.
There are several methodologies for character
recognition. These methods differ from each other in
the type of features used to describe the character and
in the recognition techniques. Types of features used in
the literature include geometrical, directional,
mathematical, and structural features. Statistical
analysis, structural analysis, pattern matching, neural
networks, fuzzy and genetic algorithms are some of the
recognition techniques. The major difficulty associated
with character recognition is in the infinite variety of
writing styles produced by different writers. Figure 1
shows an example of how different people write the
letter ‘A’. Character recognition is still a difficult task
and always human beings perform much better than
any computer system.
Figure. 1. The character ‘A’ written by different people
Sreela Sasi and Jatinder Singh Bedi [1] deal with
pattern recognition using fuzzy logic. In this work a
fuzzy processor is used which consists of a number of
IF………. THEN……… ELSE rules for character
analysis and character recognition. Further, these rules
are applied to output from the pattern extractor, which
will be in the form of a fuzzy matrix of all the cells
constituting a particular character and the cells are
combined using logical operators to form the character.
Romesh Ranawana et al [2] used min-max composition
for recognition purpose. Here, each character is divided
into number of segments. Further, each segment
possesses a certain number of characteristics for which
a fuzzy value can be assigned. In the recognition stage,
when a new character is given for recognition, the
numerical values are calculated which describe the
characteristics of the character. Then a query is
generated for the characters that have an identical
number of segments to the character just given for the
recognition purpose. Further, the character is
recognized using a min-max inference over the selected
characters produced by the previous query. Beatrice
Lazzerini, Francesco Marcelloni [3] presented LoaFer,
a linguistic fuzzy recognizer for off-line characters.
Qing Chen et al. [4] used Fourier descriptor and Hu’s
1
seven moment invariants for character recognition.
Carlos Aviles-Cruz, et al. [5] used a statistical
approach for character recognition, which is based on
fourth and third order moments. Yong Zhu et al., [6]
used a global texture analysis for texture analysis.
Here, Gabor filters are tuned at different frequencies
and orientations, leading to recognition. Zheru Chi, et
al. [7] used a self-organizing map and fuzzy rules for
numeral recognition. Further, the self-organizing
mapping algorithm produces prototypes, which
determine the fuzzy regions and fuzzy membership
functions. Furthermore, fuzzy rules are generated by
learning from training pattern. Abdelwahab Zramdini
and Rolf Ingold [8] used a statistical approach for
character recognition. In their work, global
typographical features are used to model the characters
and applied a multivariate Bayesian classifier for
classification. T.N. Tan [9] used rotation invariant
textures for script identification from document
images. In this, rotation invariant textures are
computed based on multi-channel Gabor filtering
technique and employed weighted Euclidean distance
classifier is used for classification.
In this paper, a feature vector that is invariant
under scaling and translation is used and is tested for
its invariance under small angles of rotation. This
method is similar to the method discussed in
Abdelwahab Zramdini and Rolf Ingold [8]. Compared
to this discussion where feature extraction is based on
horizontal and vertical projection profiles of text
images, here feature extraction is based on distribution
of character pixels in each zone. Most of the fuzzy
logic based character recognitions are based on rulebased systems. In the present work, for classification,
fuzzy c-mean partition technique and for recognition
nearest center classifier method are used. By using
these methods, the number of data required for
recognition is less as compared to rule-based systems.
Finally, a statistical method for recognition purpose
based on Bayes theorem is selected for comparison.
In this paper, the feature extraction method
and its invariance under scaling and translation is
briefly described. Then , a discussion on fuzzy c-mean
classification and defuzzification method is attempted.
Subsequently, nearest center classifier technique and
statistical method for character recognition is
expalined. Experimental results are discussed and
finally, conclusions are also presented.
2. Feature Extraction
Figure 2 shows a simple block diagram for
off-line character recognition. In this work, the
character to be analyzed is considered in a binary form
with BMP format.
Training
Feature
Extraction
Classifier
Samples
Test
Result
Feature
Extraction
Classifier
Clas
sifie
Figure. 2. Block diagram of off-line character
recognition system
In order to extract the features, the character image
is divided into three zones (Abdelwahab Zramdini and
Rolf Ingold, [8], Lu Da et al., [10]) the upper zone,
central zone and lower zone as shown in the figure 3.
In figure 3, ‘H’ represents the total height of the
character. Division of character is done in such a way
that the upper zone occupies 10% of the total character
pixels, the central zone occupies 80% and the lower
zone occupies 10% of the total character pixels. Thus, a
character can be represented with a feature vector
having three components, each component representing
number of character pixels in each zone.
Upper
zone
Central
zone
Lower
zone
10
H
% of H
80 %
of H
10 %
of H
Figure. 3. Structure of a Character
The above feature vector is invariant only under
translation, i.e., whenever the size of the character
changes, this method will give a different feature
vector for the same character. In order to make the
feature vector invariant under scaling, each component
of the above feature vector is divided by the total
number of character pixels. By doing this, the
distribution of the character pixels in each zone will be
obtained and this will be invariant under scaling. For
each character, the distribution of pixels in each zone
will be different. Hence, this feature vector can be used
to model a character.
3. Fuzzy c-Mean Classification
To develop fuzzy set methods in classification
(Timothy J. Ross, [11]; George J Klir / Bo Yuan, [12]),
define a family of sets { Ai , i = 1,2,..., c} as a fuzzy cpartition on a universe of data points, X. Since, fuzzy
sets allow for degrees of membership in various
classes, it is possible to extend the crisp classification
2
Initialize the partition matrix, U(0). Each step
in this algorithm will be labeled r. where r =
0,1……
(Hard c-Means classification) idea into a fuzzy
classification notion. Then membership to the various
data points in each fuzzy cluster can be assigned. Thus,
a single point can have partial membership in more
than one class.
2.
3.
3.1. Fuzzy c-Mean Algorithm
To describe a method to determine the fuzzy cpartition matrix U for grouping a collection of n data
sets into c classes, define an objective function Jm for a
fuzzy c-partition,
n
c
J m ( U ,v ) = å å ( m ik )m' ( dik )2
m ik( r +1 ) = 0
(1)
k = 1i = 1
1/ 2
(2)
is the membership function value of the k
th
data point in the ith class and vi is the ith cluster center.
Here the objective is to find the best clustering of
given data set. Since the objective function is given by
Jm, the best clustering is associated with the smallest
value of Jm. Because of the large number of possible
values in Jm, the optimum solution is to be obtained.
For this purpose, an iterative optimization technique
(Timothy J. Ross, [11]) is adopted in the present work.
In this optimization technique, we start with an initial
guess for the classification. Centers of the clusters are
then evaluated from this assumed classification, input
values for the number of classes, and iteration
tolerance. From these cluster centers, the membership
values that each data point has in the cluster are
recalculated. These values are compared with the
assumed values and continued this process until the
prescribed tolerance level is reached. The distance
measure, dik in equation (2) is the Euclidean distance
between the ith cluster center and the kth data set. The
parameter m¢ in (1) is called a weighting parameter.
This parameter controls the amount of fuzziness in the
classification process. The coordinates of the center of
the clusters are evaluated using the following equation,
n
å mikm'
vij = k =1n
åm
m'
ik
Algorithm:
1. Fix c ( 2 £ c < n ) and select a value for
parameter
for I k =f
(4)
for all classes i
= { i | 2 £ c £ n ; d ik( r ) = 0 }
(5)
(6)
I k = { 1,2 ,....., c } - I k
(7)
å mik( r +1 ) = 0
(8)
and
iÎI k
4.
If J m( r +1 ) ( U , v ) - J mr ( U , v ) < 0.0001 stop;
otherwise set r = r+1 and return to step 2.
3.2. Hardening the Fuzzy c-Partition
After fuzzy c-partition, next step is to defuzzify
the fuzzy partition. This defuzzification is required in
the ultimate assignment of data to a particular class.
There are several methods for defuzzification (Timothy
J. Ross, [11]). In this paper, maximum-membership
method for defuzzification is chosen. In the maxmembership method, the largest element in each
column of the U matrix is assigned a membership of
unity and all other elements in each column are
assigned a membership value of zero. ie.
m ik = max {m ik } then m ik = 1; m jk = 0 for all j ¹ i
jÎc
(9)
for i = 2,……..,c and k = 1,2,……….,n.
4. Recognition Method
.xkj
(3)
k =1
where, I k
-1
i ÎI k
where
ém
ù
dik = d ( xk - vi ) = ê å ( xkj - vij )2 ú
ë j =1
û
and
(r )
é c æ ( r ) ö 2 /( m' -1 ) ù
d
( r +1 ) ê
ú
mik = å ç ik( r ) ÷
ê j =1 ç d jk ÷
ú
ø
ë è
û
or
where,
mik
Calculate the c centers {vi } for each step.
Update the partition matrix for the rth step,
U (r ) as follows:
m' (here we have chosen 2).
In this paper, for recognition purpose nearest
center classifier (Timothy J. Ross, [11]) method is
used. The nearest center classifier works as follows.
Start with n known data samples, with each data
sample of m dimensions (here it is 3 dimensional).
Then cluster these samples into c classes using fuzzy c-
3
means approach as discussed in the previous section.
These fuzzy classes each has a class center, so
v = { v1 ,v2 ,.....,vc }
is a vector of c class centers. If we have a new sample,
the nearest center classifier is given by
d ( x ,vi ) = min {d ( x ,vk )}
(10)
1£k £c
and now the given sample is classified as belonging to
fuzzy partition.
4.1. Recognition based on statistical method
To compare the effectiveness of the proposed
method, a statistical recognition method based on
Bayesian classifier (Earl Gose, et al., [13]) is adopted.
In this work, the feature vector consists of 3
components and multivariate Bayesian classifier (Earl
Gose, et al., [13]) is selected for classification. For k
classes, here, Baye’s theorem is given by:
P (Ci / x ) =
P (C i ) P ( x / Ci )
P (C1 ) P ( x / C1 ) + P (C 2 ) P ( x / C 2 ) + .......... ..... + P (C k ) P ( x / C k )
(11)
For extending Baye’s theorem for multivariate
case, the multivariate normal density is substituted in
equation (11). Multivariate normal density (Richard A
Johnson, Dean W Wichern, [14]) is given by,
p( x ) =
1
( 2p )d det å
1
( x - m )T å -1 ( x -m )
2
e
and testing purpose and characteristic features are
evaluated.
For training, 20 samples of each letter were taken
from different individuals. These samples were used
for classification. For testing, another 20 different types
of ‘A’ are used. Figure 4 shows different types of ‘A’
used for testing and the results obtained using fuzzy
logic and statistical methods are shown in table 1 and
table 2 respectively. In order to test the scaling
invariance of the proposed feature vector, different font
sizes are used as shown in the figure 4. Writing the
letter at different positions on the workspace
incorporates translation invariance. In order to
implement rotation invariance under small inclinations,
small angles of rotation were given to the letters as
shown in the figure 4 (eg. Font type 12, 16, 17, 18, and
19). In table 1 the distances from the class centers of
letters ‘A’, ‘B’, ‘C’ are shown. Since, the distances
from the data points to the class center of ‘A’ is
minimum (shown in bold) as compared to the class
centers of ‘B’ and ‘C’ the proposed algorithm
recognizes all the letters as ‘A’. S observed from table
1, the fuzzy logic method is able to recognize all the 20
samples given for testing. Whereas, from table 2, it can
be seen that Baye’s classifier failed to recognize 14th
and 17th font types. Hence, the success rate based on
fuzzy logic method is 100%, while the success rate
based on statistical method is 90% for the given set of
samples.
(12)
where,
d – Number of components in the feature vector.
m - Mean vector.
å - Covariance matrix.
When a new character is given to the system, Baye’s
classifier determines the probability of membership of
this character with each class.
5. Experimental Results
The proposed algorithms were implemented in the
C++ language under Windows NT operating system.
The images considered in this work were generated by
Microsoft Paint software and then converted to binary
images. By using MS Paint, we can get variability in
character produced by different individuals. The size of
the workspace is limited to 100*100 pixels for
programming easiness. Among the English alphabets,
letters ‘A’, ‘B’, and ‘C’ are chosen for simulation.
These characters are written in MS Paint for training
Figure. 4. Different types ‘A’ used for testing
4
Table 1. Fuzzy logic method
section 2, experiments were carried out with 50%, 20%
and 30% of character pixels in upper, central and lower
zone. Figure 5 shows different types of letters ‘A’ and
‘V’ used for testing. Table 3 shows results obtained
before changing the proportion of each zone. From
table 3 we can see that all the 5 letters given for testing
are recognized as letter ‘A’. Table 4 shows results
obtained after changing the proportion of each zone.
From table 4, it can be observed that the first 3 letters
are classified as latter ‘V’ and last two letters as letter
‘A’. Hence, by changing the proportions of the zones
better results could be obtained.
Recognition Rate (Distance from
each class center)
A
B
C
Font
Type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0.060
0.017
0.059
0.075
0.024
0.013
0.037
0.027
0.063
0.079
0.042
0.053
0.049
0.067
0.092
0.018
0.094
0.036
0.046
0.031
0.146
0.105
0.140
0.170
0.112
0.099
0.122
0.088
0.125
0.165
0.116
0.149
0.062
0.133
0.184
0.114
0.095
0.092
0.142
0.115
0.509
0.455
0.505
0.528
0.474
0.460
0.485
0.452
0.446
0.529
0.480
0.500
0.428
0.498
0.545
0.472
0.385
0.432
0.498
0.478
Figure. 5. Different types of letters ‘A’ and ‘V’ used
for testing
Table 3. Recognition rate before changing each zone
proportion
10
99.97
99.98
18
19
20
99.98
9
99.99
99.98
17
8
99.36
16
7
0.014
15
99.98
14
6
99.99
99.99
13
100
12
45.91
11
89.30
100
5
99.80
4
99.99
3
99.98
2
100
Recognition
Rate
Font
Type
1
99.36
Recognition
Rate in %
Font
Type
99.60
Table 2. Statistical method
It is observed that, there are some difficulties in
recognizing between letters ‘A’ and ‘V’. If the feature
vector proposed in section 2 is used, feature vectors
will be same for these letters, because the distribution
of character pixel in each zone is almost same. Hence,
the recognition system fails to classify these letters and
thus results in wrong recognition. This difficulty can be
resolved by changing the proportion of pixels in each
zone. Instead of using 10%, 80% and 10% of character
pixels in upper, central and lower zone as described in
Font Type
1
2
3
4
5
Recognition Rate
(Distance from each
class center)
A
V
0.767
0.629
0.802
0.664
0.837
0.699
0.804
0.666
0.781
0.643
Table 4. Recognition rate after changing each zone
proportion
Font Type
1
2
3
4
5
Recognition Rate (Distance
from each class center)
A
V
0.142
0.017
0.158
0.050
0.119
0.034
0.147
0.030
0.159
0.072
Since most of the fuzzy logic based character
recognition is concentrated on rule-based systems,
number of data required is large as compared to the
proposed method. Romesh Ranawana, et al., [2] used a
database that contains information about characters, the
number of segments and individual characteristics of
5
the segments. Therefore, the database consists of two
main tables called Characters and Segments. In the
present work using fuzzy c-means classification,
number of data required is less as compared to fuzzy
rule based system and hence may be faster.
6. Conclusions
In this paper, an efficient method for
typographical analysis of a character to improve the
character classification and recognition performance is
proposed. Each character is divided into three zones
and a feature vector was extracted based on the
distribution of character pixels in each zone. The
performance of the recognition system based on fuzzy
c-means classification and nearest centre classifier is
tested and compared with statistical method. For
obtaining characters with different font size, translation
and small degrees of rotation, different individuals are
used to generate the characters. The results show
satisfactory performance. However, there were some
difficulties in recognizing characters like ‘A’ and ‘V’,
for which the distribution of the pixels in each zone is
almost equal. To overcome this difficulty, it is
suggested to modify the proportion of pixels in each
zone by changing the zone size.
7. References
[1].Sreela Sasi and Jatinder Singh Bedi, 1994. Handwritten
Character Recognition using Fuzzy Logic, IEEE
Proceedings of the 37th Midwest Symposium on
Circuits and
Systems, Volume: 2, 3-5 Aug1994,
Pages: 1399 - 1402.
[2]. Romesh Ranawana, Vasile Palade and G.E.M.D.C.
Bandara, 2004. An Efficient Fuzzy Method for
Handwritten Character Recognition. 8th International
Conference on
Knowledge-Based Intelligent
Information & Engineering Systems, 22-24 September
2004,
URL:
http://web.comlab.ox.ac.uk/oucl/work/romesh.ranawana
/KES2004.pdf.
[3]. Beatrice Lazzerini, Francesco Marcelloni, 2000. A
Linguistic Fuzzy Recognizer of Off-Line Handwritten
Characters. Pattern Recognition Letters 21, Pages: 319327.
[4]. Qing Chen, Emil Petriu and Xiaoli Yang, 2004. A
Comparative Study of Fourier Descriptors and Hu’s
Seven Moment Invariant for Image Recognition. IEEE
Canadian
Conference on Electrical and Computer
Engineering. Volume:1, 2-5 May 2004, Pages: 103 106.
[5]. Carlos Aviles-Cruz, Risto Rangel-Kuoppa, Mario ReyesAyala, A. Andrade-Gonzalez, Rafael Escarela-Perez,
2005. High-order statistical texture analysis-font
recognition applied. Pattern Recognition Letters 26,
Pages: 135-145.
[6]. Yong Zhu, Tienieu, and Yunhong Wang, 2001. Font
Recognition Based on Global Texture Analysis. IEEE
transactions on Pattern Analysis and Machine
Intelligence. Vol. 23, No.10, October 2001, Pages: 1192
- 1200.
[7]. Zheru Chi, Jing Wu and Hong Yan, 1995. Handwritten
Numeral Recognition Using Self-Organized Maps and
Fuzzy Rules. Pattern recognition, Vol. 28, No.1, 1995,
pp 59- 66.
[8]. Abdelwahab Zramdini and Rolf Ingold, August 1998.
Optical Font Recognition
Using Typographical
Features. IEEE transactions on Pattern Analysis and
Machine Intelligence, Vol. 20, No. 8, Pages: 877 – 882.
[9]. T.N. Tan, 1998. Rotation Invariant Texture Features and
Their Use in Automatic Script Identification. IEEE
transactions on Pattern Analysis and Machine
Intelligence. Vol. 20, No. 7, August 1998 Pages: 751 –
756.
[10]. Lu Da, Brendan McCane and Pu Wei, 2001. Character
Preclassification Based on Fuzzy
Typographical
Analysis. IEEE Proceedings of Sixth International
Conference on Document Analysis and Recognition.
10-13 Sept 2001, Pages: 74 - 78.
[11]. Timothy J. Ross, 1997. FUZZY LOGIC WITH
ENGINEERING
APPLICATION,
McGraw-Hill
International Edition, Singapore.
[12]. George J Klir / Bo Yuan, 2001. FUZZY SETS AND
FUZZY LOGIC Theory and Applications, Fourth
printing, Printice-Hall of India, New Delhi.
[13]. Earl Gose, R, Johnsonbaugh and Steve Jost, 2002.
Pattern Recognition and Image Analysis, Third printing,
Printice-Hall of India, New Delhi.
[14]. Richard A Johnson, Dean W Wichern, 2001. Applied
Multivariate Statistical Analysis, Third Edition,
Printice-Hall of India, New Delhi.
6