Page 194 -
P. 194
168 Chapter 4 ■ Grey-Level Segmentation
where V is the thresholded pixel and pct is thefixedpercentagevalue; pct = 15
wasusedfor theexamples shown here.
A simple extension of this process averages the current threshold with
the one from the row above, allowing the vertical propagation of grey-level
variations and illumination changes. This is not done in the program thrdd.c,
which implements this scheme, but is an easy addition.
Figure 4.14 contains some of the images segmented by this method. The
results are fairly good, at least until 4.14d. The white region in the margins
seems to have fooled it, at least in this case. Still, the program is very quick,
and is 64 lines of C code (without the I/O functions), requiring at most two
rows to be in memory at one time.
(a) (b)
(c) (d)
Figure 4.14: Images segmented by the moving averages method. (a) The sky image. (b)
The pascal image with superimposed sine-wave illumination. (c) The face image with
linear illumination. (d) The pascal image with Gaussian illumination. This method works
best on images of text, for which it was designed.
A likely pitfall is the fixed percentage value used to select the threshold
from the mean. It is unlikely that a single value will be appropriate for use
with a variety of image types. It does, however, seem highly appropriate for
thresholding text, a function that it seems it was designed to perform.
Figure 4.15 gives the complete source code for thrdd.c.