next up previous contents
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.
 \begin{displaymath}D(p)=min\{dist_M(p,q), q \in O\}
\end{displaymath} (2.1)
  
Figure 2.1: Example of a distance transformation using the distE metric. Left: original image. Center: distance map. Right: Voronoi diagram.
\begin{figure}\centerline{\epsfysize=3cm \epsfbox{figures/chapter1/figure1.eps}}
\end{figure}

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)
 \begin{displaymath}dist_{8}(p,q)=\max\{\vert p_x-q_x\vert,\vert p_y-q_y\vert\}
\end{displaymath} (2.3)
 
distcha(A:B)(p,q) = $\displaystyle A.\max\{\vert p_x-q_x\vert,\vert p_y-q_y\vert\} +$ (2.4)
     
 \begin{displaymath}dist_e(p,q)=\sqrt{(p_x-q_x)^2+(p_y-q_y)^2}
\end{displaymath} (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 $p \in O$, VP(p) is the part of image I that satisfies
 \begin{displaymath}VP(p)=\{ q \in I \; \vert \; \forall \, r \in O \, , \, dist_M(p,q)
\leq dist_M(q,r) \}
\end{displaymath} (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.
 \begin{displaymath}N(p)=\{q=p+n \, \vert \, n \in N\}
\end{displaymath} (2.10)
N=N((0,0)) is called a neighborhood. The neighborhoods considered here are balls, i.e. neighborhoods such that
 \begin{displaymath}N=B_d=\{ n \, \vert \, dist_M(n,(0,0)) < d\}
\end{displaymath} (2.11)
with some metric M. Of particular interest are the 4-direct and 8-direct neighborhoods defined as
  
N4 = $\displaystyle \{ n \, \vert \, dist_{4}(n,(0,0)) = 1 \}$  
  = $\displaystyle \{ (1,0), (-1,0), (0,1), (0,-1) \}$ (2.12)
       
N8 = $\displaystyle \{ n \, \vert \, dist_{8}(n,(0,0)) = 1 \}$  
  = $\displaystyle N_4 \cup \{ (1,1), (1,-1), (-1,1), (-1,-1) \}$ (2.13)


next up previous contents
Next: Approximate distance transformations. Up: A review of distance Previous: A review of distance
Olivier Cuisenaire
1999-10-05