You are on page 1of 6

@

Vol 3.No 3. pp 471 476. I996


Else\ler Saence Ltd
Cop!nght G 1996 Pruern R c s o p n ~ t m nS w ~ e t y
I'nnled In Great Brltatn All r ~ p h t srncrved
0031 3203 96 S 1 5 0 0 + .00

Pnrltvn Rrmgnlrron.

Pergamon

ON THE COMPUTATION OF THE ECLER


EULER NUMBER
OF A BINARY OBJECT
JUAN L. D~AZ-DE-LEONS.* and JUAN HUMBERTO SOSSA-AZUELAt
CINVESTAV-IPN, Departamento de Ingenieria Electrica, Seccion de Control Automatico. A \ . IPN No.
2508, hlexico 07000 D.F.. A.P. 14-740. 31er1co.
(Rereired 3 .Vorenibur 1994: in rerisedform 16 June 1995; rec,uirr.dhr publica/ion 3 Jirlj 19951
Abstract-In this paper a new method to obtain the Euler numbcr of a hinary object via its skeleton is
presented. The number of terminal points (points with just one neighhor~and the number of three-edgepoints (points with only three neighbors) in the graph are used to obtain this important invariant. As the
proposed approach is inherently parallel. the resulting algorithm is ven fast.
Binary object characterization
Topological in\.ariant.

Skeleton

During the last years, many results have been obtained


in the area ofdigital topology."-' l ' Digital topology is
the study of the topological properties of digitized
binary pictures. Its results provide an important
mathematical basis for image processing operations
such as image thinning. border following and object
counting.(loi
A digitized binary image is a two-dimensional array
which has been obtained when a gray-label image (an
image whose elements lie in the range 0 Ix 5 I ) has
been discretized at two levels, say 0 and I . An image
such as this is composed of all the flat connected
regions representing the projections of the objects onto
the discrete plane. From the subsetsof points representing these objects several geometrical and topological
descriptors can be obtained to characterize these objects.
Among the topological descriptors. the Euler number (EN) or yerius has proven to be an important
feature in many image analysis and visual inspection
applications. For example. often in biological imaging,
when we want to count the number of particles containing no holes. we can obtain this number by calculating the Euler number of the objects in the image.
The EN has also been used in thc recognition of
industrial parts.''*' Therefore. how to form a fast
algorithm to obtain this feature in real time is of
significance in lots of applications.
S e ~ e r amethods
l
have been proposed to obtain the
Euler number of a binary ~ b j e c t . ' ~ . ' ~ -In
' " reference
--

~-

Supported by the National Council of Science and Technology of Mexico and by the Ad\-anced Studies Research
Center of the IPN of Mexico.
tcorresponding author: Fax (5) 747 7089 e-mail:
hsossa(u ctrl.cinvestav.mx.

Euler number or gcnus

Topological descriptor

(6) the Euler number is calculated taking into account


topological properties of objects in the image such as
connectivity.convexity and concavity. In reference (1 3)
the Euler characteristic is obtained by means of
a quadtree representation of the image being analysed.
while in reference (14) it is computed from its bintree
representati0n.i.e. its binary pixel tree. In reference ( I 5)
the Euler numh-r is considered as a value of certain
additive functionals belonging to the family of the socalled quermass-integrals. In this work. an algorithm
to determine all quermass-integrals of a digital picture
P is presented. One of this quermass-integrals is the
Euler characteristic of P.
In reference t 16) the Euler number is obtained in
terms of vertim. basic square faces and edges of the
squure yruph of a binary image. A square graph. in this
case. is a nonoriented graph where each of its nodes
corresponds to a pixel in the image and each of its arcs
corresponds to the edge linking up two pixels when
these pixels are four-connected.
In short. in reference (17) the Euler number is computed by means of the Coi~i~ec~iriry
Graph (CG). The
C G is graph-structured data rcpresentation, where
a node contains information regardine connected image elements Ipoints, lines and regions) and arcs represent the adjacenq between these elements.
A different and new methodology is proposed in this
work to obtain thc Euler number ofa region (or a set of
regions) in an image by means of the skeleton of
a region. It is \\ell known that the skeleton of a region
preser1t.s some ~opologicalcharacteristics such as connectivity and the number of holes. From the number of
connected components of the skeleton and the corresponding number of holes for each component the EN
is obtained. For this. the number of rerrninnl poinrs
(points with onl! one neighbor or Tps)and the number
of rhrc~e-edge-pcjitrrs
(points with only three neighbors

J. L. DIAZ-DE-LEON and J. HUMBERTO SOSSA-AZUELA

472

or TEps) of the skeleton are used. With regard to these


two topological properties, i t will be proven that they
are the only two features needed to evaluate the Euler
number, regardless of the rest of the information contained in the edges joining the Tps and the TEps.
The rest of the work is organized as follows. In
Section 2 some basic definitions related to skeletons
are given. Among them, the concepts of the terminal
point (Tp) and three-edge-point (TEp) are necessary
to folIow the lecture of the paper. Section 3 uses
these definitions to derive the Euler number. As
an additional topological property, the number
of holes of a skeleton is also derived. In Section 4
some experimental results and comments are presented. Final conclusions and future work are given in
Section 5.

2 BASIC COSCEPTS

Definitions and notations related to metric spaces


and skeletons of regions used frequently in this paper
are presented here. Some of them follow
They are necessary to derive the
method to obtain the Euler number.

Fig. 1. (a) An e~ght-connectedskeleton; (b) a four-connected


skeleton.
a

a
a

a
aa
0a

d8 c a u

a
a
amma
mama
a

d4 case

Fig. 2. Some pathological cases that can be solved by special


masking.

Definition 7. A terminal branch is a branch where one


of its end-points is a terminal point.
Definition 8. A set of points R = { r ( i ,j):r(i. j)EZ2;.
R c z2is called K-connected iff there exists a path
which begins on q, and finishes on q2 for all q,, q 2E R .

Definition 9. For (Z2,dk)with d , {d,,d,,d,,,d,,J,


~
we
accept as a skeleton any K-connected set of points
Definition 1 . Let q = ( x , ~and
) p = (u, c) with q , p z2
~
and K E {4, 6L, 6R, 81, then the following metrics are Q for which if a non-Tp point is removed, the set Q is
decomposed into two or more K-connected sets.
widely used:

d,,.

Thereafter, these metrics will be related by d,, d,,


d,, (or dK,where K is the basis of the metric).

Definition 2. Let (A,a) a bi-dimensional metric space


, . 2 I)
and z any metric, and let S ( p )= (pi(0 < ~ ( p p)
for A discrete or N(p) = {pi/z ( p , p ) - + Obut not 0) for
A real, the neighborhood ofpand N, its cardinality, i.e.
the number of neighbors of p different from 0. Then:
(1) If A',

=1

(2) If N,

=2

we say that p is a terminal point (Tp).


we say that p is an internal point.
(3) If N, 2 3 we say that p is a crossing point o r
simply a crossing.
(4) If N, = 3 we say that p is a three-edge-point
(TEP).
Definition 3. Two points p and q are connected if q is in
the set N,(p).
Definition 4: A point p is adjacent to a point q if they
are connected.

Notice that for our definition of skeleton. the number of branches crossing a node in a 3 x 3 neighborhood is almost always the cardinality N, of p (Fig. I),
except for some particular cases(a few particular cases)
such as the ones shown in Fig. 2.
For these particular cases, instead of having one
point as the point joining several branches we have
four. Although theseconfigurations may appear in real
cases, they can be easily solved by special m a ~ k i n g . " ~ '
Another characteristic of 3 x 3 discrete neighborhoods is that nonparticular cases containing more
than four branches are not possible. The maximal
admissible nonparticular cases after a good skeletonization (unitary skeletons) are those shown in Fig. 3.
Notice further that configurations as shown in Fig.
3 may also appear (and with a great probability) as
shown in Figs 4(b) and Id). So, we note the following:
Lemma l(a). For (Z2.dk) with d , {d,,
~ d,,d,,. d,,.;,
any crossing point should be decomposed into a set of
three-edge-points (TEps).
Pro($. It suffices to find a case where a crossing is
generated by a set of TEps to show that this is the

Definition 5. A path between two points p and q in A is


a sequence of distinct points p,. p,, .. . , p, where p, = p,
p, = q, pi is adjacent to pi- I < i < n, and n is the
length of the path.

,,

Definition 6. A branch is a path between two crossing


points.

d8 case

d4 case

Fig. 3. Admissible maximal cases after good skeletonization.

Euler number of binary object


(2) Delete one branch by adding a T E p .

41
-

L/

(3) Delete two branches and 0 TEps.

-+I

1
-

3. DETERhllNATlON OF TOPOLOGICAL PROPERTIES

Fig. 4. Other possible admissible configurations

(COXIPLTATION OF THE EL'LER NUSIBER)

In this part the concepts of a terminal point and a


three-edge-point presented in the last section are used
to derive two other topological features: the number of
holes and the Euler number.
Fig. 5. Pathological cases difficult to cope with using
masking.

Theorem 1. Let ATp be the number of T p s and ATEp


be the number of TEps added to a skeleton. The
number of added holes AH is always equal to:
AH

general way to decompose a crossing point into TEps


in Z2.
In general, any crossing (in the real case) will not be
found in its natural form. Instead, it will appear decomposed into crossings of less order, as shown in
Fig. 2.4. Thus, the general decomposition of any crossing is into TEps.
0

Lemma I(b). Let ( A , z ) be a metric space with A-bidimensional. Any crossing point can be decomposed
into a set of three-edge points.
Proof. By generalization from the restrictions imposed by Lemma I(a).
There are other particular cases that are sometimes
found for skeletons in metrics d,, d,, and d,, that add
the unfortunate effect of adding bit-holes after pixel
deletion, see for example Fig. 5. Situations such as
these are caused when a great number of branches
cross. It is easy to see that trying to deal with these
pathological cases will be a very difficult problem.
Fortunately, thisdoes not happen for metricd,. That is
why four skeletons are used to derive our results.

0
Lemma 2. The way to add a terminal branch to a connected skeleton is to add a T p and a TEpjoining them.
Proof. Trivial.

ATEp - ATp
2

Proof. By Lemma 4. a hole is generated when


ATEp - ATp = 2. If AH holes are generated, then:
ATEp-ATp=?AH.

Thus

AH=

ATEp - A T p
2

Theorem 2. Appending a terminal branch to a skeleton does not alter the number of holes.
Proof. By Lemma 2 and Theorem I. if we add a branch
to a skeleton, we have A T E p = 1 and A T p = 1, then:
AH=

3 T E p - ATp
= 0.
2

Theorem 3. A crossing point with n branches is equivalent to n - 2 TEps. i.e. TEps = n - 2.


Proof. By construction (see Fig. 6), consider the case of
the minimal crossing. i.e. a crossing with just one T E p
[Fig. 6(a)]. then n - TEps = 2. If we append a new
branch to this crossing poim, a new T E p is added [Fig.
6(b)] and n - TEps = 1. It is not difficult to see that if
we continue appending new branches [Fig. qc)].
n - TEps = 2 remain the same, then TEps = n - 2.

Lenma 3. The number of terminal branches in a skeleton equals the number of terminal points.
Proof. Trivial.

Lemma 4. The ways in which to add a hole to a skeleton are as follows:


i

(1) Add two TEps and 0 branches.


Fig. 6. To append a branch to a crossing adds a new TEP.

J. L. DIAZ-DE-LEON and J. HUMBERTO SOSSA-AZUELA

Theorem q a ) . The number of holes for a skeleton is


always given as follows:
TEps - Tps
+1
2

H=

Proof. By construction, if we start from a minimal


skeleton, i.e. a branch with two Tps, then:
TEps, - Tpsi
= -I,
2
where suffix i means initial. Now, if we append ATps
and ATEps to this skeleton, by Theorems 1 and 2 , then:
AH=

ATEp - ATp
2

Theorem q a ) . The number of Tps of a skeleton less


the number of TEps is always 2 2 and it IS a multiple
of 2.
Proof. By construction, suppose a minimal skeleton.
i.e. a branch with two Tps, then Tps - TEps = 2.
If we add a terminal branches, by Theorem 2
Tps, - TEps, = 2, so we d o not have any changes. O n
the other hand, to add a hole by Lemma 4 we have the
following choices:

H.

However, TEps = TEps, + ATEp


Tps, + ATp, then
H=

Other interesting results concerning the number of


Tps and the number of TEps of a skeleton are as
follows:

and

Tps =

TEps - TEpsi - Tps + Tpsi

then Tps, - TEps, = 0. Therefore, if we continue


adding holes, Tps - TEps will decrease each time in
two units, then:

Tps - TEps 2 2 and it is a multiple of 2 .


Theorem q b ) . The number of holes of n skeletons is
always given as follows:

H=

TEps - Tps
+ n.
2

Proof. By generalization of Theorem q a ) beginning


with n minimal skeletons.
0
Remark 1. A negative hole is a synonym of an object,
see Theorems 4(a) and q b ) .

Proof. Starting from n minimal skeletons, then:


TEps,- Tps,
2

= - n,

3.1. Special cases

when adding ATps and ATEps we have:


H=AH=
-

ATEp - AT p TEps - TEps, - Tps + Tps,


2
2

TEps - Tps
2

TEpsi- Tpsi - TEps - Tps


2
2

+ n.

At this moment, we are able to derive the following


results concerning the computation of the Euler number of an object or a set ofobjects. For this, we use the
number of holes of a skeleton.
0
Theorem 5. The Euler number of n skeletons is given
as follows:
E=

Tps - TEps
2

Proof. It is well known that the Euler number of an


object equals the number of its connected components
less the number of its holes. By Theorem q b ) :

=n-n+

Tps - TEps
2

Tps - TEps
2

Theorem q b ) . Let there be n skeletons. The number of


