Thinning Algorithms Arabic OCR: Two Parallel Thinning Al
Thinning Algorithms Arabic OCR: Two Parallel Thinning Al
-.
By f % b e o o n d i t h s the
b4,ririditions poirrt P1 which has been removed
F i r s t sub i-tion- might be an east border point
1. 2SB(Pl)S6 or south border point or north-
2. A(P1)=1 west corner point [2],[3].
3. P2XP4XP6=0 The solution to the set of
4. PIXP6XP8=0 equations are:
where P4=0 or P6=0 or P2-0 and
A(P1) is the number of 01
pattern in the ordered P2, P3,
P8=0. . . s 3 and 4 for
.
P4,. 8P9 and P2 that are the
eight neighbors of P1.
4. -tion
the second. mub-iteratian.
By these conditions the
B(P1) is the number of point P1 which has been removed
nonhero neighbors of Pi. That might be a south border point
is or a west border point or a
B(Pl)=P2+P3+P4+P+P6+P+P8+P9 north-east corner point.
-
Second sub iteration. The solution to the set of
equations are:
1. 21B(P1)16 P6=0 or P8=0 or P2=0 and
2. A(P1)=1 P4=0.
3. P2XP6XP8=0 5. Con- 3 and 4 for
4. P4XP6XP8=0 the third sub iteration.
h
-
T h i r d s u b i t e r a t ion. By these conditions the
point P1 which has been removed
1. 2SB(P1)56 might he a north border point
.
2. A(Pl)=l
3 P2XP4XP8=0
4. P2XP6XP8=0
or a west border point or a
south-east corner point.
The solution to the set of
-
Fourth sub i t a r p t i on . equations are:
P2=0 or P8=0 or P4=0 and
1. 2SB(P1)56 P6=0.
2. A(P1)=1
-249 -
6. Conditions 3 and 4 for templates. In the templates
t a . zeros must match 0 valued pix-
By these conditions the els and ones must match 1 val-
point P1 which has been removed ued pixels and asterisks must
might be a north border point match either 1 or 0 valued pix-
or an east border point or a els in the current image.
south-west corner point. Initially the current im-
The solution to the set of age and the working image are
equations are: identical copies of the origi-
P2=0 or P4=0 or P6=0 and nal input image. Template A1 is
P8=0. compared with all pixels having
The above algorithm can a value 1 and their neighbors
also be implemented using tem- in the current image. If the
plates. match is obtained, then the
The process is repeated central pixel is removed in the
until no more pixels are delet- working image. After processing
ed from the pattern, thus the with template A l l the current
final skeleton is obtained. image is discarded and the wor-
Fig.1 shows the result of king image becomes the new cur-
applying the above algorithm. rent image, and the new working
image is obtained by copying
the new current image. The pro-
cess is repeated with templates
A2, A3 , ...,B4 forming a com-
plete cycle until no more pix-
els are removed (i.e. the skel-
eton is obtained.)
This method preserves the
shape of the original image and
maintains connectivity. The
algorithm leaves a few extran-
eous pixels only on the dots of
the characters as shown in
F i g u r e 1. Result of applying Fig.3. To avoid this problem
the parallel thinning al- the character and the dots are
gorithm.
o o * * o o * 1 * * 1 *
0 1 1 1 1 0 1 1 0 0 1 1
* 1 * * 1 * * o o o o *
4. MATCHING ALGO- A1 A2 A3 A4
RITHM. 0 0 0 1 * 0 * 1 1 o * *
4 . 1 Alcroritbm. * 1 * 1 1 0 * 1 * 0 1 1
Matching algorithm util- 1 1 * * * o 0 0 0 0 * 1
izes eight templates [4] B1 B2 B3 B4
(Fig.2) and two images. The two
images are the current image F i g u r e 2 . Templates f o r the
and a working image of the same matching algorithm. Note t I * t t
size which is updated when tem- can either match to 1 or 0.
plates are matched.
Pixels are removed by com-
paring each pixel having a val- initially separated.
ue 1 and its neighbors in the
current image with a set of
- 250 -
Acknowledgement.
The support provided by
the Defense Industrial Research
Program (DIRP), Department of
National Defense, Ottawa, is
greatly appreciated.
-251 -