Sunteți pe pagina 1din 41

CHAPTER ONE Introduction

OCR is an abbreviation which stands for Optical Character Recognition. It has been an active subject of research since the early days of computers. Despite its age, it remains one of the most challenging and exciting areas of research in computer science. It has recently grown into a mature discipline !". OCR can be defined as the tas# of transforming text represented in the spatial form of graphical mar#s i.e., handwritten into its symbolic representation in a computer system. $he importance of the OCR emerges from the fact that a paper will become obsolete in the age of the digital computers. $he most of students in a lecture theatre, for example, will feel comfortable towards computer%written documents or notes rather than those handwritten, OCR provides a convenient way for a &uic# converting a handwritten text into a computer%typed text !".

1.1 Problem Definition


OCR is still one of the challenging areas of research. ' lot of wor# was done in OCR for (nglish characters, but a few wor#s were done for 'rabic characters. $he problem arises here) since 'rabian people also deal with the technology of the digital computers, they need a way by which their manual papers, documents, receipts*etc, can be converted and stored in a computer system. $his will ma#e life faster as it will reduce the time needed to write a manual document then typing it into a computer system. $his will save time for many organi+ations ,universities, companies*etc- which are considered as an important core for every 'rabic nation. It will also be useful for those who are not used to typing.

1.2 Objective
1

$he objective of this wor# is to design and develop a new algorithm for detecting . recogni+ing a handwritten 'rabic letter and to display the corresponding character in the computer system.

1.3

et!odolo"ie# $ Tool#

/'$0'1 software will be used to manipulate the image of the letter. $he design and development processes will all ta#e place in /'$0'1 environment. Otsu2s method will be used in thresholding the image. $he proposed features will be extracted using built%in algorithms in /'$0'1. ' new algorithm will be developed to extract the ratio of the letter2s width to its height. $he letters will be clustered and classified manually into classes according to the extracted features. ' feed%forward neural networ# that consists only of one neuron will be used for each class to distinguish between letters in the same class. $he final numeric output of the neural networ# will be translated into a meaningful output that represents the recogni+ed letter. 3inally, an interface that interacts with the user will be implemented enabling the /'$0'1 to read the image directly.

1.% &no'led"e (#ed


i. ii. Digital Image 4rocessing ,DI4-. 'rtificial 5eural 5etwor#s ,'55-.

1.) T!e#i# *+,out


$he rest of the thesis is organi+ed as follows6

C!+-ter 2 . *iter+ture Revie'/ represents previous wor# in OCR. It also


consists of the literature related to the OCR, DI4 and '55 to ma#e the reader more convenient with the terminology used in these fields.

C!+-ter 3 . De#i"n $

odelin"/ provides the reader with an analysis to

'rabic letters and a conceptual design for the system, flowcharts and algorithms developed and specified to achieve our objective.

C!+-ter % . Im-lement+tion $ Re#ult#/ shows the implementation of


the system and how it was tested and the results obtained from the test. It also discusses the results.

C!+-ter ) . Conclu#ion $ 0uture 1or2/ specifies what is


recommended to be done in order to improve this system in the future.

APPENDI3 A/ contains tables for width to height ratios measured for all
'rabic letters.

APPENDI3 4/ represents the &uestionnaire ,form- that was distributed to


collect samples to test them on the system.

APPENDI3 C/ represents the system code. APPENDI3 D/ contains tables for some measured values necessary for the
reader in order to explain some values used in the code.

CHAPTER T1O
3

*iter+ture Revie'
7ere comes a brief description of the literature related to the wor# in the area of the OCR. OCR basically depends on Digital Image 4rocessing for the manipulation of the image and extracting features, and on either 7idden /ar#ov /odels ,7//- or 'rtificial 5eural 5etwor#s ,'55- for the recognition. 1efore that, previous wor#s on OCR for 'rabic letters are discussed.

2.1 Previou# 1or2