Tps less the number of TEps is always < 2 n and it is
a multiple of 2.

There are two special cases which d o not generate


any topology, but for which the given results hold.
These special cases are a point and a loop.

4. EXAMPLES A S D DISCUSSION

In this section some examples for which the Euler


number is computed are shown. Some related comments are also given. The examples chosen in this
case are the four digital images shown in Fig. 7(a).
These images are next skeletonized by means of the
, ~ ~ ' 7(b)].
tecent method proposed by D i a ~ " ~ [Fig.
The 4-version algorithm is used in this case to obtain
the corresponding4 skeletons by the reasons explained
in Section 2. The Tps and TEps found by our program are shown in Fig. 7(c) for each one of the four
examples, along with the number of holes and the
Euler number for each image. are shown in Table 1.
The number of objects composing each image is also
shown.
Notice that the number of Tps, TEps and holes as
well as the Euler number depend exclusively on the
object's topology. This means that the geometry of
the object can change (Fig. 8), as long its topology
remains unchanged. This fact could be easily used

Euler number of binary object

(b)
Fig. 7. Test examples.

J. L. DIAZ-DE-LEON and J. HUMBERTO SOSSA-AZUELA

476

Table 1. The characteristics founded for the examples

REFERENCES

A. Rownfeld and J. L. Pfaltz, Sequential operations in


