Page 257 -
P. 257
6.1 Pattern Primitives 245
known beforehand, whereas the previous algorithm can also be used in real time
signal processing.
After the signal is decomposed into line segments, one can label these according
to a specific rule. For instance, one may use the information on the slope of each
segment to set slope thresholds in order to obtain the labels h, u, d, U, D mentioned
in section 1.2.3. In that section we defined an h primitive as a line segment with
zero slope; usually it is more convenient to set two slope thresholds, A, and A2,
used for the segment labelling as u or d and as U or D, respectively, therefore
defining h as any segment with slope below A]. This was done for the ECG signal
shown in Figure 6.1 with AI=O.l and A2=5. We will use this labelling approach in
the following examples.
6.1.2 Image Primitives
Image primitives can be obtained through the application of a large variety of
image analysis techniques, such as image segmentation, edge detection, contour
following and medial axis transformation, described in detail in many textbooks on
the subject (e.g., Duda and Hart, 1973 and Rosenfeld and Kak, 1982). In the
following we describe some popular ways of deriving image primitives.
Chain Code and Templates
Chain code (Freeman chain code) constitutes an easy way of encoding a two-
dimensional curve, represented in a rectangular grid with sufficient resolution. It
consists of following the curve from a specified starting point and, for each line
segment, connecting the grid points that fall closest to the curve. The grid point
connections are then coded according to a set of octal primitives, as shown in
Figure 6.2.
This technique is usually applied to binary images when one wants to encode
the silhouette of an object by contour tracking, as shown in Figure 6.2, where the
string starting at the highest vertical point and following the contour in the
clockwise direction is: x = 6007656454324221002.
Chain coding of binary images is easy to implement and often provides a very
good description. The difficulty with this technique is that, for an accurate enough
representation, it may need a very fine grid, then generating very long strings. An
alternative is to use template images, which are then considered the primitives.
Classic templates are also shown in Figure 6.2. Starting from the highest vertical
grid cell that is not empty, one can follow the contour in a clockwise direction,
selecting the template that best corresponds with the current contour cell, obtaining
in this case the string x = 48261 1999 337741812.
The use of templates for primitive description of binary images is applied in
many image recognition tasks, for instance, in some implementations of character
recognition and in fingerprint identification.