You are on page 1of 19

Pattern Recognition 38 (2005) 1596 1614

www.elsevier.com/locate/patcog

Corner detection and curve segmentation by multiresolution


chain-code linking
Fabin Arrebola , Francisco Sandoval
Dpto. Tecnologa Electrnica, E. T. S. I. Telecomunicacin, Universidad de Mlaga, Campus de Teatinos, s/n, 29071 Mlaga, Spain
Received 16 March 2004; received in revised form 2 March 2005; accepted 2 March 2005

Abstract
In this paper, we propose a new method to characterise a curve by means of the hierarchical computation of a multiresolution
structure. This structure, consisting of successive lower resolution versions of the same object, is processed using the linked
pyramid approach. We adapt the multiresolution pixel linking algorithm to the processing of curve contours which are
described by their chain-code. We also introduce a selective class selection process which allows application of the algorithm
to segmentation and detection of contour features. The resulting framework presents good performance for a wide range of
object sizes without the need of any parameter tweaking, and allows detection of shape detail at different scales.
2005 Pattern Recognition Society. Published by Elsevier Ltd. All rights reserved.
Keywords: Chain-code; Contour segmentation; Corner detection; Linked pyramid; Curve pyramid

1. Introduction
The analysis and characterisation of contours in digital
images has attracted and continues to attract great interest in
the computer vision community. From this characterisation,
a number of features can be obtainedcorners, inection
points, etc.that offer useful information for object identication and modelling tasks, scene analysis, information
retrieval from large image databases, motion estimation or
stereo vision, etc.
A taxonomy of 2D curve characterisation methods could
start by classifying them into two large groups: curve tting
[18] and curvature-based algorithms [918]. Literature offers many methods for tting digital curves, polygonal approximations [14] are the simplest ones: they search for
the polygon with the minimum number of sides that best ts
the curve, for a given error criterion. Hough-based methods
can be applied to achieve linear tting from a planar set of
Corresponding author. Tel.: +34 952 1327231;
fax: +34 952 131447.
E-mail address: fabian@dte.uma.es (F. Arrebola).

points [5]. Nevertheless, curved portions are better approximated with higher-order curve-pieces: Pei and Horng [6]
perform a generalisation of Perez and Vidals method [2]
to the case of circular arcs. Sarkar et al. [7] t a digital
curve with line segments and circular arcs using genetic algorithms. Rosin and West [8] propose an algorithm for segmenting connected points into a combination of representations such as lines, circular, elliptical and superelliptical
arcs, and polynomials.
On the other hand, curvature-based algorithms characterise the contour by computing its curvature at each
point. The contour is completely characterised by its curvature function: maxima and minima correspond to corners,
zero-valued intervals correspond to straightline segments,
intervals of non-zero constant value correspond to circle
arcs, etc. Different methods can be used to estimate the
curvature of a contour. Single scale methods are based upon
an analysis of the neighbourhood of a point. Two curve
segments of K points about the point of study are compared
to give an estimation of the curvature [912]. For instance,
Freeman and Davis algorithm [10] starts by calculating
the local curvature for each point i, LC(i), as the angle

0031-3203/$30.00 2005 Pattern Recognition Society. Published by Elsevier Ltd. All rights reserved.
doi:10.1016/j.patcog.2005.03.006

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

between x-axis and the forward direction of the straightline


segment containing K points before i. Incremental curvature,
I C(i), is then obtained for each point of chain as I C(i) =
LC(i K) LC(i + K). Finally, they dene cornerity
as the product of the lengths of uniform chain sections to
either side of a point, times the angle of discontinuity of
that particular point.
The main problem of these methods is that an adequate
value must be chosen for K, the length of the segments, in
order to account both for the noise level and the local structure of the curve. A compromise must be made, as if K is
too small, noise will be fed to the curvature function, resulting in spurious feature detections. On the other hand, if K
is too large, near distinguished points can be smoothed out.
This is a fundamental problem due to the fact that details
in contours can be found at different scales. This makes it
very difcultif not impossiblefor a single scale method
to work well in every situation [3]. An alternative approach
is to use a method to adaptively select a value for K, depending on the characteristics of the curve [1315]. Similarly, Ray and Pandyan [16] use another adaptive technique:
they propose to measure the variation in the roughness of a
curve using variance of curvature to determine the smoothing level. Optionally, a single scale method can be iteratively
applied while the value of the input parameters is varied
over a range [17,18]. Beus and Tiu [17] apply Freeman and
Davis algorithm [10] iteratively with different values of K,
resulting in more stable detected corners.
This brings us to multiscale methods [1927], which represent the evolution (or deformation) of the original contour
when a certain parameter value is varied. One of the most
attractive and widely used techniques is the Gaussian scalespace [1922]. A set of progressively smoother versions of
the curve is generated by applying series of Gaussian lters
with different standard deviations. This generates a curve
family that describes the contour at different levels of detail. Literature offers other multiscale methods: Saint-Marc
et al. [23] propose an adaptive scale-space approach where
the smoothing operations preserve the discontinuities in the
curve. Different scales are dened by the size of the discontinuity that is preserved. Antoine et al. [24] apply a 1-D
continuous wavelet transform to build the W-representation.
Jang and Chin [25] apply erosion and dilation operators to
build a morphological scale-space. Beau and Singer [26]
generate a logarithmic scale-space through application of
hierarchical discrete correlation. They propose the use of
a special Gaussian pyramid which allows feature detection
suited to coarse pattern recognition. Meer et al. [27] introduce the Chain pyramid, a pyramidal structure used for
multiscale representation of chain codeable curves. In order
to build it, a probabilistic allocation algorithm (PAA) is applied, followed by a data compression and smoothing process. In this structure, each curve part represented in a node
is linked to curve parts in adjacent nodes, yielding a doubly
linked list at each level of the pyramid. Chen and Chen [28]
proposed a tree encoding of chain codes through a recur-

1597

sive transformation of the chain code into a linear quadtree.