3ew wor#s have been done on 'rabic text . handwriting. $he methods used can be divided into 8 categories6 segmentation%free methods and segmentation%based methods. 9illies used the approach of over segmenting the word to insure that no segment belongs to more than one character, and then he used the combined features as classifiers and passed them to a neural networ#. (lgammal . Ismail segmented the word to scripts ,small connected segments- using a 0ine 'djacency 9raph ,0'9- then they used the features of these scripts as classifiers !". In segmentation%free methods, a wide range of different features have been used by different groups. /any of these features re&uire normali+ation of the image before features can be extracted. 'n important part of this is often finding the baseline of the word ,the line on which it is written and by which the characters are often connected-. Other techni&ues have been developed in this area such as6 5earest 5eighbor method which was used on a small dataset containing 8: words but it re&uired resi+ing of the image. 4eter 1urrow described a method called radial method used to obtain statistical features of the words. $his method had very poor performance !". In this thesis, it is intended to perform 'rabic letters recognition using few topological descriptors and a proposed descriptor which is the ratio of letter2s width to height ta#ing into account no image resi+ing or any specification to the image characteristics should be defined thus eliminating any constraints about the image attributes.

2.2 Di"it+l Im+"e Proce##in"


4

Digital image processing ,DI4- is a science in which a special #ind of signals #nown as images can be manipulated within a computer system in order to obtain and extract some information that has to do something with the objective,s- of the manipulation. It is a discipline of D;4 ,digital signal processing-. ' digital image is represented as a 8%dimensional matrix in the computer system. It is a function of 8 variables f,x,y- where x and y indicate the row and the column in which the pixel lies respectively. $he value of the function f,x,y- represents the gray level associated with the pixel ,x,y- and it varies from : ,blac#- to 8<< ,white- and the midway is a mixture of white and blac# ,and here comes the name gray%levels-. $he above description applies for the grayscale image. $he colored image is represented as a =%dimensional matrix where the =rd dimension indicates the R91 ,Red, 9reen, and 1lue- components. ' colored image can be visuali+ed as = images placed as layers) each image is a grayscale image with different variations from each other.

3igure ,8.!- ' colored digital image

3igure ,8.8- ,3rom left to right- red, green, and blue components of the digital image in 8.!

2.2.1 4+#ic Conce-t# $ Terminolo", in DIP


2.2.1.1 Connectivit,/ two pixels are said to be connected if they are neighbors and
their gray levels satisfy a specified criterion of similarity ,say, if they are e&ual-.

2.2.1.2 Re"ion/ let R be a subset of pixels in an image, R is a region if R is a connected


set.

2.2.1.3 4ound+r, 5Contour or 4order6/ a boundary of a region R is a set of pixels


in the region that have one or more neighbors that are not in R.

2.2.2 DIP Proce##e#


$here are = basic processes in the digital image processing6 i. ii. iii. Image ;egmentation. 3eature,s- (xtraction. 4attern Recognition.
6

3igure ,8.=- 4rocesses of DI4

2.2.2.1 Im+"e 7e"ment+tion


;egmentation is the process in which the image is subdivided into object,s- . bac#ground. It is the process by which the computer system #nows which pixels belong to the object that is re&uired to be manipulated and which ones must be discarded as they belong to the bac#ground. $here are many techni&ues used to segment images such as6 detection of discontinuities, 7ough $ransforms, and thresholding. $hresholding is the mapping of the values of the pixels of a 8%dimensional image into one of 8 values ,usually : or !- using a specified threshold. It is the process of converting a 8% dimensional image into a binary image. ' binary image is that whose pixels have only one of 8 values) these values are labels used to refer to either object or bac#ground. $he threshold is used to divide the image into 8 regions6 region with gray level values greater than the threshold and other with gray level values less than the threshold. ' thresholded image g,x,y- for an image f,x,y- with threshold ,$- is defined as follows6

,8.!$he thresholding process is histogram%based) it re&uires #nowing the histogram of the image to define the threshold that can divide the image into its object,s- and bac#ground. ' histogram of a digital image with gray levels in the range : 0%!" is the discrete function6

,8.87

where6 r#6 the #th gray level. n#6 the number of pixels in the image having gray level ,r#-.

