Next: Approximate distance transformations.
Up: A review of distance
Previous: A review of distance
Definitions.
From a binary image I made of an object O and its background
O', a distance transformation [132] makes an image,
the distance map D (Fig.
), in which the
value of any pixel is the distance from this pixel to the object
O, i.e. the distance to the nearest pixel of O.
 |
(2.1) |
Figure 2.1:
Example of a distance transformation using the distE
metric. Left: original image. Center: distance map.
Right: Voronoi diagram.
 |
The following notations are used in this text. Letters p,q,r are
used for pixels, with indexes pi where needed. In the original
image, those pixels belong either to the object O or the
background O' of the image. The coordinates of pixel p are
(px,py).
distM(p,q) is the distance between pixels p and
q using the metric M. The following metrics are considered:
|
dist4(p,q)=|px-qx|+|py-qy|
|
(2.2) |
 |
(2.3) |
| distcha(A:B)(p,q) |
= |
 |
(2.4) |
| |
|
|
|
 |
(2.5) |
|
distE(p,q)=(px-qx)2+(py-qy)2
|
(2.6) |
They are called the city block (
), chess board
(
), chamfer (
), Euclidean
(
) and squared Euclidean metric
(
), respectively. In what follows, when we speak
of a Euclidean distance transformation, we usually mean a DT
computed using the distE metric. Indeed, it is equivalent to
diste but can be computed using integer operations only since
pixels are located on integer locations.
In the above definitions, the only relevant information is of
course the relative location of pixels p and q, i.e. dp=p-q.
Therefore we often used the simpler notation
|
distM(dp)=distM(p,q)
|
(2.7) |
For instance, we have
|
distE(dp)=dpx2+dpy2
|
(2.8) |
An important related concept is that of the Voronoi diagram. It
divides the plane into tiles surrounding each object pixel.
VP(p) is the Voronoi Polygon surrounding a pixel p of the
object. For every pixel
,
VP(p) is the part of image
I that satisfies
 |
(2.9) |
Finally, image processing operations are usually defined locally,
i.e. pixels are only influenced by their neighborhood. We write
N(p) the set of neighbors of p, i.e.
 |
(2.10) |
N=N((0,0)) is called a neighborhood. The neighborhoods
considered here are balls, i.e. neighborhoods such that
 |
(2.11) |
with some metric M. Of particular interest are the 4-direct and
8-direct neighborhoods defined as
| N4 |
= |
 |
|
| |
= |
 |
(2.12) |
| |
|
|
|
| N8 |
= |
 |
|
| |
= |
 |
(2.13) |
Next: Approximate distance transformations.
Up: A review of distance
Previous: A review of distance
Olivier Cuisenaire
1999-10-05