The algorithm uses a look-up table method for generating
the quadtree nodes and the new chain code elements.
In this paper, we propose a novel method for the characterisation of 2D curves by means of the hierarchical computation of a special and simple multiresolution structure.
This structure is composed of the chain codes of progressively smoother, lower resolution versions of the original
curve. The structure is processed by an algorithm that borrows from the concepts of linked pyramid and multiresolution pixel linking (MPL) introduced by Burt et al. [29] for
grey-scale image processing.
A linked pyramid is a regular pyramid where the relationship between parent and son nodes is not xed, but is
allowed to vary while the algorithm converges. The MPL
method [29] for the image pyramid consists of two phases:
(i) Stabilisation of structure links: Each node is linked to the
most similar of its candidate parents. The values of parent
nodes are then recalculated using only linked sons. Relinking and recalculation are iterated until stable links are obtained, i.e., links remaining unaltered after two consecutive
iterations. The pyramid has now converged to a stable link
structure, i.e., a tree. In this tree each level k above the base
can dene a segmentation of the image. (ii) Class generation: A level k is chosen and the gray level of every node is
propagated towards the son nodes in level k 1. The process
is repeated in all levels down to the base level. The image
will be divided into 4(Mk) classes, M being the top level
of the pyramid. This segmentation algorithm simultaneously
performs image smoothing and edge enhancement.
Linked pyramid approaches have limitations. Firstly, not
all possible subdivisions of the image can be represented,
and artefacts can occur in the segmentation of particular
shapes such as elongated ones. This is due to rigidity of
the regular pyramidsregular grid, xed reduction window,
xed decimation ratioalthough the fundamental reason for
this shortcoming is the subsampling introduced in the higher
levels of the pyramid [30]. Bister et al. propose to use irregular tessellations [30]. The second problem is the fact that
classes represented by a node need not correspond to connected regions in the base. The relinking process takes the
spatial structure of the image into consideration by allowing
only a xed set of possible sons for each node. The algorithm does not use connectivity: nodes which are adjacent
in some higher level of the pyramid need not represent adjacent regions in the base level, or viceversa. This can cause
the creation of regions which are scattered over the image
and which consist of many connected components.
This work will adapt the concepts of linked pyramid and
MPL algorithm with the goal of transforming the initial
chain code of a curve into a stepwise constant function that
characterises the contour. This function has two fundamental
features: (i) its discontinuity points on the x-axis indicate
the break point locations of the segments into which the
original contour will be segmented. These points are corners
separating straightline segments and high curvature points

1598

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

in curved segments. (ii) The height of the steps denes the


orientation assigned to each curve segment. This results in
a robust segmentation of the contour.
It should be noted that our approach is not equivalent to
the one employed in image pyramids [29], as smoothing
and reducing an image multiple times, and then detecting
a curve, is not equivalent to detecting a curve, and then
smoothing it and reducing the number of elements in the
curve [26]. However, Burt et al. method has the desirable
property of making all resolution levels participate in the
processes of node grouping and classication. In adapting
MPL, this paper makes the additional contribution of solving
the previously mentioned problems for regular pyramids.
This results in a satisfactory performance of the method over
a wide range of object sizes, and allows detection of shape
detail at different scales without any parameter tweaking.
In chain pyramid [27], Meer et al. apply PAA in order to
the eliminate artefacts of contour processing on pyramids
and later they compress and smooth. In contrast, our method
applies a corrective pass to our stable link structure followed
by a selective propagation process.
In Section 2 we present the construction of a hierarchical
data structurethe curve pyramidfrom the chain-code of
the curve. In Section 3 we apply Burt et al.s linked pyramid
approach [29] to obtain a stable link structure for the curve
pyramid. Section 4 describes a basic method to obtain segmentation of the curve into different classes or segments.
It will be seen that this basic method must be modied for
two reasons: rst, the obtained classes do not always correspond to connected segments. Secondly, the number of segments depends strongly on the values of the parameters of
the method (and this number is always either too small or
too large). These problems are tackled in Section 5, where
we introduce a novel class generation mechanism including selective propagation of classes that solves the problem
of contour segmentation. Section 6 presents results of our
method and compares its performance with alternative approaches. Finally, Section 7 presents the main conclusions.

2. Generation of the curve pyramid


A curve pyramid and an image pyramid are built in a
similar way. Filtering, followed by subsampling, are applied
to the original signal. Thus, each pyramid level (k) holds
a smoothed and subsampled version of the signal at the
level below (k 1). Different combinations of subsampling
factors and ltering kernel types (Gaussian or uniform, with
or without overlapping, etc.) result in different pyramids
[31].
In this work the signal is a curve, described by a chaincode. For each point, the chain-code describes the direction
to be followed in order to nd the next point in the curve.
For the associated pyramid, a subsampling factor of 2 and
a uniform kernel with no overlapping are used. The kernel
has two coefcients with value 0.5. Thus, the number of

elements at each subsequent level is approximately half the


number of elements of the level below. At level k + 1, the
number of elements can be expressed as
Nk+1 = (Nk + 1)/2,

(1)

where x is the oor function of x, i.e., the nearest integer


less than or equal to x. The number of levels of resolution
in the pyramid is
M = log2 (N0 ) + 1

(2)

where x is the ceiling function of x, i.e., the smaller integer


greater than or equal to x. N0 is the number of points in the
original curve, which is equal to the number of nodes at the
base of the pyramid. At level k + 1, the chain-code of node
i, Cik+1 , is the average between the chain-codes of nodes 2i
and 2i + 1 at level k:
k + Ck
Cik+1 = [(C2i
2i+1 + Off)/2]mod 8 ,

0  i < Nk+1 ,
(3)

where Off takes the following values:



k Ck
0 if |C2i
2i+1 | < 4,
Off =
k Ck
8 if |C2i
2i+1 | > 4.
For open contours and Nk even, to calculate the chain-code
of the last node at level k + 1, C k+1
k , Eq. (3) is not applied.
Nk+1

k
. For closed
Instead, it is directly assigned the value of CN
k 1
contours, each layer in the structure is treated as a circular
list, and Eq. (3) must be modied accordingly:
k + Ck
Cik+1 = [(C2i
(2i+1)

mod Nk

+ Off)/2]mod 8 .

(4)

