0% found this document useful (0 votes)
91 views6 pages

Optical Character Recognition of Handwri PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views6 pages

Optical Character Recognition of Handwri PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October-2013 236

ISSN 2229-5518

Optical character recognition for printed text in


Devanagari using ANFIS

1) Prof. Sheetal A. Nirve 2) Dr. G. S. Sable


Dept. Of Electronics & Comm. Principal of savitribai phule women’s
DIEMS, Aurangabad, engineering college, sharnapur
Maharashtra, India Aurangabad, Maharashtra,
[email protected] India

Abstract: In India, more than 300 million people use Devanagari script for documentation. There has been a significant improvement in the
research related to the recognition of printed as well as handwritten Devanagari text in the past few years. An attempt is made to address the
most important results reported so far and it is also tried to highlight the beneficial directions of the research till date. In this paper we propose an
efficient image retrieval technique which uses dominant color and texture features of an image. Though, Affine Moment invariant technique is
well experimented by many researchers, an attempt is made to enhance the existing results by extracting various supportive features
like moments invariant, vector Gradient, chain code(freeman chain code) image thinning, structuring the image in box format, noise removal, etc.
A performance of approximately 90% correct recognition is achieved.

IJSER
Keywords— Optical Hindi character recognition (OCR), Data set, Affine Moment invariants Rotation, neural network (NN) training of NN,
Recoganisation.

1. INTRODUCTION
Character recognition is the process to classify the input recognition of printed Marathi vowels and consonants is
character according to the predefine character class, with proposed. The OCR has been tested on samples from
increasing the interest of computer applications, modern various magazines and newspapers.
society needs the input text into computer readable form.
This research is a simple approach to implement that 2. LITERATURE SURVEY
dream as the initial step to convert the input text into The United States Postal Services has been using OCR
computer readable form. Some research for hand written machines to sort mail since 1965 based on technology
characters are already done by researchers with artificial devised primarily by the prolific inventor Jacob Rainbow.
neural networks. Digital document processing is gaining In 1965 it began planning an entire banking system,
popularity for application to office and library automation, National Giro, using OCR technology, a process that
revolutionized bill payment systems in the UK. Then in
bank and postal services, publishing houses and
1970’s efforts were initiated by Sinha at Indian Institute of
communication technology. English Character Recognition
Technology, Kanpur. A syntactic pattern analysis system
(CR) has been extensively studied in the last half century for Devanagari script recognition is presented in Sinha’s
and progressed to a level, sufficient to produce technology Ph.D. thesis. AnotherOCRsystem development of printed
driven applications. But same is not the case for Indian Devanagari is by Palit and Chaudhuri as well as Pal and
languages which are complicated in terms of structure and Chaudhuri. A team comprising Prof. B. B. Chaudhuri, U.
computations. In OCR domain, it is now widely accepted Pal, M. Mitra, and U. Garain of Indian Statistical Institute,
Kolkata, developed the first commercial level product for
that a single feature extraction method and single
printed Devanagari OCR. The same technology has been
classification algorithm can’t yields better performance
transferred to Center for Development for the Advance
rate. Neural networks and fuzzy logic are two Computing (CDAC) in 2001 for commercialization and is
complimentary technologies which are used in pattern marketed as “Chitrankan”. An approach based on the
recognition process. There are two type of neural network, detection of “shirorekha” is proposed by Chaudhuri and
feedback and feed forward.It is therefore, a compound Pal with the assumption that the skew of such header lines
feature extraction approach based on soft computing for show the skew of the whole document. Initially the
IJSER © 2013
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October-2013 237
ISSN 2229-5518

connected component labeling in the document is done.


