# Hausdorff Distance between “Pure Black” and “Pure White” images

I am trying to use Hausdorff Distance to compare a pair of test images of equal dimensions. The images undergo some kind of threshold to obtain binary images. The Hausdorff Distance is calculated for the positions with non-zero pixels in those binary images. Here, I am using Taxi Cab distance instead of Euclidean distance. To provide a point of reference I want to calculate Hausdorff Distance for Control Images. What I mean by Control images is that the control images are binary, with same dimensions as that of the pair of test images, and the value of each pixel is 0 (a pure black image) or 255 (a pure white image).

Now, since I am calculating Hausdorff Distance using the positions of non-zero pixels, I have no problem in finding Hausdorff Distance between a pair of "pure white" images. But I am unable to resolve the situation when one of the images or both images in the pair are "pure black" images since, a search for positions with non-zero pixel value in a "pure black" image will return a NULL. How to resolve this situation? How to calculate Hausdorff Distance in the presence of a NULL set (I used NULL set for lack of better words)? Is there a work around that I can use here? Please help me.

I would like to apologize if any one thinks if this question doesn't belong here. I thought it is biased towards theory than implementation. If anyone thinks otherwise, please point me to a right forum.

-

The Hausdorff distance is defined for arbitrary subsets of a given metric space, but has nice properties (such as defining a metric itself) only when considering it between nice sets, and nice here means non-empty compact sets.

I assume you compute the distance between the subsets of black pixels of the two images (or almost equivalently between the subsets of white pixels).

Looking at the definition for arbitrary sets (as seen on Wikipedia) and specifically when one set is empty, we are to take the infimum of an empty set of real numbers - that infimum is $+\infty$, and then take the supremum over infintely many such $+\infty$'s - that's a gain $+\infty$. Viewed the aother way around, we take the supremum over an empty set, which results in $-\infty$. Now the Hausdorff distance is the biggest of these two numbres, that is $+\infty$. Interestingly, a similar reasoning gives $-\infty$ for the distance of the empty set to itself (whereas the self-distance is $0$ for any other set).

-
Thanks for the reply. Now I have to figure out how to implement this in my program. –  Yash Jun 28 '13 at 19:04
So for example, if the images that I use have a dimension of 100x100, can I take the infimum as 10000 since number of elements here cannot exceed 100x100? I mean for the purpose of programming. –  Yash Jun 28 '13 at 19:08