Professional Documents
Culture Documents
www.elsevier.com/locate/patcog
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
1597
1598
(1)
(2)
0 i < Nk+1 ,
(3)
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.
(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
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
1
2
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.
(5)
(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
Fig. 3. Generation of a stable link structure. Chain code of the rst 6 levels before stabilisation (+) and after (bold line).
(9)
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.
Offb = 0
Offb = 8
Offb = 0
if |Ca Cb | < 4,
if Ca Cb > 4,
if Cb Ca > 4.
Cj0 = Ci1 |F 0 =i ,
j
0 j < NP 1 ,
0 j < N0 ,
0 i < NP ,
0 i < N1 .
(12)
1603
1604
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.
(13)
(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 ,
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)
1606
(a)
(b)
(c)
(d)
Fig. 5. Elimination of crossed links. Segmentation results with non-selective propagation but without crossed links.
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-
1608
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
1609
1610
Fig. 8. Gaussian ltering algorithm. Contour segmentations using different input parameters.
Fig. 9. Circular histograms algorithm. Contour segmentations using different input parameters.
1611
1612
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
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.
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
1614
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.