3igure ,8.>- ' 8%dimensional image ,left- and its histogram ,right$he threshold value is computed using several mathematical methods. One of these methods is to compute the threshold from the image2s statistics ,the histogram- using Otsu2s method which is described as follows 8"6 (valuate the normali+ed histogram for the image, i.e., treat the histogram as a discrete probability density function as in6

,8.= ;uppose that a threshold ,#- is chosen such that C : is the set of pixels with levels :,!,8,*,#%!" . C! is the set of pixels with levels #,#?!,#?8,*,0%!". Choose the value of ,#- that maximi+es the between%class variance @18.

,8.>8

where6

,8.<-

,8.A-

,8.B,8.C-

,8.D $he value of ,#- is the threshold and it is a normali+ed value from :.: to !.:.

2.2.2.2 0e+ture5#6 E8tr+ction


'fter an image has been segmented, the resulting binary image is represented and described in a form suitable for further computer processing. $he tas# is divided into 8 tas#s6 representation and description. Representation is done by selecting one of the representation schemes used such as6 chain codes. Description is done after representation is finished. It is a process in which the boundary or the region is described. $here are 8 types of descriptors6 1oundary descriptors such as6 length, diameter, curvature, eccentricity*etc. Regional descriptors which are divided into 8 categories6 simple . topological.
9

;imple regional descriptors include area, perimeter, compactness, mean, and median of the gray level. $opological descriptors are useful for global description of regions in the image plane. $opology is the study of properties of a figure that are unaffected by any deformation, as long as there is no tearing or joining of the figure =". $opological descriptors include the following6 i. ii. iii. where6 E=CH ,8.!:5umber of 7oles ,7-. 5umber of Connected Components ,C-. (uler 5umber ,(-.

3igure ,8.<- ' region with (uler number e&ual to :

2.2.2.3 P+ttern Reco"nition


'fter an image2s descriptors are obtained they are arranged as patterns ,or objects- for the recognition phase. ' pattern is defined as an arrangement of descriptors ,features-. ' pattern class is a family of patterns that share some common properties. 4atterns are denoted symbolically as vectors =". /any techni&ues are used for pattern recognition. One of the famous techni&ues is the artificial neural networ#s which will be described briefly in the next section.
10

2.3 Artifici+l Neur+l Net'or2#


It is #nown that the human brain is estimated to have around !: billion neurons each connected on average to !:::: other neurons forming a complicated networ# of neurons. $he artificial neural networ#s were inspired by biological findings relating to the behavior of the brain >". 'n artificial neural networ# may be defined as a networ# of units called neurons ,the basic processing elements for the networ#- which communicate by sending signals to each other over a large number of weighted connections <".

2.3.1 4+#ic Com-onent# $ 7tructure


$he basic components of an artificial neuron may be summari+ed as follows6 Inputs ,xi-. Connecting weights ,wi-. (ffective input ,or net input- ,v-. Output ,y-. 'ctivation function ,f ,v-- which maps the input to output.

3igure ,8.A- 'rtificial 5euron /odel $he neurons are usually arranged in layers to form a neural networ#. (ach layer of neurons receives outputs form the previous layer as inputs, calculates its outputs, and delivers them to the next layer.
11

3igure ,8.B- 0ayers of neurons $here are several activation functions used in the neural networ#s. ;ome of them are shown in figure 8.C below. $he choice of the activation function is based upon the purpose of the neural networ# design. $he chosen function must be able to classify given input pattern vectors into the desired classes ,which are called targets-.

3igure ,8.C- ;ome of the activation functions used in '55 5eural networ#s can be classified into architectures based on the type of the activation function used. One of the famous architectures is the perceptron which is a neuron with a hard limiting activation function.

2.3.2 *e+rnin" $ Tr+inin" ANN


$he most important characteristic of an artificial neural networ# is that it can learn and detect regularity . irregularity of the input data. $here are several learning rules and
12

algorithms developed to perform the learning process) each group of rules is applicable to certain structures of neural networ#s. $he concept of the learning is based upon the modification of the connecting weights so that the mean s&uare error ,the mean s&uare of the difference between the desired output . the actual output of the networ#- is as less as possible ,the goal is ideally +ero- and the relationship between the input and the output is estimated with more accuracy. $his process is similar to the curve fitting problems in numerical analysis where certain points in an n%dimensional space are given and a curve that passes through them is re&uired to be estimated. $he learning in which the targets are #nown is called supervised learning.