k+1
If Nk is odd, CN
is computed as the average between
k+1 1
k
k
CN 1 and C0 . This can be seen in Fig. 1a, where levels 0
k
and 2 in the data structure present an even number of nodes.
In the following we shall only consider closed contours.
Figs. 1b and c illustrate an example of applying the ltering and subsampling processes to a contour chain code.
Fig. 1b shows a contour with 443 pixels and Fig. 1c shows
the chain code of the rst six resolution levels of the corresponding curve pyramid. Section A in Table 1 indicates the
number of nodes at each level and the number of averages
computed to generate those levels. At each pyramid level,
the spatial resolution is decreased, but the angular resolution
is increased. Thus, while the number of nodes is reduced,
the number of allowed orientations is doubled. At level k, a
node can take up to 2k 8 values within the interval [0, 8).
The total number of nodes in the structure, NT , depends
on the number of points in the original curve, N0 , and also
on how close this number is to being a power of 2. When
N0 = 2i , each level holds exactly half the number of nodes
at the level below Nk+1 = Nk /2:

NT |N0 =2i =

M1

k=0

Nk =

0

n=M1

2n = 2M 1 = 2N0 1.

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

(a)

1599

(b)

(c)
Fig. 1. Generation of the curve pyramid: (a) example of hierarchical structure; (b) closed contour; and (c) curve pyramid of Fig. 1b chain
code of the rst 6 levels.

1600

Table 1
Algorithm evolution for the contour of Fig. 1b
A. Generation of the curve pyramid (bottom-up)
Level

443

222
222

111
111

56
56

28
28

14
14

7
7

225
0

225

115
6
12
1
2
129

60
8
17
1
0
77

31
4
7
0

38

14
4
7
1
2
23

7
1
2
0

Levels

01

12

23

34

45

Detected crossed links


Affected nodes
Computations (Eq. (11))

1
2
2

3
7
7

4
13
15

1
14
16

3
11
12

Levels

01

12

23

34

45

Total

Computed variances
Permitted propagations
Inhibited propagations
Nodes without sons

0
443
0
0

0
218
0
4

0
103
0
8

28
38
7
11

14
8
14
6

42
810
21
29

Nodes (Nk )
Computations (Eq. (4))

Total nodes
k = 0...6

Total comp.
k = 0, . . . , 6

881

438

Total comp.
k = 0, . . . , 5

Total comp.
k = 0, . . . , 6

492

501

56

Total
P =5

Total
P =6

1
7
7

12
47
52

13
54
59

B. Generation of a stable link structure (iterative)


Level
Iteration

1
2

Computations (Eq. (11))


Changes
Computations (Eq. (11))
3
Changes
Computations (Eq. (11))
Total computations per level
C. Correction of crossed links (bottom-up)

D. Selective propagation (top-down)

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

The worst case corresponds to when N0 is a power of two


plus one, thus, the number of nodes at each level is Nk+1 =
Nk /2 + 1, and therefore, NT > 2N0 1. We can easily
calculate the number of elements in the worst case. We start
with a pyramid with N0 = 2i nodes at the base. If we add
one node to the base, we realise that both the number of
levels M, and the number of nodes per level are incremented
in a unit. In this worst case, N0 is derived from Eq. (2) as
N0 = 2M2 + 1 and consequently:
NT |N0 =2i +1 =

M1

k=0

=M +

Nk = 1 +
0


0


1601

Left
Right

(2n + 1)

n=M2

2n = M + 2M1 1

n=M2

= 2N0 + M 3.
Apart from the chain code Cik , each node i contains two
additional elds: the length or number of pixels, Lki , associated with the node, and the position of its parent, Fik , in
the higher level. When the pyramid is built, the nodes at the
base have the eld L0i set to 1. The nodes in the rest of the
levels have this eld initialised to zero.
It should be noted that our curve pyramid is much simpler
than chain pyramid [27], because it is created by repeatedly
averagingand subsamplinga sequence of codes. In this
initialisation stage the receptive eld of parents is 2(1 2)
instead of 4(2 2), but in the next stage that number is
variable between 0 and 4in a receptive eld of 1 4. With
regard to contour fragments associated with nodes, we work
directly with orientations, whereas Meer et al. [27] use line
centroid coordinates.

3. Generation of a stable link structure


In this section, we adapt the MPL algorithm [29] to obtain a stable link structure associated with the curve pyramid described in Section 2. The algorithm has two stages
which are iteratively applied until convergence is reached.
The rst stage (linking) creates links between subsequent
levels (parent and son nodes). The second stage (regeneration) re-computes the chain-code of each parent node, taking
into account the son nodes that were linked in the previous
stage. This process is performed level by level until convergence, i.e., the linking and regeneration stages are repeated
with levels 0 and 1 until the links do not change, then with
levels 1 and 2, and so forth.1
1 Similarly to the image pyramid, as the algorithm iterates,

parent nodes are computed from a more homogeneous subset of


sons. Simultaneously, parents at a given level become more different (differences are enhanced). Similarities and differences between nodes are exploited, leading to a quick convergence of the
algorithm to stable subtrees.

Fig. 2. Possible links between nodes of hierarchical structure.

At the linking stage, we apply the 4 to 2 principle.


This means that (i) each son node is linked with the most
similar among two possible parents, and (ii) each parent can
be linked to 04 sons. Consequently, for closed contours, a
node i at level k has two candidate parents at level k + 1.
Their positions, l (left) and r (right) are dened as follows:
l = ((i + 1)/2 1 + Nk+1 )mod Nk+1 ,
r = ((i + 1)/2)mod Nk+1 .

(5)

Fig. 2 gives an example showing son nodes linked with


their candidate parents. Broken lines represent links with
l-parents and bold lines represent links with r-parents. It
should be noted that the rst node at level k can always link
to the last node at level k + 1. However, when Nk is even,
the last node at level k can only be linked with the rst node
at level k + 1. It can also be seen that any parent node can
have up to a maximum of 4 sons. For Nk odd, the rst and
last nodes at level k + 1 can have a maximum of three sons.
In order to choose among candidate parents, the differences between the chain-code of the son node and each of
the parents, Dleft and Dright , are computed as follows:
Dleft = min{|Cik Clk+1 |, (8 |Cik Clk+1 |)},
Dright = min{|Cik Crk+1 |, (8 |Cik Clk+1 |)}.

(6)

The eld Fik of a son node can therefore take the following
l or r according to the rule:

