contains material from
Template Matching Techniques in Computer Vision: Theory and Practice
Roberto Brunelli © 2009 John Wiley & Sons, Ltd
Binary image templates can be considered as a set of points and their similarity assessed by means of an appropriate point set distance, the Hausdorff distance or its variation, the directed Hausdorff distance. The latter can be computed efficiently using the Euclidean distance transform, a transform that associates to each background image pixel its distance from the closest foreground image pixel. Once the distance transform has been computed, computation of the directed Hausdorff distance can be accomplished by looking at the distance transform value at the pixels representative of the point set.
The resulting set of distance values can be used to compute several variations of the basic definition by taking the maximum, the average, or any specified quantile, improving the robustness of the matching score.
We illustrate it using one of the available sample images and adding noise to it:
As template, we get the eye of the image without noise:
and compute several variations of the partial Hausdorff distance
reporting the results in Figure 11.1.