form consonants followed by consonant ‘ . We can use
The required estimate of skew angle is obtained by
averaging of angles between the horizontal line and the almost any consonant in place of ‘ and write over 100
lines joining the first pixel of the leftmost line segment and conjuncts.
the last pixel of the rightmost line segment of each line.
There are some documents called multi skew documents in
which the text lines are not parallel to each other. An
Fig. (a)
approach, which is an extension to that of is proposed for
skew estimation in multi skew documents. Das and
Chanda also proposed a fast and script-independent skew Fig. (b)
estimation technique based on mathematical morphology. Fig. 3.2: Characters and Symbols of DevanagariScript; (a) the
Garain and Chaudhuri presented another technique for modifier symbols attached to the consonant to indicate
identification and segmentation of touching machine- their placing; (b) Some sample Conjunctions
printed Devanagari characters. Garain and Chaudhuri
presented another technique for identification and 3.1) Problem definition:
segmentation of touching machine-printed Devanagari As we know that recognition of character is not easy task.
characters. Due to various font sizes and writing style it is difficult to
recognize the character. Also in Devnagari script, many
. characters have similar shape, which creates trouble in
recognition. There for instead of utilizing single feature we
3. SYSTEM DEVELOPMENT are using various features like GLCM, color dominant, affine
movement invariant and Histogram.
The letter order of Devanagari, like nearly all Brahmi 3.2 Tools required for system:

IJSER
scripts, is based on phonetic principles that consider both the
manner and place of articulation of the consonants and vowels 3.2.1 MATLAB
they represent. This arrangement is usually referred to as the
varanmala "garland of letters". MATLAB (matrix laboratory) is a numerical
computing environment and fourth-generation programming
language. Allows matrix manipulations, plotting of functions
and data, implementation of algorithms, creation of user
interfaces, and interfacing with programs written in other
languages, including C, C++, Java, and Fortran. An additional
package, Simulink, adds graphical multi-domain simulation
and Model-Based Design for dynamic and embedded systems.
For my project I am using MATLAB 2010b version is used.

3.2.2 GUI

Fig.3.1 (a) i)GUI (Graphic user Interface):

MATLAB supports developing applications with


graphical user interface features. It also has tightly integrated
graph-plotting features. The structure of application m-files
generated by the MATLAB GUI development environment
Fig. 3.1 (b) and some Techniques for inclusion of Java components and
Fig. 3.1 Vowels, consonants and modulators of Devanagari Active X controls into MATLAB. In our project we use this
script GUI for reorganization of Devanagari character. In this GUI
there are 7 buttons, 8 labels and 6 panels are used for different
Devanagari script has about 14 vowels and 33 consonants. As purpose.
well as some modifiers are used to modifie the vowels and
consonants to form new words or sentences. The vowels and the
consonants are shown in figure 3.1.l. (a) and (b) respectively. In
English as well as in Marathi, the vowels are used in two ways:
1. They are used to produce their own sounds. The vowels
shown in are used for this purpose in Devanagari.
2. They are used to modify the sound of a consonant.
A consonant in pure form always touches the next character,
yielding conjuncts, touching characters, or fused characters. Fig 3.3: Used GUI
Fig3.1.2 (a) shows the consonant with modifiers and Fig. 3.3 proposed character recognition system:
3.1.2 (b) shows some of the conjuncts formed by writing pure
IJSER © 2013
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October-2013 238
ISSN 2229-5518

3.3.1 Data base generation: Fig. 3.5 conversion of original image

ii)Median Filtering :
Scanning process introduces irregularities such as
speckle noise and salt and pepper noise in the output image.
Noise reduction (also called smoothing or noise filtering) is
one of the most important processes in image processing.
Median Filter is used in this study due to its edge preserving
feature.

iii)Removal of header line:

By using following command top line can be removed,

“[cut plan retimg] = remtopline(img,bwimg); “

Fig. 3.4: Block dia. of proposed system


3.3.2 Image Pre-Processing:

In imaging science, image processing is any form of

IJSER
signal processing for which the input is an image, such as a
i).Binary image ii).Top line removed
photograph or video frame; the output of image processing
may be either an image or a set of characteristics or
parameters related to the image. Most image-processing Fig. 3.7 Top line removed image
techniques involve treating the image as a two-dimensional
signal and applying standard signal-processing techniques to 3.4 Feature extraction:
it.

i) Converting Color image to gray scale to binary image: 3.4.1 Exact computation of geometric moments:

