Direct computation and minimization of the Hausdorff distance using its definition (2) is very time-consuming. We use the distance transform [1] of the reference shape to significantly speed up the procedure. A DT converts a binary image to another image in which pixel value is the distance from this pixel to the nearest nonzero pixel of the binary image.
The distance transform is computed off-line, and only once for each particular reference shape. We use the neighborhood fast chamfer distance transform [1] that gives a good approximation to the exact Euclidean distance. The DT values are integers. A example of a distance transform is shown in figure 5.