l if Dleft < Dright ,
Fik =
(7)
r if Dleft > Dright .
If Dleft and Dright are equal, as will be shown in Section 4,
the son node is linked to the parent node at position i/2 at
level k + 1. This position Fik can be expressed as a function
of l and r:

l if i is odd,
Fik |Dleft =Dright =
(8)
r if i is even.
Once all the links between adjacent levels are established, the regeneration stage computes both the length
and the chain-code elds of each parent node, taking into

1602

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

Fig. 3. Generation of a stable link structure. Chain code of the rst 6 levels before stabilisation (+) and after (bold line).

account the sons linked in the previous stage. Node i at level


k + 1 has four potential sons at positions Sik+1 :
Sik+1 [(2i 1 + Nk )mod Nk , (2(i + 1))mod Nk ].

(9)

If Nk is odd, this interval has length 3 for nodes i = 0 and


Nk+1 1, as previously mentioned.
The length associated with node i at level k + 1, is the
sum of the lengths of its sons:

=
Lkj ,
(10)
Lk+1
i
j S

is set
where S is the set of son nodes. If S = , then Lk+1
i
to zero.
The chain-code of a parent node is a function of the
chain-codes and associated lengths of its sons nodes. The
contribution of each sons node to the chain-code of its parent
is proportional to its length. Therefore, if a son node has zero
length, it has no inuence on the chain-code of its parent.

Three cases can be distinguished for the computation of the


chain-code Cik+1 , depending on the number of associated

sons nodes. For zero sons, Cik+1 remains unchanged. If the


node has only one son, it adopts its chain-code. For two
sons a and b with chain-codes Ca and Cb , and lengths La
and Lb , respectively, the chain-code of the parent becomes:


(Cak + Offa )Lka + (Cbk + Offb )Lkb
k+1
Ci
=
, (11)
Lka + Lkb
mod 8
where Offa and Offb take the following values:
Offa = 0,
Offa = 0,
Offa = 8,

Offb = 0
Offb = 8
Offb = 0

if |Ca Cb | < 4,
if Ca Cb > 4,
if Cb Ca > 4.

If the number of sons is 3 or 4, Eq. (11) is applied two


or three times, respectively. Fig. 3 illustrates the link stabilisation process on the curve pyramid associated with the
curve of Fig. 1b. Depicted are the values of the chain-code

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

before stabilisation (plus sign) and after (bold line). It can


be seen that both are identical at the base, but become
more and more different as we progress up the pyramid (see
footnote 1).
Linking is needed in order to obtain a stable tree where
each level above the base will dene a partition of the contour. Testing has shown that convergence of the stabilisation
process is fast. This makes sense, as at the rst iteration all
parent nodes are regenerated. Further regeneration is needed
only where links have changed. This happens seldom, and as
a result two or three iterations are enough for convergence.
This can be seen in section B of Table 1, which illustates
the evolution of the stabilisation algorithm by showing
the number of iterations needed to stabilise each level, as
well as the number of required link changes and
computations2 for each iteration.
Another two different implementations of the stabilisation
process have been tested. The rst implementation modies
the generation of nodes at the base, setting a length of
2 for a node if its chain-code indicates a diagonal orientation, or 1 if not. The length for a parent node is left as
normal (Eq. (10)). The second implementation does modify
the length of each parent node, which is computed as the
Euclidean distance between its most distant sons nodes. The
rst implementation adds a negligible computational load
to the algorithm. The second, however, requires storing a
two-component vector for the node and computing its norm.
Analysis of three implementations shows that they are almost identical. It should also be remembered that what is
important at this stage is the computation of the link structure. Therefore these two different implementations were
rejected in favour of the rst one.

4. Class generation using non-selective propagation


As a result of the link stabilisation process, each node
at level k will have only one parent at level k + 1. If its
length eld is different from zero, it will also have a number
of descendants at levels k 1, k 2, . . . , 0. In the spirit
of Burt et al. [29] approach for segmentation of images, a
segmentation of the contour can be obtained by choosing a
suitable level P in the structure, then propagating the chaincode of each node at this level CiP to all its descendants
until the base is reached, as follows:
CjP 1 = CiP |F P 1 =i ,
j

Cj0 = Ci1 |F 0 =i ,
j

0  j < NP 1 ,

0  j < N0 ,

0  i < NP ,

0  i < N1 .

(12)

2 By computations it is meant the number of times that Eq.


(11) is applied to add two nodes. This is a better indicator of the
computational load than the number of computed nodes, as the
computation for one node depends on the number of sons linked
to it.

1603

This propagation process results in a stepwise constant


chain-code function for the nodes at the base. Discontinuity points of the stepwise function dene on the x-axis
the bounds of the segments into which the original contour
will be divided. The height of the steps denes the average orientation assigned to each curve segment. Figs. 4ad
illustrate the sensitivity of the segmentation results to the
propagation start level P. The segmentation is performed
on the contour in Fig. 1b, with P varying from 3 to 6. The
chain-codes resulting from the stabilisation and propagation stages, the resulting number of segments Nseg and the
contour with the distinguished points are illustrated.
The previous example illustrates the limitations of regular pyramids, which have been previously reported [30]. In
particular:
(i) The segmentation results depend strongly on the chosen propagation level P: if P is large (close to M), too few
segments are generated, and very different orientations can
be fused in the same segment. On the other hand, if P is
close to the base of the structure, too many segments are
obtained, and this results in segments with uniform orientation being subdivided. Furthermore, there is no value of
P in the interval which produces a segmentation consistent
with the ground truth segments and corners of the original contour. This prevents consistent segmentation of the
contour.
(ii) The second observation is related to the fact that the
algorithm does not use connectivity [30]. Therefore nodes
which are adjacent in some higher level of the pyramid
need not represent adjacent segments in the base level, or
viceversa. This problem can also be appreciated in Fig.
4: For P = 6 and 5, the number of resulting segments
is greater than the number of nodes at the propagation
level3 (Nseg > NP , ), as shown in Figs. 4a and b. This is
due to the existence of parent nodes whose set of sons do
not form a connected segment in levels lower than P. This
implies that the descendants at the base are scattered, resulting in oversegmentation of the contour. Fig. 4a, for example, shows segments s_0, s_2 and s_4 as descendants of
the same node, as well as segments s_1, s_3 and s_5. This
problem also manifests itself in the noisy intervals of the
step function for P = 3, 4 and 5. The origin of this problems
is the existence of crossed links in the stabilised structure.4
The rst observation suggests the need for a selective
propagation mechanism in the class generation process and
the elimination of the starting level P as an input parameter
of the method. The propagation process dened by Eq. (12)
has to be modied so that a son does not necessarily inherit
the value of its parent. It will be seen that P can be dened
to be the highest level in the pyramid with a number of
3 This only happens when connectivity is lost in some nodes.
4 Recall that when a choice must be made between two parents

