In mathematics, the Hausdorff distance, or Hausdorff metric, also called Pompeiu–Hausdorff distance,^{[1]}^{[2]} measures how far two subsets of a metric space are from each other. It turns the set of non-emptycompact subsets of a metric space into a metric space in its own right. It is named after Felix Hausdorff and Dimitrie Pompeiu.
Informally, two sets are close in the Hausdorff distance if every point of either set is close to some point of the other set. The Hausdorff distance is the longest distance you can be forced to travel by an adversary who chooses a point in one of the two sets, from where you then must travel to the other set. In other words, it is the greatest of all the distances from a point in one set to the closest point in the other set.
This distance was first introduced by Hausdorff in his book Grundzüge der Mengenlehre, first published in 1914, although a very close relative appeared in the doctoral thesis of Maurice Fréchet in 1906, in his study of the space of all continuous curves from $[0,1]\to \mathbb {R} ^{3}$.
DefinitionEdit
Components of the calculation of the Hausdorff distance between the green line X and the blue line Y.
Let X and Y be two non-empty subsets of a metric space $(M,d)$. We define their Hausdorff distance $d_{\mathrm {H} }(X,Y)$ by
where sup represents the supremum, inf the infimum, and where $d(a,B)=\inf _{b\in B}d(a,b)$ quantifies the distance from a point $a\in X$ to the subset $B\subseteq X$.
Equivalently,
$d_{H}(X,Y)=\inf\{\varepsilon \geq 0\,;\ X\subseteq Y_{\varepsilon }{\text{ and }}Y\subseteq X_{\varepsilon }\},\quad$^{[3]}
that is, the set of all points within $\varepsilon$ of the set $X$ (sometimes called the $\varepsilon$-fattening of $X$ or a generalized ball of radius $\varepsilon$ around $X$).
For instance, consider the metric space of the real numbers $\mathbb {R}$ with the usual metric $d$ induced by the absolute value,
$d(x,y):=|y-x|,\quad x,y\in \mathbb {R} .$
Take
$X:=(0,1]\quad {\mbox{and}}\quad Y:=[-1,0).$
Then $d_{\mathrm {H} }(X,Y)=1\$. However $X\nsubseteq Y_{1}$ because $Y_{1}=[-2,1)\$, but $1\in X$.
But it is true that $X\subseteq {\overline {Y_{\varepsilon }}}$ and $Y\subseteq {\overline {X_{\varepsilon }}}$ ; in particular it is true if $X,Y$ are closed.
PropertiesEdit
In general, $d_{\mathrm {H} }(X,Y)$ may be infinite. If both X and Y are bounded, then $d_{\mathrm {H} }(X,Y)$ is guaranteed to be finite.
$d_{\mathrm {H} }(X,Y)=0$ if and only if X and Y have the same closure.
For every point x of M and any non-empty sets Y, Z of M: d(x,Y) ≤ d(x,Z) + d_{H}(Y,Z), where d(x,Y) is the distance between the point x and the closest point in the set Y.
|diameter(Y)-diameter(X)| ≤ 2 d_{H}(X,Y).^{[4]}
If the intersection X ∩ Y has a non-empty interior, then there exists a constant r > 0, such that every set X′ whose Hausdorff distance from X is less than r also intersects Y.^{[5]}
On the set of all subsets of M, d_{H} yields an extended pseudometric.
On the set F(M) of all non-empty compact subsets of M, d_{H} is a metric.
The topology of F(M) depends only on the topology of M, not on the metric d.
MotivationEdit
The definition of the Hausdorff distance can be derived by a series of natural extensions of the distance function $d(x,y)$ in the underlying metric space M, as follows:^{[7]}
Define a distance function between any point x of M and any non-empty set Y of M by:
$d(x,Y)=\inf\{d(x,y)\mid y\in Y\}.\$
For example, d(1, {3,6}) = 2 and d(7, {3,6}) = 1.
Define a (not-necessarily-symmetric) "distance" function between any two non-empty sets X and Y of M by:
$d(X,Y)=\sup\{d(x,Y)\mid x\in X\}.\$
For example, ${\textstyle d(\{1,7\},\{3,6\})=\sup\{d(1,\{3,6\}),d(7,\{3,6\})\}=\sup\{d(1,3),d(7,6)\}=2.}$
If X and Y are compact then d(X,Y) will be finite; d(X,X)=0; and d inherits the triangle inequality property from the distance function in M. As it stands, d(X,Y) is not a metric because d(X,Y) is not always symmetric, and d(X,Y) = 0 does not imply that X = Y (It does imply that $X\subseteq Y$). For example, d({1,3,6,7}, {3,6}) = 2, but d({3,6}, {1,3,6,7}) = 0. However, we can create a metric by defining the Hausdorff distance to be:
$d_{\mathrm {H} }(X,Y)=\max\{d(X,Y),d(Y,X)\}\,.$
ApplicationsEdit
In computer vision, the Hausdorff distance can be used to find a given template in an arbitrary target image. The template and image are often pre-processed via an edge detector giving a binary image. Next, each 1 (activated) point in the binary image of the template is treated as a point in a set, the "shape" of the template. Similarly, an area of the binary target image is treated as a set of points. The algorithm then tries to minimize the Hausdorff distance between the template and some area of the target image. The area in the target image with the minimal Hausdorff distance to the template, can be considered the best candidate for locating the template in the target.^{[8]}
In computer graphics the Hausdorff distance is used to measure the difference between two different representations of the same 3D object^{[9]} particularly when generating level of detail for efficient display of complex 3D models.
Related conceptsEdit
A measure for the dissimilarity of two shapes is given by Hausdorff distance up to isometry, denoted D_{H}. Namely, let X and Y be two compact figures in a metric space M (usually a Euclidean space); then D_{H}(X,Y) is the infimum of d_{H}(I(X),Y) along all isometriesI of the metric space M to itself. This distance measures how far the shapes X and Y are from being isometric.
The Gromov–Hausdorff convergence is a related idea: we measure the distance of two metric spaces M and N by taking the infimum of $d_{\mathrm {H} }(I(M),J(N))$ along all isometric embeddings $I\colon M\to L$ and $J\colon N\to L$ into some common metric space L.
^Bîrsan, Temistocle; Tiba, Dan (2006), "One hundred years since the introduction of the set distance by Dimitrie Pompeiu", in Ceragioli, Francesca; Dontchev, Asen; Futura, Hitoshi; Marti, Kurt; Pandolfi, Luciano (eds.), System Modeling and Optimization, vol. 199, Boston: Kluwer Academic Publishers, pp. 35–39, doi:10.1007/0-387-33006-2_4, ISBN 978-0-387-32774-7, MR 2249320
^Henrikson, Jeff (1999). "Completeness and total boundedness of the Hausdorff metric" (PDF). MIT Undergraduate Journal of Mathematics: 69–80. Archived from the original (PDF) on June 23, 2002.
Using MeshLab to measure difference between two surfaces A short tutorial on how to compute and visualize the Hausdorff distance between two triangulated 3D surfaces using the open source tool MeshLab.