3igure ,8.D- 1loc# diagram for the supervised learning process $raining is the process of collecting as many as possible ,input pattern, output- pairs from the application domain where the neural networ# is intended to be implemented, and presenting them in an appropriate form to it so that its weights are adjusted according to the learning rule embedded within it to map the inputs to the desired outputs. 'n important terminology in the training is the epoch which is defined as a one pass through all the training data.

CHAPTER THREE De#i"n $ odelin"


13

In this chapter an analysis for 'rabic letters2 shapes in terms of the topological descriptors described earlier is introduced. $his analysis is followed by the conceptual design of the system.

3.1 Ar+bic *etter#9 C!+r+cteri#tic# $ De#cri-tor#


3.1.1 Ar+bic *etter# Cl+##e#
$he 'rabic letters will be classified into C classes) each class is characteri+ed by a =% dimensional descriptor pattern ,number of connected components, number of holes, and (uler number- which will be denoted as the C, 7, (" pattern. $he following table shows the evaluation of these descriptors for 'rabic letters. $able ,=.!- $he descriptors C, 7 . ( for some 'rabic letters 0etter C 8 = 8 ! ! 8 ! ! = 7 ! ! : : : : 8 ! : ( ! 8 8 ! ! 8 %! : = 0etter C 8 ! > ! 8 ! 8 ! 8 7 : : : ! ! ! ! : : ( 8 ! > : ! : ! ! 8 0etter C ! 8 = > 8 ! 8 ! 8 7 : : : : : : : : : ( ! 8 = > 8 ! 8 ! 8

E H K N Q T WWX [ ^

F I L O R U Y \ _

G J M P S V Z ] `

$able ,=.8- Classification of the 'rabic letters into the proposed classes Class 8:8 8!!
14

0etters

T K _ F ` Z S J E Y R

=:= >:> !:! !!: ! 8 %! =!8

^ M L P Q N \ I a ] V G [ U O WX H

It is obvious that from a simple investigation to the = descriptors C, 7, (" the class which the letter belongs to will be identified, the rest is to find out ,or to recogni+ewhich letter within the class ,this is valid for all classes except the 8 classes ! 8 %!" . = ! 8" since each one of them consists only of one letter as shown in the previous table-. $he ratio of the letter2s width to its height will be ta#en as an additional descriptor to obtain a >%dimensional pattern C, 7, (, R" where ,R- is the ratio mentioned recently. It will be assumed that each letter maintains its own ratio regardless of the handwriting. 3igure ,=.!- illustrates the concept of the ratio.

3igure ,=.!- $he width . height of an 'rabic letter

where

,=.!-

3.1.2 7election of Cert+in *etter# for E+c! Cl+##


15

$he ratios were measured for all 'rabic letters typed by computer using = types of fonts6 $raditional, Courier, and $ransparent. It is believed that neural networ#s solve classification problems if they are linearly separable which implies that each 'rabic letter should have a range of ratios that do not intersect with other letters. ;o certain letters from each class were chosen as they satisfy this criterion ,see appendix '-. /easurements for mean, variance, and confidence interval were ta#en for the ratios of a !:: random samples of selected letters. $hese letters were extracted from b'rabic Database 4rojectc developed by students from ;udan dniversity for ;cience . $echnology. ;ome results were excluded as they generated extreme values. ;ome letters were excluded from their classes as they affected the confidence interval for other letters. 'nd as a result some classes will have only one letter ,as shown in tables ,=.=- to ,=.C--. $he red circles indicate which letters were selected.

$able ,=.=- ;ample of letters in class 8:8 0etter /ean eariance /in

J
:.CB=: :.!!!8 :.8::
16

S
!.:!>= :.!8A> :.:C

`
:.AA!= :.:>=8 :.:>=<

/ax 5o. of ;amples D<f confidence interval C:f confidence interval

!.<:: D8 :.A<<: g !.:D!:" :.B=:! g !.:!<D"

8.:: D! :.BAAA g !.8A8:" :.C<!D g !.!BAB"

!.8C<B CC :.<BAA g :.B>A:" :.A:<C g :.B!AC"

's the confidence intervals start to be narrower, the accuracy decreases. ;o the 8 letters ` and S were selected while the letter J was excluded. $able ,=.>- ;ample of letters in class =:= 0etter /ean eariance /in /ax 5o. of ;amples B:f confidence interval A:f confidence interval

M
!.=D8= :.<A8! :.=: =.8: D= :.C!:< g !.DB>!"

^
:.C:>C :.8!D< :.:=!= 8.:BAD C< :.<BBA g !.:=8:"

:.D!B= g !.CAB="

:.A!D= g :.DD:="

;ince until A:f accuracy the intervals for both letters M and ^ did not separate, it is better not to proceed further thus one letter was selected i.e. M. $he same procedure was done for class >:>. Only the letter P was selected ,see table ,=.<--.

17

$able ,=.<- ;ample of letters in class >:> 0etter /ean eariance /in /ax 5o. of ;amples B:f confidence interval A:f confidence interval

P
:.DC=A :.!!<A :.8AD8 !.B!CC CA :.CA>: g !.!:=8"

L
:.C>!: :.:B!8 :.!C8D !.=C!: CC :.BAB= g :.D!>B"

:.CC<D g !.:C!="

:.BC:C g :.D:!8"

$able ,=.A- ;ample of letters in class !:! 0etter /ean eariance /in /ax 5o. of ;amples DD.Cf confidence interval

I
!.A<!8 :.:B>B !.!8<: 8.8AD8 <B !.>!DA g !.CC8C"

]
!.::BC :.:!CD :.B=D! !.8<:: A! :.D>D8 g !.:AA>"

V
:.D=D: :.:=== :.<=<8 !.8AAB <A :.C=<C g !.:>88"

G
:.!ABD :.::!C :.:C>B :.8B:C AC :.!A8= g :.!B=<"

18

C:f confidence interval B:f confidence interval

:.CC>8 g :.DD=C"

:.DBAB g !.:=CD"

:.CDA8 g :.DC!C"

:.DC=< g !.:=8!"

1oth letters G and I has a high accuracy separated confidence interval ,DD.Cf-. $he 8 letters ] and V had separated intervals with accuracy of B:f.

