B9Kg«a«fiaaBa.- aggawwac
Figure 3: On the left, function / and a set of 2 functions
h\ and h 2 . On the right, function k computed by toggle
mapping.
3 TEXT SEGMENTATION
Our segmentation step is based on a morphological oper
ator introduced by Serra (Serra, 1989): Toggle Mapping.
Toggle mapping is a generic operator which maps a func
tion on a set of n functions: given a function / (defined
on Df) and a set of n functions this operator
defines a new function k by (Fig. 3):
Figure 4: Result of eq. 4 (function s) on an edge and in
homogeneous noisy regions.
Vx G Df k(x) =
hi(x);Vj G {l.-?7.}
I f(x) ~ hi(x)\ < I f(x) - hj(xj\l)
The result depends on the choice of the set of functions hi.
A classical use of toggle mapping is contrast enhancement:
this is achieved by applying toggle mapping on an initial
function / (an image) and a set of 2 functions hi and h 2
extensive and anti-extensive respectively.
To segment a gray scale image / by the use of toggle
mapping, we use a set of 2 functions hi and h 2 with hi
the morphological erosion of / and h 2 the morphological
dilatation of /. These two functions are computed by:
Vx G Df hi(x)
Vx G Df h 2 (x)
; min f(y);yev(x) (2)
max f{y);y e v(x) (3)
Figure 5: From left to right: 1. Original image, 2. Bina-
rization (function s from eq. 4), 3. Homogeneity constraint
(eq. 5), 4. Filling in small homogeneous regions.
Function s is then improved:
s{x) =
0 if\hi(x)-h 2 (x)\<Cmi n
1 if\hi(x) - h 2 (x)\ >= Cmin
& \hi(x) - f{x)I <p*\h 2 (x) - f(x)I
2 otherwise
with v(x) a small neighborhood (the structuring element)
of pixel x. Then, instead of taking the result of toggle
mapping k (eq. 1), we keep the number of the function on
which we map the pixel. This leads us to define function
s:
Vx G Dfs(x) = i;\fj G {1..2}\f(x)-hi(x)\ < \f(x)-hj(x)\
(4)
Function s(x) takes two values and may be seen as a bi-
narization of image / with a local criterion (Fig. 4 left).
Our function efficiently detects boundaries but may gener
ate salt and pepper noise in homogeneous regions (Fig. 4
right): even very small local variations generate an edge.
To avoid this, we introduce a minimal contrast c min and if
\hi(x) — h 2 (x)\ < Cmin, we do not analyse the pixel x.
(5)
Then, no boundary will be extracted within homogeneous
areas, s is a segmentation of / (notice that now we have 3
possible values instead of 2: a low value, a high value and
a value that represents homogeneous regions).
To use this method efficiently, some parameters must be
set up: the size of the structuring element used to com
pute a morphological erosion (hi) and a dilation (h 2 ), the
minimal contrast Cmi n and an additional parameter p. Vari
ations of p influence the thickness of detected structures.
Getting three values in output instead of two can be dis
turbing. Many strategies can be applied to assign a value
to homogeneous regions (to determine whether the region
belongs to low value areas or high value ones): if a region
is completely surrounded by pixels of the same value, the
whole region is assigned to this value. Another strategy
consists in dilating all boundaries onto homogeneous re
gions. In our case, this is not a real issue: as characters
are narrow, it is not common to have homogeneous regions
inside characters and if it occurs, such regions are small.
Then, our strategy consists in studying boundaries of small
homogeneous regions in order to fill a possible hole in
characters. Bigger homogeneous regions are mostly left
unchanged, only a small dilation of these boundaries is per
formed.
Illustration of the segmentation process is given in Fig
ure 5. In the rest of the paper, this method is called Toggle
Mapping Morphological Segmentation (TMMS).