Image Processing Reference
Fig. 4.17 Ideal histogram: a clear definition of object and background. Problematic histogram:
the distinction between the object and the background is harder, if not impossible
One might argue that we loose information when doing this operation. However,
imagine you are designing a system where the goal is to find the position of a person
in a sequence of images and use that to control some parameter in a game. In such a
situation all you are interested in is the position of the person and nothing more. In
this case, thresholding in such a manner that the person is white and the rest is black,
would be exactly what we are interested in. In fact, we can say we have removed the
redundant information or eliminated noise in the image.
Thresholding is normally not described in terms of gray-level mapping, but rather
as the following segmentation algorithm:
if f(x,y) > T
where T is the threshold value. We might of course also reverse the equalities so
that every pixel below the threshold value is mapped to white and every pixel above
the threshold value is mapped to black.
In many image processing systems, thresholding is a key step to segmenting the
foreground (information) from the background (noise). To obtain a good threshold-
ing the image is preferred to have a histogram which is bi-modal. This means that
the histogram should consist of two “mountains” where one mountain corresponds
to the background pixels and the other mountain to the foreground pixels. Such a
histogram is illustrated to the left in Fig. 4.17 . In an ideal situation like the one
shown to the right, deciding the threshold value is not critical, but in real life the
two mountains are not always separated so nicely and care must therefore be taken
when defining the correct threshold value.
In situations where you have influence on the image acquisition process, keep this
histogram in mind. In fact, one of the sole purposes of image acquisition is often to
achieve such a histogram. So it is often beneficial to develop your image processing
algorithms and your setup (camera, optics, lighting, environment) in parallel.