with identical chain-code, the stabilisation stage links a node with


the nearest parent. This is done to reduce the chance of crossed
links remaining.

1604

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

S0 S
1

S3

S2

S1

S0 S2

S3

S4

S5

S5

S4

(a)

(b)

(c)

(d)

Fig. 4. Class generation using non-selective propagation. Segmentation results with start level P varying from 3 to 6.

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

nodes equal or greater than 8, i.e., NP  8 and NP +1 < 8.


From the second observation it is deduced that a correction
of the structure, prior to the class generation, must be made
to eliminate the possibility of crossed links. These needs
will be tackled with the introduction of a new segmentation
process, introduced in Section 5.
5. Contour segmentation using selective propagation
We start by introducing a bottom-up corrective process
in order to remove crossed links from the base upwards the
propagation level. The mechanism is simple: crossed links
are rst detected, and then eliminated by modifying one
links to the affected nodes. Crossed links appear when two
neighbour nodes at level k, i and j (i < j ) have neighbour
parent nodes r and l (r > l):
(Fik > Fjk )|(i < j ).

(13)

Crossed links originate only when node i is odd (j is even),


as illustrated in Fig. 2. Once the position of pair (i, j ) is
detected, one of the two nodes must change its parent, so
that the following condition holds:
(Fik  Fjk )|(i < j ).

(14)

The less signicant node, i.e., that one with smaller length
eld Lki , Lkj is the node that changes parent. Once this
corrective step is performed, the chain-code and the length of
the affected parent nodes must be recomputed. Fig. 5 shows
the results of the segmentation of the contour in Fig. 1b, prior
to propagation and class generation, when the correction
step is introduced. For P = 5 and 6, the number of resulting
segments becomes now equal or less than the number of
nodes at the propagation level P (Figs. 5a and b). The noisy
intervals for P = 3 and 4 have disappeared (Figs. 5c and d).
The computational load associated with this corrective
step is illustrated in section C of Table 1. Shown are the
number of detected crossed links, the number of affected
nodes and the number of times that Eq. (11) is applied to
regenerate each pair of adjacent levels. For P = 5, only
12 crossings exist, which affect 47 nodes, the 5.3% of the
total number of nodes from the base to P. For P = 6, the
percentage of affected nodes raises to 6.1%. This is due to
the fact that n crossings result in more than 2n regenerations,
as a crossing at a level k close to the base affects not only
its two parents at level k + 1, but also all its ascendants up
to level P.
Once the stabilised structure is corrected the next step in
the segmentation process provides a selective class propagation. Each child node in the higher levels of the pyramid
adopts or not the chain-code value of its parent according
to a certain rule. Lower, closer to the base nodes propagate
their values as in Eq. (12), i.e., sons nodes in the lowest
levels always inherit the value of their parents chain-code.
We have evaluated alternative approaches to selective
propagation. The simplest one is based on the difference

1605

between the chain-codes of parent and son nodes. Propagation is made only when this difference is less than a certain
threshold. This improves on the results obtained with nonselective propagation. However, this approach introduces a
new parameterthe thresholdwhose value will strongly
depend on the particular characteristics of the contour. Our
goal is to be able to detect details at different scales, and
work with objects of different sizes, without any parameter tweaking. This approach is therefore discarded, as are
other, more sophisticated ones, but still based on the difference of chain-codes. We nally adopted an approach based
on the variance of the parent nodes. When the variance of
a parent node is less than a certain threshold, its sons inherit its chain-code. Conversely, if the variance is over the
threshold, none of its sons change its value. The variance
of node i at level k + 1 is computed with the following
expression:
Vik+1

=

