next up previous contents
Next: Circular propagation algorithm Up: Geodesic DT algorithms Previous: Geodesic DT algorithms

Bucket sorting algorithm

In order to define an efficient implementation of the Bd-geodesic DT, we restrict the class of paths under consideration to the paths $\{p_1,p_2,...,p_m\}$ such that
 
$\displaystyle \forall \; 1 \leq i < m-1 \; ,$   $\displaystyle d_N(p_i,p_{i+1}) \leq d$  
  $\textstyle \; \;$ $\displaystyle \exists n \in N_4 \; \vert \; d_N(p_i,p_i+n) > d$  
$\displaystyle \mathrm{for} \; i = m \; ,$   $\displaystyle 1 \leq d_N(p_{i-1},p_i) \leq d$ (8.6)

That is, all steps but the last one are approximately of length d. This slightly reduces the accuracy of the EDT approximation by restricting the path directions to those of the edge of Bd, instead of the complete ball. The accuracy of the EDT approximation is studied in section [*].
On the other hand, it makes the implementation of the DT much easier. For all p such that $D(p) \leq d$, the DT can be computed similarly to the PSN algorithm in chapter 3. For $d <
D(p) \leq 2.d$, the distances can be computed by propagating from the edge of $O \oplus B_d$, i.e. $\delta(O \oplus B_d)$. For those pixels, D(p) is defined as

\begin{displaymath}D(p) = \min_{p' \in \delta(O \oplus B_d)} \{ D(p') + dist_e(p,p') \}
\end{displaymath} (8.7)

Similarly, for $2.d < D(p) \leq 3.d$, we propagate from the edge of $O \oplus B_d \oplus B_d$, and so on. More generally, the value of D(p) for a pixel p can be split into two terms:
 
D(p) = $\displaystyle \sum_{i=1}^{m-1}d_N(p_i,p_{i+1}) \; \; \; \mathrm{with}
\; \; p_m=p$  
  = $\displaystyle \sum_{i=1}^{m-2}d_N(p_i,p_{i+1}) + d_N(p_m-1,p_m)$  
  = D(pm-1) + dN(pm-1,pm) (8.8)

where $p_{m-1} \; \in \; \delta(O \oplus B_d \oplus ... \oplus
B_d)$ (m-1 times) and $p \; \in \; O \oplus B_d \oplus ... \oplus
B_d$ (m times).
In the following algorithm, we remember two values for each pixel in the propagation front. dpath corresponds to the first term of ([*]) and is the length of the path from p1 to pm-1. The vector dp is the relative location of p from pm-1. It corresponds to the second term of ([*]).
The algorithm proceeds step by step, first computing D(p) in $O \oplus B$, then in $(O \oplus B) \oplus B$, ... Within each step, the propagation is ordered by bucket sorting on distE(dp). When diste(dp) > d, the pixel is saved in a temporary buffer to be used in the following step.

Algorithm 8   Bd-geodesic DT by bucket sorting.


\begin{algorithmic}\AINPUT{ an image $I$\space including object $O$\space and a ...
...ce \ENDIF \ENDIF
\ENDIF \ENDFOR \ENDIF \ENDFOR \ENDPROCEDURE
\end{algorithmic}

next up previous contents
Next: Circular propagation algorithm Up: Geodesic DT algorithms Previous: Geodesic DT algorithms
Olivier Cuisenaire
1999-10-05