In present technology, almost all image capturing


Regular or geometric moments of order (p + q) for
and scanning devices use colour. A colour image consists of a
coordinate matrix and three colour matrices. Coordinate image intensity function f(x,y) are defined as m pq=
matrix contains x, y coordinate values of the image. The ∞ ∞
colour matrices are labelled as red (R), green (G), and blue ∫−∞ ∫−∞ 𝑥 𝑝 𝑦 𝑞 𝑓(𝑥, 𝑦)𝑑𝑥𝑑𝑦, (1)
(B). Techniques presented in this study are based on grey
scale images, and therefore, scanned or captured colour
images are initially converted to grey scale using the with p,q >= 0. A digital image of size M × N is an array of
following equation: pixels. Centers of these pixels are the points (xi,yj), where the
image intensity function is defined only for this discrete set of
Gray colour = 0.299*Red + 0.5876*Green +0.114*Blue points
(xi,yj) ϵ [0,M _ 1] × [0,N _ 1].
Δxi = xi+1 _ xi, Δyj = yj+1 _ yj are sampling intervals in the x-
The scanned image was first converted from RGB scale to
and y-directions, respectively. In the literature of digital image
gray-scale. It was then splitted into individual character blocks
processing, the intervals Δxi and Δyj are fixed at constant
using MATLAB script to obtain raw individual character
values Dxi = 1, and Δyj = 1, respectively. Therefore, the set of
samples. The following pre-processing and noise removal
points (xi,yj) will be defined as follows:
techniques were used on raw samples to obtain a clean 1
dataset. For converting to binary threshold value is taken x i =(i- 2 )Δx, (2.1)
1
automatically. y j =(j-2 )Δy, (2.2)
with i = 1, 2, 3, . . . , M and j = 1, 2, 3, . . . , N. For the
discrete-space version of the image, Eq. (1) is usually
approximated as
𝑝 𝑞
M̅ [x] =∑𝑀 𝑁
𝑖=1 ∑𝑗=1 𝑥𝑖 𝑦𝑗 ΔxΔy (3)
Eq. (3) is the so-called direct method for geometric moment’s
computations, which is the approximated version using zeroth-
i).Original image ii).Gray scale image iii).binary image order approximation (ZOA). Eq. (3) is not a very accurate

IJSER © 2013
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October-2013 239
ISSN 2229-5518

approximation of Eq. (1).The set of geometric moments can be 4)Homogeneity : Returns a value that measures the
computed exactly by closeness of the distribution of elements in the GLCM to the
M [x] =∑𝑀 𝑁
𝑖=1 ∑𝑗=1 𝐼𝑝(𝑖)𝐼𝑞(𝑗)𝑓(𝑥𝑖, 𝑦𝑗), (4) GLCM diagonal.
Where,
1 𝑝+1 𝑝+1
Ip(i)=𝑝+1[𝑈𝑖+1 − 𝑈𝑖 ], (5.1) Range = [0 1]. Homogeneity is 1 for a diagonal GLCM.
1 𝑝+1 𝑝+1
Iq(j)= 𝑞+1
[𝑉𝑖+1 − 𝑉𝑖 ], (5.2)
Now we will store all this feature in .mat file, to generate the
And database. This features are useful at the time of recognition of
𝛥 𝑥𝑖
U i+1 =x i + , (6.1) character.
2
𝛥 𝑥𝑖
U i =x i - 2
, (6.2)
𝛥 𝑦𝑖
3.6 Recognition algorithms :
Vj +1 =yj+ 2
, (6.3) 3.6.1 ANFIS ( Artificial neuro fuzzy interference system):
𝛥 𝑦𝑖
Vj=yj- 2
(6.4)
1)Neural Network

3.4.2 Affine moment invariants: Neural network is also known as Artificial Neural
Moments are one of the parameters that describe the Network (ANN), is an artificial intelligent system which is
image or object of interest. Moment invariants are moments based on biological neural network. Neural networks able to
which do not change under a group of transformations. Image be trained to perform a particular function by adjusting the
normalization means bringing the image to a position in which values of the connections (weight) between these elements.
the effect of transformation is eliminated. Affine
transformation is represented by the following matrix form:
𝑥′ 𝑎11 𝑎12� 𝑥 𝑏1
= � + (7)
𝑦 𝑎21 𝑎22 𝑦 𝑏2