$able ,=.B- ;ample of letters in class 8!! 0etter /ean eariance /in /ax 5o. of ;amples B:f confidence interval

R
:.DA!< :.!<<< :.!:>8 !.<=== B< :.C::A g !.!88>"

Y
:.B!:C :.!::B :.:C!! !.>:D! CD :.A:AA g :.C!<:"

19

A:f confidence interval

:.C=:! g !.:D8D"

:.A8<B g :.BD<D"

0etters R and Y had separated intervals with an accuracy of A:f. ;o any ratio for those 8 letters outside those regions ,intervals- will be excluded. $able ,=.C- ;ample of letters in class !!: 0etter /ean eariance /in /ax 5o. of ;amples D<f confidence interval

O
!.A>CA :.:A<8 !.!88> 8.88<C <A !.<8:C g !.BBA>"

U
:.C:8! :.:!<= :.A:8D !.:>CC <! :.BB8! g :.C=8!"

[
:.D>>C :.:8DB :.A<=! !.8<:: >! :.CCAA g !.::=:"

In class !!:, all letters were selected since separated confidence intervals with high accuracy for them were achieved ,see table ,=.C--.

3.2 7,#tem module


$he OCR ;ystem can be viewed as a function ,module- that transforms the image to a character ,or letter-. 3igure ,=.8- illustrates the main components of the system.

3igure ,=.8- ;ystem module

3.3 7,#tem #ub module#


20

$he OCR system is divided into = sub modules6 thresholding, description, and recognition as shown in figure ,=.=-.

3igure ,=.=- ;ystem sub modules

3.3.1 T!re#!oldin" module


It is intended to threshold the input image using the following steps6 Convert the input digital image into a 8%dimensional image. Compute the normali+ed threshold value from the 8%D image using Otsu2s method described earlier. /ultiply the normali+ed value by 8<< to obtain the actual threshold value. $hreshold the image using the obtained threshold value. Deliver the thresholded image into the next module.

3igure ,=.>- shows the flowchart of the thresholding module.

21

3igure ,=.>- $hresholding module flowchart

3.3.2 De#cri-tion module


$he objective of this module is to find the descriptors C, 7, (, R" to determine which class the letter belongs to, the following steps are performed6 Obtain the negative form of the thresholded image obtained in the thresholding module) this is because /'$0'1 software considers bac#ground is dar#er than the object,s- while the handwriting is usually dar#er than the bac#ground ,white paper-. Obtain the binary image ,label matrix- of the image. (valuate number of connected components from the label matrix. (valuate (uler number from the label matrix. Calculate number of holes.

22

3rom the label matrix, find the pixel list which is defined as the list of all pixels in the region 8".

3rom the pixel list, calculate the width and the height of the region. Calculate the ratio of width to height.

3igure ,=.<- shows the flowchart of the description module.

3igure ,=.<- Description module flowchart

3.3.3 Reco"nition 5ANN6 module


In this module, a perceptron or a linear neural networ# ,a neural networ# with linear activation function i.e. outputh input- will be used for each class of letters except those with only one letter. $he perceptron will be used for classes with 8 letters, while the linear neuron will be used for those with more than 8 letters. $he networ# will consist of only one neuron with one weight and one bias. $he input will be the ratio. $he output

23

will be a scalar &uantity represents the letter. 1oth weight and bias values will be determined upon training.

3igure ,=.A- 5euron /odels used in '55 module6 linear ,left- and perceptron ,right-

3.3.3.1 Tr+inin" d+t+


3rom the ratio measurements mentioned in section ,=.!.8-, the training data will be only those belonging to the confidence interval specified for each letter ,those red%circled in $ables ,=.=-, ,=.>-* ,=.C--. $he training data are organi+ed as follows6 $able ,=.D- $raining data for class !:! 5etwor# 5ame 6 class!:!i55 $raining data Data collected from previous graphs. 5etwor# $ype 0inear $argets One of the numbers ! 8 = >?" /eaning of targets !6 G 86 ] =6 V >?6 I

$able ,=.!:- $raining data for class 8:8


24

5etwor# 5ame 6 class8:8 i55 $raining data 5etwor# $ype $argets /eaning of targets Data collected from previous graphs. !6 S $able ,=.!!- $raining data for class !!: 5etwor# 5ame 6 class!!: i55 $raining data 5etwor# $ype $argets /eaning of targets Data collected from previous graphs. 86 [ >?6 O 0inear One of the numbers ! 8 >?" !6 U 4erceptron One of the numbers : !" :6 `

$able ,=.!8- $raining data for class 8!! 5etwor# 5ame 6 class8!! i55 $raining data Data collected from previous graphs. !6 R 5etwor# $ype 4erceptron $argets One of the numbers : !" /eaning of targets :6 Y

25

3.3.3.2 Tr+inin" re#ult#


$ables ,=.!=- to ,=.!A- include results obtained from training of '55. 3rom these results the values of weights . biases were set to the networ#s6 $able ,=.!=- $raining results for class!:!i55 5etwor# 5ame 6 class!:!i55 /ax. 5umber of epochs /ean ;&uare (rror ,/;(;amples ;i+e ;amples misclassified (rror probability jeight 1ias !<: :.!:88A <A > :.:B! 8.8:DC :.>!DDA

26

$he minimum value of the mean s&uare error was :.!:88A and with this value only B.!f of the training samples were misclassified. ;ince the curve was stuc# at this value, it was decided to stop here and ta#e the values of the weight and bias.

$able ,=.!>- $raining results for class8:8i55 5etwor# 5ame 6 class8:8i55 /ax. 5umber of epochs /ean ;&uare (rror ,/;(;amples ;i+e ;amples misclassified (rror probability jeight 1ias !8 :.: D< : :.: !.=:A %!

27

$he mean s&uare error was expected to reach +ero since the neuron used was a perceptron and the input data was linearly separable i.e. ratios have separated regions for each letter in class 8:8. $able ,=.!<- $raining results for class!!:i55 5etwor# 5ame 6 class!!:i55 /ax. 5umber of epochs /ean ;&uare (rror ,/;(;amples ;i+e ;amples misclassified (rror probability jeight 1ias >:: :.:AC> >! : :.: =.8B<D %!.=BD=

28

In table ,=.!<- the value of the mean s&uare error obtained was less than :.! which ensures that probability of misclassification is +ero. ;o the values of the weight and bias were ta#en. $able ,=.!A- $raining results for class8!!i55 5etwor# 5ame 6 class8!!i55 /ax. 5umber of epochs /ean ;&uare (rror ,/;(;amples ;i+e ;amples misclassified (rror probability jeight 1ias !: :.: =8 : :.: !.!<C= %!

$he solution for class 8!! was achieved in only !: epochs because of the linear separation of the input data. 3igures ,=.B- to ,=.!:- show the performance value ,mean s&uare error- vs. number of epochs for each one of the class 8:8, !:!, !!:, and 8!! '55 respectively.
29

3igure ,=.B- 4erformance graph for class8:8i55

3igure ,=.C- 4erformance graph for class!:!i55

30

3igure ,=.D- 4erformance graph for class!!:i55

3igure ,=.!:- 4erformance graph for class8!!i55

31

CHAPTER 0O(R Im-lement+tion $ Re#ult#


In this chapter, the system implementation is discussed as well as the mechanism by which the system was tested. $esting results are also interpreted.

%.1 Im-lement+tion
In order to implement . run this OCR system, the developed /%files ,please refer to appendix C to see their names . code- need to be placed in /'$0'12s wor# directory ,version B.: or more-. $o run the system, bOCRc or bocrc is typed in the command window and a dialog box will appear as shown in 3igure ,>.!-. $hrough this dialog box the user can browse for his desired image file. Once bopenc is clic#ed, the OCR system is executed and the result of the recognition is printed in /'$0'12s command window.

3igure ,>.!- Dialog box that appears when running the system

32

3igure ,>.8- ;napshot of the system execution $able ,>.!- displays the message that will be displayed according to each 'rabic letter provided that the system recogni+ed it.

$able ,>.!- the messages that must be printed in correspondence to each letter letter message 'lif $eh $heh keem 7ah Dal $hal ;een letter message ;ad Dad $ah $hah laf 7aa jaw

G M P S V ] ` I

O R U Y H WX [

%.2 Te#tin" t!e #,#tem


' form was distributed for a random !:: people inside the faculty demanding them to fill it with their handwriting. $he 'rabic letters tested are shown in 'ppendix 1.
33

$he forms were collected. ;canners were used for data ac&uisition of images. Images of each letter were subjected to the system. $able ,>.8- shows the results obtained from the testing. 3igure ,>.=- displays the results graphically.

$able ,>.8- $est results 0etter /isclassified in the correct class ,f/isclassified in the correct ratio region ,f!
34

Recogni+ed successfully ,fC<

!>

M P S V ] ` I O R U Y H WX [

>A =A 8A =< !: != 8C =8 =C >= >< A: <A =:

g g B 8C A8 8! 8 A !: =D == g g >8

<> A> AB =B 8C AA B: A8 <8 !C 88 >: >> 8C

35

3igure ,>.=- $est results It is clear that the recognition percentage varies along the letters. $he samples that the OCR system could not recogni+e can be classified into 8 categories6 i. ii. $hose which were not classified in the correct C, 7, (" class. $hose which were not recogni+ed by their ratios but classified successfully ,they had the right C, 7, (" class-. $he first category was due to handwriting errors such as6 imperfect holes, unnecessary additional holes, connected dots, disconnected components ,writing without raising the pen to write dots or bham+ac-) these errors are responsible for mista#ing a letter2s class for another. 3igure ,<.!- shows examples for handwritten letters which lead to this misclassification.

36

3igure ,<.!- 7andwritten letters which lead to misclassification $he second category of errors was because it was assumed that bthe letters maintains their ratios regardless of the handwritingc. $his assumption was proved from the results to be wrong but not completely) there were 8 letters which complied with this assumption, they are6

G and I. 3ew of these errors was due to user2s faults such as

leaning letters with slope more than the usual) this leaning results in a value of ratio out of the expected region for a certain letter thus mista#ing the classification.

3igure ,<.8- (xamples for extremely leaning letters 9enerally there is a slight percentage of errors in which the following error message appears instead of misclassifying the input letter6

$his error is due to the variation of the in# level along the handwritten letter which results in disconnecting the existing components into several ones ,this disconnection happens after thresholding- and additional connected components emerge.

37

3igure ,<.=- 'n example of in# variation along the letter2s body ,left- and its effect in introducing more connected components after thresholding ,right-

$he variable manswer2 in the code ,please refer to the code in appendix C- is assigned a certain value according to the value of the variable mc2 which indicates the number of connected components. It is impossible to ta#e into account all possible values of mc2 which are infinite and writing commands such as the following commands6 if ,chh<- first second third fourth fifth" hD.4ixel0ist) end) if ,chhA- first second third fourth fifth sixth" hD.4ixel0ist) end) if ,chhB- first second third fourth fifth sixth seventh" hD.4ixel0ist) end) f *******.etc. $hat is because the field D.4ixel0ist contains a number of matrices in the form x y" e&ual to the number of connected components and with different lengths so it is impossible to assign it all to a single variable ,because this generates a compile%time error- unless each matrix in this field is assigned to a single variable as shown in the previous commands. ;ince the written code tests only if the variable mc2 is !, 8, =, or >, this error occurs only when c n >. $his error can be considered to belong to the first category of errors mentioned earlier as it only occurs when the number of connected components is greater than > or in other words, the letter belongs to other class than the correct one.
38

CHAPTER 0I:E Conclu#ion $ 0uture 1or2


).1 Conclu#ion
It can be concluded that this OCR system is so sensitive to the level . accuracy of the handwriting specially the number of holes . the connected components) if the user is so accurate in his handwriting or at least complies with the rules of the holes . connected components, it can be predicted that the recognition percentages will increase to the following values for each letter ,see table ,<.!--. $able ,<.!- (xpected results in case of an accurate handwriting 0etter Recognition 4ercentage ,f<! AB !:: CC >A 0etter Recognition 4ercentage ,f== BD D= C= D: 0etter Recognition 4ercentage ,fD= D> CD D= <>

U Y H WX [

] ` I O R

G M P S V

'lthough the system can achieve its objective this way, OCR systems ,and any system that deals with human beings in general- are intended to be easy in terms of applicability and more convenient to the user so it is not comforting to force the user to comply with the system rather than forcing ourselves as system designers to comply with user2s needs. It can also be concluded that the ratio alone does not represent an enough classifier for 'rabic letters except in very few letters as discussed before.

39

In the positive side, it can be concluded that the objectives have been achieved partially) image type constraints and image resi+ing re&uirements were eliminated.

).2 0uture 1or2


3ollowing are the enhancements recommended to be made in order to improve this OCR system6 'pplying more experiments on handwritten 'rabic letters to obtain more accurate features and descriptors for them than those used in this system so as to extend the pattern length as well as number of letters to be recogni+ed. dsing more complex neural networ# architectures specially those with built%in memories such as 'R$ ,'daptive Resonance $heory- based neural networ#s as it is believed that the secret to the evolution . improvement of this project is in the architecture of the neural networ# used as well as the length of the pattern.

40

RE0ERENCE7
!" 4eter 1urrow, Arabic Handwriting Recognition, /aster of ;cience, ;chool of Informatics, dniversity of (dinburgh, 8::>. 8" Rafael C. 9on+ale+, Richard (. joods, ;teven 0. (ddins, Digital Image Processing using MATLAB, 8::>. =" Rafael C. 9on+ale+, Richard (. joods6 Digital Image Processing, 8nd edition, 8::8. >" 1ishop, Christopher6 eural etwor!s "or Pattern Recognition, Oxford, !DD<. <" 1en orpse, 4atric# van der ;magt6 An Introduction to 5ovember !DDA. eural etwor!s, Cth edition,

41

S-ar putea să vă placă și