k+1
k
Cjk |, (8|Cik+1 Cjk |)})2
j |Fj =1 Lj (min{|Ci
.
Lk+1
i

(15)
This quanties the dispersion among the sons of node i, i.e.,
the dispersion in the orientation of the segments corresponding to each node.
Various strategies were attempted for the task of nding
a suitable threshold for the variances of parent nodes. Initially we applied a global threshold to the whole structure.
A second implementation applied a local threshold to each
resolution levelmore restrictive in higher levels, and less
so in lower levels of the structure. The solution that gives
the best results, and is therefore nally adopted, is to apply
a local threshold to each node which is inversely proportional to the length of the node. The propagation process is
thus dened as follows:
Cjk1 = Cik |(F k1 =i)&(V k <1/Lk ) ,
j

0  j < Nk1 ,

0  i < Nk ,

Cjk1 = Cik |(F k1 =i) ,


0  i < Nk ,

PS  k > 0,

P  k > PS ,
(16)
0  j < Nk1 ,
(17)

where PS is the resolution level that separates higher levels, where selective propagation is used (Eq. (16)), and
lower levels, where unconditional propagation is applied
(Eq. (17)). The value for P and PS has been empirically
found. PS depends only on the propagation level P, the highest level in the pyramid with a number of nodes equal or
greater than 8:
PS = P /2.

(18)

Fig. 6a shows the nal state of the resolution levels once


the whole segmentation process is applied to the contour in
Fig. 1b. The initial state of each resolution level was illustrated in Fig. 1c, and the state after stabilisation was shown

1606

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

(a)

(b)

(c)

(d)
Fig. 5. Elimination of crossed links. Segmentation results with non-selective propagation but without crossed links.

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

1607

(a)

(b)
(c)
Fig. 6. Contour segmentations using selective propagation: (a) segmented curve pyramid. Chain code of the rst 6 levels, (b) segmented
contour, and (c) derivative of the step function at the base level (curvature function).

in Fig. 3. The selective propagation process results in a number of segments (number of constant value intervals for the
chain-code function) equal to the ground-truth number of
segments of the original contour at level 0 of the pyramid,
and also at levels 1 and 2. The value of the chain-code function at the steps gives the global orientation of each segment
in the curve. Fig. 6b shows the result of the segmentation,
where small circles on the contour correspond to disconti-

nuity points of the stepwise constant chain-code function,


which coincide with the distinguished points (corners, in
this case) of the object to be segmented. Fig. 6c shows the
derivative of the step function at level 0, which can be seen
as the curvature function of the contourlocal maxima indicate the position and curvature value of the concave corners of the object, whereas local minima indicate the position and value of the convex corners of the object. Finally,

1608

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

section D of Table 1 shows details of the computation involved in the selective propagation stage. Only 42 variances
have to be computed, which represent 4.8% of the total number of nodes in the structure. Twenty-one nodes have parents
whose variance is over the local threshold and therefore do
not change its chain-code value.

6. Results
This section evaluates the performance of the proposed
method through its application to a set of contours of various
sizes and shapes. We also compare the results with those
obtained by two monoscale methods.
Fig. 7 shows results of applying the method to nine different contours. For each contour, the original contour and
the obtained segments are illustrated, together with quantitative information on the segmentation and associated hierarchical structure, including: (i) number of points in the
contour (number of nodes in the base of the pyramid) N0 ,
(ii) propagation level P (number of resolution levels above
the base which are used), (iii) number of resulting segments
C, (iv) integrated square error (ISE), which is the error between the real contour and the polygonal approximation
formed by the detected segments, and (v) the gure of merit
(FOM) proposed by Sarkar [32] to evaluate the performance
of the segmentation, which is computed as the ratio between
the compression factor (CF) and the ISE. CF is dened as
CF = N0 /C.
Due to the fact that ISE changes more rapidly than the
CF for almost all test shapes, Marji and Siy [33] propose a
modied version of Sarkars FOM: F OM n = (CF )n /I SE.
They introduce the parameter n to control the contribution
of the numerator to the overall result in order to reduce the
imbalance between the two terms. Therefore, in order to
compare our method we will use Sarkars FOM as well as
Marji and Siy modied FOM.
The contours in Fig. 7 are varied in its shape, structure and
size: The contour in Fig. 7a is a scaled and rotated version of
the one in Fig. 1b, consisting of straightline segments only.
The contours in Figs. 7b, c and e contain both straight and
curved line segments, but Fig. 7b and e contains sections
with high curvature, whereas Fig. 7c contains only low curvature sections. The contour in Fig. 7d has mainly curved
segments, whereas the one in Fig. 7f includes only straight
ones, much shorter than those in Fig. 7a. Finally, Figs. 7g
and h contain two contours with very few points if compared
with the one in Fig. 7i which contains over 3000 pixels.
An extensive number of tests, performed on a variety of
contours, show that the proposed method presents very good
performance. In particular, the method:
(i) generates segmentations which are stable to rotations
and scale (Figs. 1b and 7a),
(ii) provides the orientation assigned to each curve segment. Besides, the angles associated to corners can be

easily obtained and its amplitude is accurately calculated (see Fig. 6c).
(iii) can detect near corners (Figs. 7fi), as well as small
variations in orientation in the contour (Figs. 7c and e).
(iv) works with a wide variety of contour sizes (Figs. 7ai)
without any parameter tweaking. The parameters P,
PS and the propagation threshold depend only on the
particular features of the contour.
(v) the break point locations of segments are accurately estimated, resulting in relatively low ISE values. Therefore, the method reaches high FOM values even in
contours that contain both straight and curved line segments (Fig. 7e) as well as in those that present low
curvature sections (Fig. 7c). As expected, the FOM
decrease in contours with curved segments (Figs. 7b
and d).
The good behaviour of the method can be illustrated by
comparing its performance with two other methods: Gaussian ltering (GFM) [1921] and circular histograms (CHM)
[12], which allow segmentation of a contour by detecting
the minima and maxima of the computed curvature function.
We have chosen these methods as previous work [11,12] has
compared them with other techniques [2,34], stating their
good behaviours in terms of computational load, precision
and stability of the detected corners. Figs. 8 and 9 show the
results obtained with GFM and CHM, respectively, when
their parameters are varied. The parameters for GFM are
the variance of the Gaussian lter (W = 2 ) and the decision threshold U. The parameters for CHM are the segment
length for which the circular histogram is computed (K)
and the decision threshold U. For both methods the parameters have been set so that the 23 segments in the contour
of Fig. 1b are correctly detected. The associated evaluation
measures are the ISE, FOM and C. Note that P indicates
here the number of pixels in the contour.
Fig. 8(1)af show results of segmentation with W = 4.0
and U = 0.0004. In Fig. 8(1)a all 23 segments are correctly detected, whereas in Fig. 8(1)f, where corners are
close to each other, only 10 segments are detected. Figs.
8(1)be, where contours present curved segments, show a
much smaller FOM than the proposed method. Figs. 8(2)
af are obtained with W = 2.5 and U = 0.009. Reduction
of the variance of the lter allows GFM to detect shorter
segments associated to near corners (Fig. 8(2)f). However,
if the decision threshold is incremented two corners are
lost (Fig. 8(2)a). The increment in U cannot avoid oversegmentation for several contours (Figs. 8(2)b and e). This is
due to a low signal to noise ratio of the curvature function obtained with these parameter values. Finally, Figs.
8(3)af are obtained with W = 6 and U = 0.002. This
is the maximum value for the variance which still allows
detection of the 23 segments of the contour in Fig. 1b.
The lost corner in Fig. 8(3)a is still not detected, no matter how much is U allowed to decrease. These parameter
values, for instance, improve the FOM in Fig. 8(3)e with

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

Fig. 7. Contour segmentations with proposed algorithm.

1609

1610

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

Fig. 8. Gaussian ltering algorithm. Contour segmentations using different input parameters.

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

Fig. 9. Circular histograms algorithm. Contour segmentations using different input parameters.

1611

1612

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

Table 2
Comparative results for Figs. 7af
CF 2 /I SE
FOM2

86.6
86.6
42.6

0.152
0.152
0.310

2.01
2.01
4.09

26.56
26.56
53.99

820
870
390

24.7
29.0
38.2

607.8
4888
7023

0.041
0.006
0.005

1.00
0.17
0.21

24.79
4.99
7.94

1700
2360
840

13
8
17

33.0
53.6
25.2

136.5
9143
281.9

0.242
0.006
0.089

7.98
0.31
2.25

263.27
16.84
56.77

1160
1200
490

367
367
367

17
13
15

21.6
28.2
24.5

307.4
937.2
649.8

0.070
0.030
0.038

1.52
0.85
0.92

32.78
23.93
22.63

760
1040
380

2
3

579
579
579

20
37
17

29.0
15.6
34.1

205.0
205.2
2753

0.141
0.076
0.012

4.10
1.19
0.42

118.97
18.50
14.40

1270
1650
610

2
1

197
197
197

15
14
10

13.1
14.1
19.7

51.5
101.9
646.6

0.254
0.138
0.030

3.33
1.95
0.59

43.65
27.51
11.64

440
550
280

Method

Best set
of param

Points

Dom. points

CF

Polygon

Proposed
GFM
CHM

1
1

303
303
303

23
23
23

13.2
13.2
13.2

Hand

Proposed
GFM
CHM

2
1

840
840
840

34
29
22

Check-mark

Proposed
GFM
CHM

3
3

429
429
429

Pigeon

Proposed
GFM
CHM

1
2

Finger

Proposed
GFM
CHM

Proposed
GFM
CHM

respect to Fig. 8(1)e but it is worse in Fig. 8(3)d compared


with Fig. 8(1)d.
Fig. 9 shows that for CHM no combination of parameters
given is found to give the best results; the highest FOM is
obtained for the segmentations with K = 5 for the contours
in Fig. 9a, with K = 7 for those in Figs. 9b and d and with
K = 10 in Figs. 9c and e. Thus, for xed parameter values the quality of the segmentation depends on the particular features of the contour to be segmented. This justies
the use of multiscale methods, which allow analysis of the
curve evolution when the parameter values are varied and
particularly justies the use of the proposed method, which,
thanks to a multiresolution approach, works with contours
having features at different scales. Table 2 provides quantitative results in order to compare the three algorithms. It
can be observed that, generally, the proposed method gives
higher F OM n values.
All computations were performed on a Pentium IV at
2.6 GHz. To be able to discriminate computation time among
the different methods and measure computation times in microseconds, each algorithm has been applied iteratively 1000
times to each contour. This way of calculating the computation time is more natural and consistent than to use vastly
long contours. Our method is slightly faster than GFM with

ISE

CF 3 /I SE
FOM3

Time (s)

CF /I SE
FOM

Shape

a ltering kernel of length 41. CHM, however, is approximately two times faster than our method. Computation times
of CHM and GFM is more proportional to the length of the
contour than our method.

7. Summary and conclusions


In this paper, a new method has been introduced for the
characterisation of contours by means of the hierarchical
computation of a multiresolution structure. This structure,
consisting of successive lower resolution versions of the
contour, is obtained by progressively averaging and subsampling of the chain-code of the original curve. This results
in a bounded total number of nodes, which corresponds approximately to twice the number of nodes in the contour
(2N0 + M 3 in the worst case).
Once the pyramid is built, a stable parentson link structure is built between nodes of adjacent levels. This applies
the concepts of linked pyramid and MPL algorithm and
rapidly converges to a stable solution.
It has been proved that the stabilised structure cannot be
applied directly, through a mere top-down propagation process, to the problem of robust and consistent curve segmen-

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

tation. This is due to the existence of crossed links with


result in false detections, and to the fact that the segmentation depends strongly both on the particular features of the
contour and on the chosen propagation level. To solve these
problems we rst introduce a corrective step that eliminates
crossed links, then apply a selective propagation mechanism
in the higher levels of the structure. Propagation is allowed
only when certain conditions relating the variance and the
length of the parent nodes are met.
The combination of these three componentsstabilisation
process, correction of crossed links and selective
propagationsresults in the transformation of the chaincode at the base in a stepwise constant function that characterises the contour and allows for a consistent and robust
segmentation. The discontinuity points of the chain-code
correspond to the extremes of the segments, whereas the
value of the chain-code at the steps gives their orientation.
Finally, it should be noted that the proposed method
presents good precision and quality of segmentation. It
works with a wide range of contour sizes, allowing feature
detection at different scales without having to modify any
parameter values. This good behaviour is due to the fact that
all resolution levels are collectively processed (they all take
part and cooperate in the different stages of the pyramid
construction), rather than individually through uniresolution
algorithms. In addition, due to the successively performed
subsampling (which results in a number of processed nodes
similar to number of pixels in the contour) and the reduced
number of link changes at the stabilistation stage (which
results in rapid convergence), the computational load of the
method is relatively low, being much lower than all multiscale characterisation methods, and comparable to that of
monoscale methods.

Acknowledgements
This work has been partially granted by the Spanish Ministerio de Ciencia y Tecnologa, MCYT and FEDER funds,
under project TIC2001 - 1758.

References
[1] Y. Sato, Piecewise linear approximation of plane curves
by perimeter optimization, Pattern Recognition 25 (1992)
15351543.
[2] J.C. Prez, E. Vidal, Optimum polygonal approximation
of digitized curves, Pattern Recognition Lett. 15 (1994)
743750.
[3] J.M. Iesta, M. Buendia, M.A. Sarti, Reliable polygonal
approximations of imaged real objects through dominant point
detection, Pattern Recognition 31 (6) (1998) 685697.
[4] M. Salotti, Optimal polygonal approximation of digitized
curves using the sum of square deviations criterion, Pattern
Recognition 35 (2002) 435443.

1613

[5] N. Kiryati, A.M. Bruckstein, Whats in a set of points?, IEEE


Trans. Pattern Anal. Mach. Intell. 14 (1992) 496500.
[6] S.C. Pei, J.H. Horng, Optimum approximation of digital planar
curves using circular arcs, Pattern Recognition 29 (3) (1996)
383388.
[7] B. Sarkar, L.K. Singh, D. Sarkar, Approximation of
digital curves with line segments and circular arcs using
genetic algorithms, Pattern Recognition Lett. 24 (15) (2003)
25852595.
[8] P.L. Rosin, G.A. West, Nonparametric segmentation of curves
into various representations, IEEE Trans. Pattern Anal. Mach.
Intell. 17 (12) (1995) 11401153.
[9] A. Rosenfeld, E. Johnston, Angle detection on digital curves,
IEEE Trans. Comput. 22 (1973) 875878.
[10] H. Freeman, L.S. Davis, A corner nding algorithm for chaincoded curves, IEEE Trans. Comput. 26 (1977) 297303.
[11] F. Arrebola, A. Bandera, P. Camacho, F. Sandoval, Corner
detection by local histograms of contour chain code, Electron.
Lett. 33 (21) (1997) 17691771.
[12] F. Arrebola, P. Camacho, A. Bandera, F. Sandoval, Corner
detection and curve representation by circular histograms of
contour chain code, Electron. Lett. 35 (13) (1999) 10651067.
[13] A. Bandera, C. Urdiales, F. Arrebola, F. Sandoval, Corner
detection by means of adaptively estimated curvature function,
Electron. Lett. 36 (2) (2000) 124126.
[14] C. Urdiales, C. Trazegnies, A. Bandera, F. Sandoval, Corner
detection based on adaptively ltered curvature function,
Electron. Lett. 39 (5) (2003) 426428.
[15] Wen-Yen Wu, An adaptive method for detecting dominant
points, Pattern Recognition 36 (10) (2003) 22312237.
[16] B.K. Ray, R. Pandyan, ACORDan adaptive corner detector
for planar curves, Pattern Recognition 36 (3) (2003) 703708.
[17] H.L. Beus, S.S.H. Tiu, An improved corner detection
algorithm based on chain-coded plane curves, Pattern
Recognition 20 (3) (1987) 291296.
[18] N. Ansari, E.J. Delp, On detecting dominant points, Pattern
Recognition 24 (5) (1991) 441451.
[19] F. Mokhtarian, A. Mackworth, Scale-based description and
recognition of planar curves and to-dimensional shapes, IEEE
Trans. Pattern Anal. Mach. Intell. 8 (6) (1986) 679698.
[20] F. Mokhtarian, A. Mackworth, A theory of multiscale
curvature-based shape representation for planar curves, IEEE
Trans. Pattern Anal. Mach. Intell. 14 (8) (1992) 789805.
[21] A. Rattarangsi, R.T. Chin, Scale-based detection of corners of
planar curves, IEEE Trans. Pattern Anal. Mach. Intell. 14 (4)
(1992) 430449.
[22] B.K. Ray, K.S. Ray, Corner detection using iterative Gaussian
smoothing with constant window size, Pattern Recognition 28
(11) (1995) 17651781.
[23] P. Saint-Marc, J. Chen, G. Medioni, Adaptive smoothing: a
general tool for early vision, IEEE Trans. Pattern Anal. Mach.
Intell. 14 (4) (1991) 430449.
[24] J.P. Antoine, D. Barache, R.M. Cesar Jr., L. da Fontoura Costa,
Shape characterization with the wavelet transform, Signal
Process. 62 (1997) 265290.
[25] B.K. Jang, R.T. Chin, Morphological scale space for 2D shape
smoothing, Comput. Vision Image Understand. 70 (2) (1998)
121141.
[26] V. Beau, M. Singer, Reduced resolution and scale space for
dominant feature detection in contours, Pattern Recognition
34 (2001) 287297.

1614

F. Arrebola, F. Sandoval / Pattern Recognition 38 (2005) 1596 1614

[27] P. Meer, C.A. Sher, A. Rosenfeld, The chain pyramid:


hierarchical contour processing, IEEE Trans. Pattern Anal.
Mach. Intell. 12 (4) (1990) 363376.
[28] Z. Chen, I.P. Chen, A simple recursive method for converting
a chain code into a quadtree with a lookup table, Image Vision
Comput. 19 (7) (2001) 413426.
[29] P.J. Burt, T.H. Hong, A. Rosenfeld, Segmentation and
estimation of image region properties through cooperative
hierarchical computation, IEEE Transactions on Syst. Man
Cybern. 11 (12) (1981) 802809.
[30] M. Bister, J. Cornelis, A. Rosenfeld, A critical view of pyramid
segmentation algorithms, Pattern Recognition Lett. 11 (9)
(1990) 605617.

[31] J.M. Jolion, A. Rosenfeld, A Pyramid Framework for


Early Vision, Kulwer Academic Publishers, Dordrecht, 1994,
pp. 2428.
[32] D. Sarkar, A simple algorithm for detection of signicant
vertices for polygonal aproximation of chain-coded curves,
Pattern Recognition Lett. 14 (12) (1993) 959964.
[33] M. Marji, P. Siy, Polygonal representation of digital planar
curves through dominant point detection-a nonparametric
algorithm, Pattern Recognition 37 (11) (2004) 21132130.
[34] T. Pavlidis, S.L. Horowitz, Segmentation of plane curves,
IEEE Trans. Comput. 23 (1974) 860870.

About the AuthorFABIN ARREBOLA was born in Spain in 1963. He received his title of Telecommunication Engineering from the
Technical University of Madrid, Spain, in 1989 and his Ph.D. degree from the University of Mlaga, Spain, in 1998. From 1988 to 1990
he was working in the Radar Division of CESELSA, Spain. From 1991 to the present day he has worked in the Department of Tecnologa
Electrnica of the University of Mlaga as an Assistant Professor and a Lecturer, successively. His research is focused on articial vision
and image processing.
About the AuthorFRANCISCO SANDOVAL was born in Spain in 1947. He received his title of Telecommunication Engineering and
Ph.D. degree from the Technical University of Madrid, Spain, in 1972 and 1980, respectively. From 1972 to 1989 he was engaged in
teaching and research in the elds of opto-electronics and integrated circuits in the Universidad Politcnica de Madrid (UPM) as an Assistant
Professor and a Lecturer, successively. In 1990 he joined the University of Mlaga as Full Professor in the Department of Tecnologa
Electrnica. He is currently involved in autonomous systems and foveal vision.

You might also like