digital picture processing, J . Assoc. Compur. Mach. 13,
471-494 ( 1966).
A. Rosenfeld and J. L. Pfaltz, Distance functions on
digital picture, Patrern Recognirion 1, 33-61 (1968).
A. Rosenfeld. Picrure Processing b y Compurer. Academic
Press, New York (1969).
M. Minsky and S. Papert, Perceptrons. MIT Press,
London (1969).
A. Rosenfeld, Connectivity in digital pictures, J. Assoc.
Compur. Mach. 17, 146-160 (1970).
S. B. Gray. Local properties of binary images in two
dimensions, 1 EEE Trans. Compur. 20(5), 55 1-561 (May
1971).
S. Yokoi, J. Toriwaki and T. Fukumura, Topological
properties in digitized binary pictures. Sysr. Comput.
Controls 4(6), 32-39 (1973).
S. Yokoi. J. Toriwaki and T. Fukumura, An analysis of
topological properties in digitized binary pictures. C o m put. Graphics Image Process. 4,63-73 (1975).
Fig. 8. While the object's topology is unchanged, the EN
A. Rosenfeld, Digital topology, Am. Math. Month/! 86,
remains the same.
621-630 (1979).
T. Y. Kong and A. Rosenfeld, Digital topology: introduction and survey, Compur. Vis. Graphics Image Process. 48,
357-393 (1989).
in the classification of flat objects in terms of these
L. Latecki, U. Eckhardt and A. Rosenfeld, Well-cominvariants.
posed sets, Comput. Vis. Image Undersranding 61(1), 7083 (1995).
H. S. Yang and S. Sengupta, Intelligent shape recognition
5. CONCLUDISC REMARKS
for complex industrial tasks, IEEE Control Sysr. M a g .
23-29 (June 1988).
A new way to obtain the Euler number of a binary
Ch. R. Dyer, Computing the Euler number of an image
from its quadtree, Comput. Graphics Image Process. 13,
object when this is represented by its skeleton has been
27&276 (1980).
presented. The computation is based on the number of
H. Bieri and W. Nef, Algorithmsfor the Eulercharacteristerminal points (points with just one neighbor) and the
tic and related additive functionals of digital objects,
number of three-edge-points (points with only three
Compur. Vis., Graphics Image Process. 28,166-175 ( 1984).
neighbors). 4-Connected skeletons are used in this case
H. Bieri, Computing the Euler characteristic and related
additive functionals of digital objects from their bintree
to obtain Tps and TEps, as they are best suited to
representation, Comput. Vis. Graphics Image Process. 40,
accomplish this task.
1 l5-126(1987).
The main characteristics of the proposed approach
M. H. Chen and P. F. Yan. A fast algorithm to calculate
are its simplicity and originality. One possible drawthe Euler number for binary images, Pattern Recognition
Lerr. 8(12), 295-297 (December 1988).
back could be the need to first evaluate the object'
F. Chiavetta and V. Di Gesu, Parallel computation of the
skeleton. This disadvantage is overcome here by the
Euler number via connectivity graph, Pattern Recogniuse ofa fast and efficient s k e l e t o n i z i n g a l g ~ r i t h m . ~ ' ~ ~ ~tion
~ ) Letr. 14(11),849-859 (November 1993).
Present work related with Tps and TEps is in the
A. Rosenfeld and A. Kak, Digirol Picrure Processing.
recognition of flat objects from their skeletons. AlAcademic Press, New York (1976).
J. L. Diaz-de-Leon S. and P. Wiederhold,Skeletonization
though it is true that the recognition of flat objects
algorithms based on several connectivity criterions. In
from their skeletons is still lacking a real success,
preparation.
perhaps if combined with other techniques like conJ. L. Diaz-de-Leon S., Skeleronizarion algorirhms for
tour coding, special scanning sequences, model matchbinary images. Master's thesis. CINVESTAV-IPN
(August 1993).
ing, etc., it may turn out to be a winner.
Example
No.

No. of
objects

No. of
Tps

No. of
TEps

No. of
holes

Euler
number

DE LEON SANTIAGO received the B.S. degree in electronics


About the Author-JUAN LUIS D ~ A Z
engineering from the lnstituto Tecnol6~code Veracruz, Mextco. in 1991 and the MSc. degree in electrical
engineering from the Advanced Studies Research Center of the IPN of Mexico (CINVESTAV)in 1993. He is
currently a Ph.D. student there. His research interests include mathematical morphology, topology and
image processing.

About the Author-JUAN HUMBERTOSOSSA AZUELA received the B.S. degreein electronics engineering from the Universidad de Guadalajara, Mexico, in 1981, the M.Sc. degree in electrical engineeringfrom the
Advanced Studies Research Center of the IPN of Mexico (CINVESTAV) in 1987 and the Ph.D. degree in
Informatics from the lntitut National Polytechnique de Grenoble, France, in 1992. He is currently an
assistant professor at CINVESTAV-IPN. His research interests include computer vision and image
processing

You might also like