Morphological Grayscale Reconstruction in Image Analysis:
Applications and Ecient Algorithms
Luc Vincent
Abstract
Morphological reconstruction is part of a set of image op erators often referred to as
geodesic.
In the binary case, reconstruction simply extracts the connected comp onents of a binary image
I
(the mask) which are \marked" by a (binary) image
J
contained in
I
. This transformation
can be extended to the grayscale case, where it turns out to b e extremely useful for several
image analysis tasks. This paper rst provides two dierent formal denitions of grayscale
reconstruction. It then illustrates the use of grayscale reconstruction in various image processing
applications and aims at demonstrating the usefulness of this transformation for image ltering
and segmentation tasks. Lastly, the pap er focuses on implementation issues: the standard
parallel and sequential approaches to reconstruction are briey recalled; their common drawback
is their ineciency on conventional computers. To improve this situation, a new algorithm
is introduced, which is based on the notion of regional maxima and makes use of breadth-
rst image scannings implemented via a queue of pixels. Its combination with the sequential
technique results in a hybrid grayscale reconstruction algorithm which is an order of magnitude
faster than any previously known algorithm.
Published in the
IEEE Transactions on Image Processing,
Vol. 2, No. 2, pp. 176{201,
April 1993.
1
1 Intro duction
Reconstruction
isavery useful op erator provided by mathematical morphology [18,19]. Although
it can easily be dened in itself, it is often presented as part as a set of operators known as
geodesic
ones [7]. The reconstruction transformation is relatively well-known in the binary case, where it
simply extracts the connected components of an image which are \marked" by another image (see
x
2). However, reconstruction can b e dened for grayscale images as well. In this framework, it
turns out to b e particularly interesting for several ltering, segmentation and feature extraction
tasks. Surprisingly, it has attracted little attention in the image analysis community.
The present paper has three ma jor goals: the rst one is to provide a formal denition of
grayscale reconstruction in the discrete case. In fact, we propose belowtwo equivalent denitions:
the rst one is based on the threshold superp osition principle and the second one relies on grayscale
geodesic dilations. The second part of the paper illustrates the use of binary and esp ecially grayscale
reconstruction in image analysis applications: examples proving the interest of grayscale reconstruc-
tion for such tasks as image ltering, extrema, domes and basins extraction in grayscale images,
\top-hat" by reconstruction, binary and grayscale segmentation, etc., are discussed. Lastly,in
x
4,
weintroduce ecient algorithms for computing reconstruction in grayscale images. Up to now, the
execution times required by the known grayscale reconstruction algorithms make their practical use
rather cumbersome on conventional computers. Two algorithms are introduced to bridge this gap.
The rst one is based on the notion of regional maxima and uses breadth-rst image scannings
enabled by a queue of pixels [25]. The second one is a combination of this scanning technique with
the classical sequential one [14], and it turns out to be the fastest algorithm in almost all practical
cases.
We shall exclusively be concerned here with the discrete case. The algorithms are describ ed
in 2D, but their extension to images of arbitrary dimensions is straightforward. In order to be as
precise as possible, Vincent90:Thesis algorithm descriptions are done in a pseudo-langage which
bares similarities to
C
and
Pascal.
2 Denitions
2.1 Notations used throughout the pap er
In the following, an image
I
is a mapping from a nite
rectangular
subset
D
I
of the discrete plane
ZZ
2
into a discrete set
f
0
;
1
;::: N
,
1
g
of gray-levels. A binary image
I
can only takevalues 0 or 1
and is often regarded as the set of its pixels with value 1. In this paper, we often present notions
for discrete sets of
ZZ
2
instead of explicitely referring to binary images. Similary, gray-level images
are often regarded as
functions
or
mappings.
The discrete grid
G
ZZ
2
ZZ
2
provides the neighborhoo d relationships b etween pixels:
p
is a neighbor of
q
if and only if (
p; q
)
2
G
. Here, we shall use square grids, either in 4- or in
8-connectivity (see Fig. 1), or the hexagonal grid (see Fig. 2). Note however that the algorithms
described b elowwork for any grid, in any dimension. The distance induced by
G
on
ZZ
2
is denoted
d
G
:
d
G
(
p; q
) is the minimal number of edges of the grid to cross to go from pixel
p
to pixel
q
.In
4-connectivity, this distance is often called
city-block distance
whereas in 8-connectivity,itisthe
chessboard
distance [2]. The elementary ball in distance
d
G
is denoted
B
G
, or simply
B
.We denote
by
N
G
(
p
) the set of the neighbors of pixel
p
for grid
G
. In the following, we often consider two
disjoined subsets of
N
G
(
p
), denoted
N
+
G
(
p
) and
N
,
G
(
p
).
N
+
G
(
p
) is the set of the neigb ors of
p
which
are reached b efore
p
during a raster scanning of the image (left to right and top to b ottom) and
N
,
G
(
p
) consists of the neighbors of
p
which are reached after
p
. These notions are recalled on Fig. 3.
2
(a) (b)
Figure1
:
Portion of square grid in 4- (a) and 8-connectivity (b).
Figure2
:
Portion of hexagonal grid.
(a)
(b)
p
p
Figure3
:
(a) The elementary ball
B
in 4-, 6- and 8-connectivity; (b)
N
+
G
(
p
)
and
N
,
G
(
p
)
in 8-connectivity.
3
2.2 Reconstruction for binary images
2.2.1 Denition in terms of connected comp onents
Let
I
and
J
be two binary images dened on the same discrete domain
D
and such that
J
I
.
In terms of mappings, this means that:
8
p
2
D; J
(
p
)=1=
)
I
(
p
)=1.
J
is called the
marker
image and
I
is the
mask.
Let
I
1
,
I
2
,
:::
,
I
n
be the connected components of
I
.
Denition 2.1
The reconstruction
I
(
J
)
of mask
I
from marker
J
is the union of the connected
components of
I
which contain at least a pixel of
J
:
I
(
J
)=
[
J
\
I
k
6
=
;
I
k
:
This denition is illustrated by Fig. 4. It is extremely simple, but gives rise to several interesting
applications and extensions, as we shall see in the following sections.
⇒
Figure4
:
Binary reconstruction from markers.
2.2.2 Denition in terms of geo desic distance
Reconstruction is most of the time presented using the notion of
geodesic distance.
Given a set
X
(the mask), the geo desic distance b etweeen two pixels
p
and
q
is the length of the shortest paths
joining
p
and
q
which are included in
X
. Note that the geodesic distance between two pixels within
a mask is highly dep endent on the type of connecticity which is used. This notion is illustrated by
Fig. 5. Geo desic distance was introduced in the framework of image analysis in 1981 by Lantuejoul
and Beucher [6] and is at the basis of several morphological operators [7]. In particular, one can
dene geodesic dilations (and similarly erosions) as follows:
Denition 2.2
Let
X
ZZ
2
be a discrete set of
ZZ
2
and
Y
X
. The geodesic dilation of size
n
0
of
Y
within
X
is the set of the pixels of
X
whose geodesic distanceto
Y
is smal ler or equal
to
n
:
(
n
)
X
(
Y
)=
f
p
2
X
j
d
X
(
p; Y
)
n
g
:
From this denition, it is obvious that geo desic dilations are extensive transformations, i.e.
Y
(
n
)
X
(
Y
). In addition, geo desic dilation of a given size
n
can b e obtained by iterating
n
elementary geo desic dilations:
(
n
)
X
(
Y
)=
(1)
X
(1)
X
:::
(1)
X
|
{z }
n
times
(
Y
)
:
(1)
4
A
y
x
P
Figure5
:
Geodesic distance
d
G
(
x; y
)
within a set
A
.
Fig. 6 illustrates successive geodesic dilations of a marker inside a mask, using 4- and 8-connectivity.
The elementary geo desic dilation can itself be obtained via a standard dilation of size one followed
byanintersection:
(1)
X
(
Y
)=(
Y
B
)
\
X:
(2)
This last statement is absolutely wrong when non-elementary geo desic dilations are considered. In
this latter case, one merely gets the
conditional
dilation of set
Y
, dened as the intersection of
X
and the standard dilation of
Y
. Note that some authors use a dierent terminology and utilize the
word \conditional" for what this pap er calls \geodesic" [5].
(a) 4-connectivity (b) 8-connectivity
Figure6
:
Boundaries of the successive geodesic dilations of a set (in black) within
a mask.
When performing successive elementary geodesic dilations of a set
Y
inside a mask
X
, the
connected comp onents of
X
whose intersection with
Y
is non empty are progressively oo ded. The
5