IJSER
To achieve normalization, affine transformation decomposed
into a group of simple one-parameter transforms. This group
consists of translation, uniform scaling, first rotation,
stretching, and second rotation
x’=x–x0,y’=y–y0 (8.1) Fig. 3.10: Neural Network Block Diagram
x’=αx,y=αy, (8.2)
x’=xcosθ–ysinθ,y’=xsinθ+cosθ, (8.3) Neural network is adjusted and trained in order the particular
x’=δx,y’=1/δy, (8.4) input leads to a specific target output. Example at Figure 3.5
x’=xcosΦ–ysinΦ,y’=xsinΦ+ycosΦ (8.5) the network is adjusted, based on a comparison of the output
where (x0,y0) is the centroid; α , δ > 0; θ, Φ are the rotation and the target until the network output is matched the target.
angles. The image function is invariant under the group of Now a days, neural network can be trained to solve many
transformations (8) if and only if it is invariants under the
difficult problems faced by human being and computer.
general affine transformation (7).
4. PERFORMANCE ANALYSIS
3.5 GLCM ( gray level co-occurrence matrix):
4.1 Database of characters :
Character recognition is done by generating database of
Following properties are calculated by GLCM :
devnagri character, extracting feature of each character and
saving them for further recognition process. I have selected
1)Contrast : Returns a measure of the intensity contrast
characters of different font size and font face for generating
between a pixel and its neighbor over the whole image.
database. The following figure shows the data base used.
Fig 4.1 shows the image used to generate database.
Range = [0 (size(GLCM,1)-1)^2]. Contrast is 0 for a constant
• Used Font size is 14.
image.
• Used font face is kruti dev 014.
2)Correlation : Returns a measure of how correlated a pixel is
to its neighbor over the whole image.

Range = [-1 1]. Correlation is 1 or -1 for a perfectly


positively or negatively correlated image. Correlation is NaN
for a constant image.

3)Energy : Returns the sum of squared elements in the


GLCM.
Fig. 4.1 Image used to generate database
Range = [0 1]. Energy is 1 for a constant image.
IJSER © 2013
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October-2013 240
ISSN 2229-5518

Now each line is separated from complete figure as shown datafile.mat file. We took example of two characters there
in the following figure. Then each character is separately for, features of only two characters are shown here.
cropped from single line. And simultaneously, centroid of
Table 4.2 Value of contrast of
each character is find out which is denoted by red cross and
box around the character is represented by blue colour.

Graph 4.1 Graph of contrast of


Fig. 4.2 separation of each character
Following MATLAB windows represents the samples taken
Table 4.3 value of homogeneity of
to generate data base. The value of each character is stored
in structure files and denoted by <1×1struct>. The structure
consist of Area occupied by character, Centroid, Bounding
Box, Eccentricity, Orientation, Binary values of image, and
perimeter. Each character have unique value of this
perimeters. All this values are stored in findchardata file.
Format of Findchardata file is .mat file.
Graph 4.2 Graph of homogeneity of

IJSER
Fig.4.3 Sample taken to generate database
4.2 Feature extraction of character :
Each <1×1> struct present in the table consist of values of
co-efficient of binary image, Area, centroid, eccentricity,
Graph 4.3 Extracted Feature of character
Output of NN :
Output of neural network can be represented by following
graph. As well as recognized output is also shown in
following figure. (a), (b).
Table 4.4 output of NN

orientation, bounding box, perimeter of single character. It


is not possible to represent feature of all character in this
report therefore we will represent two characters with their
details of parameters.
Table 4.1 Parameters of character

Graph 4.4 Output of NN

4.2.1 GLCM of character :


Now the following graph shows the GLCM . In
GLCM the present texture of character is texture correlation
as function of offset. The gray level co-occurrence matrix Fig. 4.5 Recognized character
represents the values of ‘contrast’, ’correlation’, ’energy’,
’homogeneity’ of each character which is stored in
5. CONCLUSION
IJSER © 2013
http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October-2013 241
ISSN 2229-5518

Character recognition is one of the difficult task , because [7] Veena Bansal & R.M.K. Sinha, “Segmentation of
verity font size and font faces are present now a days. So Touching Characters in Devanagari”,
it’s a try to achieve maximum accuracy and reduce time http://www.iitk.ac.in/ime/veena/PAPERS/stwo.pdf
duration required in recognition of character. The
proposed method hopefully can inspire a new thinking and [8] M.Babu Rao, Dr.B.Prabhakara Rao, Dr.A.Govardhan,
new way to tackle the face recognition problem. Extensive “Content Based Image Retrieval using Dominant Color and
training and testing experiments are carried out in order to Texture features” (IJCSIS) International Journal of
demonstrate the effectiveness of the proposed method for Computer Science and Information Security,Vol. 9, No. 2,
devnagri character recognition. The performance of the February 2011
proposed method in terms of recognition accuracy is
[9] R. Jayadevan, Satish R. Kolhe, Pradeep M. Patil, and
obtained. Features used in character recognition i.e. GLCM,
Umapada Pal “Offline Recognition of Devanagari Script: A
Colour dominant, Histogram, Affine moment invariant,
Survey”, ieee transactions on systems, man, and
gives good results compare to others, and for recognition
cybernetics—part c: applications and reviews, vol. 41, no. 6,
process ANFIS (Artificial neuron fizzy interference system)
november 2011.
tech. is used which gives the best result compare to other
technique. [10] Mohanad Alata — Mohammad Al-Shabi,” TEXT
DETECTION AND CHARACTER RECOGNITION USING
Talking about single characters i.e. it gives 100% FUZZY IMAGE PROCESSING”, Journal of electrical
accuracy. But when talking about all devnagri character it engineering, VOL. 57, NO. 5, 2006, 258–267
shows mistake in recognising some character. Recognition
rate of all devnagari character is near about 95%. [11] R. O. Duda, P. E. Hart, and D. G. Stork, “Pattern
Classification”, Second Edition, John Wiley & Sons Inc,
6. REFERANCES

IJSER
New York, 2006, pp. 576- 579, 582.

[1] Kailash S. Sharma,A. R. Karwankar, Dr. [12] H.Ma and D. Doermann, “Adaptive Hindi OCR using
A.S.Bhalchandra,” Devnagari Character Recognition Using generalized Hausdorff
Self Organizing Maps” ICCCCT’10
image comparison,” ACM Trans. Asian Lang. Inf. Process.,
[2] http://www.heatonresearch.com/articles/series/1 vol. 2, no. 3, pp. 193–218, 2003.

[3] R.M.K. Sinha, and Veena Bansal, “On Automating [13] U. Bhattacharya and B. B. Chaudhuri, “Handwritten
trainer for construction of prototypes for Devnagari text numeral databases of Indian scripts and multistage
recognition”, Technical report TRCS-95-232, IIT Kanpur, recognition of mixed numerals,” IEEE Trans. Pattern Anal.
India 1995. Mach. Intell., vol. 31, no. 3, pp. 444–457, Mar. 2009.

[4] http://en.wikipedia.org/wiki/Handwriting_recognition [14] U. Pal and B. B. Chaudhuri, “Indian script character


recognition: A survey,” Pattern Recognit., vol. 37, pp. 1887–
[5] R.M.K. Sinha, and Veena Bansal, “On Devanagari 1899, 2004.
documentation processing”, IEEE International Conference
on Systems, Man and Cybernetics, Vancouver, Canada
1995.

[6] Veena Bansal, R.M.K. Sinha, "On How to Describe


Shapes of Devanagari Characters and Use Them for
Recognition," icdar, pp.410, Fifth International Conference
on Document Analysis and Recognition (ICDAR'99), 1999

IJSER © 2013
http://www.ijser.org

You might also like