Hausdorff distance

From HandWiki
Revision as of 16:15, 6 February 2024 by John Stpola (talk | contribs) (linkage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Distance between two metric-space subsets

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-empty compact 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 [math]\displaystyle{ [0,1] \to \R^3 }[/math].

Definition

Components of the calculation of the Hausdorff distance between the green curve X and the blue curve Y.

Let [math]\displaystyle{ (M,d) }[/math] be a metric space. For each pair of non-empty subsets [math]\displaystyle{ X \subset M }[/math] and [math]\displaystyle{ Y \subset M }[/math], the Hausdorff distance between [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] is defined as

[math]\displaystyle{ d_{\mathrm H}(X,Y) := \max\left\{\,\sup_{x \in X} d(x,Y),\ \sup_{y \in Y} d(X,y) \,\right\}, }[/math]

where [math]\displaystyle{ \operatorname{sup} }[/math] represents the supremum operator, [math]\displaystyle{ \operatorname{inf} }[/math] the infimum operator, and where [math]\displaystyle{ d(a, B) := \inf_{b \in B} d(a,b) }[/math] quantifies the distance from a point [math]\displaystyle{ a \in X }[/math] to the subset [math]\displaystyle{ B\subseteq X }[/math].

An equivalent definition is as follows.[3] For each set [math]\displaystyle{ X \subset M, }[/math] let [math]\displaystyle{ X_\varepsilon := \bigcup_{x \in X} \{z \in M \mid d(z,x) \leq \varepsilon\}, }[/math] which is the set of all points within [math]\displaystyle{ \varepsilon }[/math] of the set [math]\displaystyle{ X }[/math] (sometimes called the [math]\displaystyle{ \varepsilon }[/math]-fattening of [math]\displaystyle{ X }[/math] or a generalized ball of radius [math]\displaystyle{ \varepsilon }[/math] around [math]\displaystyle{ X }[/math]). Then, the Hausdorff distance between [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] is defined as [math]\displaystyle{ d_H(X,Y) := \inf\{\varepsilon \geq 0 \mid X \subseteq Y_\varepsilon \text{ and } Y \subseteq X_\varepsilon\}. }[/math]

Equivalently,[1] [math]\displaystyle{ \begin{aligned} d_H(X, Y) &= \sup_{w \in M} \left| \inf_{x \in X} d(w,x) - \inf_{y \in Y} d(w,y)\right| \\ &= \sup_{w \in X \cup Y} \left| \inf_{x \in X} d(w,x) - \inf_{y \in Y} d(w,y)\right| \\ &= \sup_{w \in M} | d(w, X) - d(w, Y)|, \end{aligned} }[/math] where [math]\displaystyle{ d(w, X) := \inf_{x \in X} d(w,x) }[/math] is the smallest distance from the point [math]\displaystyle{ w }[/math] to the set [math]\displaystyle{ X }[/math].

Remark

It is not true for arbitrary subsets [math]\displaystyle{ X, Y \subset M }[/math] that [math]\displaystyle{ d_{\mathrm H}(X,Y) = \varepsilon }[/math] implies

[math]\displaystyle{ X\subseteq Y_\varepsilon \ \mbox{and} \ Y\subseteq X_\varepsilon. }[/math]

For instance, consider the metric space of the real numbers [math]\displaystyle{ \mathbb{R} }[/math] with the usual metric [math]\displaystyle{ d }[/math] induced by the absolute value,

[math]\displaystyle{ d(x,y) := |y - x|, \quad x,y \in \R. }[/math]

Take

[math]\displaystyle{ X := (0, 1] \quad \mbox{and} \quad Y := [-1,0). }[/math]

Then [math]\displaystyle{ d_{\mathrm H}(X,Y) = 1\ }[/math]. However [math]\displaystyle{ X \nsubseteq Y_1 }[/math] because [math]\displaystyle{ Y_1 = [-2,1)\ }[/math], but [math]\displaystyle{ 1 \in X }[/math].

But it is true that [math]\displaystyle{ X\subseteq \overline{Y_\varepsilon} }[/math] and [math]\displaystyle{ Y\subseteq \overline{X_\varepsilon} }[/math] ; in particular it is true if [math]\displaystyle{ X, Y }[/math] are closed.

Properties

  • In general, [math]\displaystyle{ d_{\mathrm H}(X,Y) }[/math] may be infinite. If both X and Y are bounded, then [math]\displaystyle{ d_{\mathrm H}(X,Y) }[/math] is guaranteed to be finite.
  • [math]\displaystyle{ d_{\mathrm H}(X,Y)=0 }[/math] 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) + dH(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 dH(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, dH yields an extended pseudometric.
  • On the set F(M) of all non-empty compact subsets of M, dH is a metric.
    • If M is complete, then so is F(M).[6]
    • If M is compact, then so is F(M).
    • The topology of F(M) depends only on the topology of M, not on the metric d.

Motivation

The definition of the Hausdorff distance can be derived by a series of natural extensions of the distance function [math]\displaystyle{ d(x,y) }[/math] 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:
[math]\displaystyle{ d(x,Y)=\inf \{ d(x,y) \mid y \in Y \}.\ }[/math]
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:
[math]\displaystyle{ d(X,Y)=\sup \{ d(x,Y) \mid x \in X \}.\ }[/math]
For example, [math]\displaystyle{ d(\{1,7\},\{3,6\}) = \sup\{ d(1,\{3,6\}), d(7,\{3,6\})\} = \sup\{ d(1,3),d(7,6) \} = 2. }[/math]
  • 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 [math]\displaystyle{ X \subseteq Y }[/math]). 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:
[math]\displaystyle{ d_{\mathrm H}(X,Y) = \max\{d(X,Y),d(Y,X) \} \, . }[/math]

Applications

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. In computer graphics the Hausdorff distance is used to measure the difference between two different representations of the same 3D object[8] particularly when generating level of detail for efficient display of complex 3D models.

If [math]\displaystyle{ X }[/math] is the surface of earth, and [math]\displaystyle{ Y }[/math] is the land-surface of earth, then by finding the point Nemo, we see [math]\displaystyle{ d_H(X, Y) }[/math] is around 2,704.8 km.

Related concepts

A measure for the dissimilarity of two shapes is given by Hausdorff distance up to isometry, denoted DH. Namely, let X and Y be two compact figures in a metric space M (usually a Euclidean space); then DH(X,Y) is the infimum of dH(I(X),Y) among all isometries I 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 [math]\displaystyle{ d_{\mathrm H}(I(M),J(N)) }[/math] among all isometric embeddings [math]\displaystyle{ I\colon M\to L }[/math] and [math]\displaystyle{ J\colon N\to L }[/math] into some common metric space L.

See also

References

  1. 1.0 1.1 Rockafellar, R. Tyrrell; Wets, Roger J-B (2005). Variational Analysis. Springer-Verlag. p. 117. ISBN 3-540-62772-3. 
  2. 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 et al. (in en), System Modeling and Optimization, 199, Boston: Kluwer Academic Publishers, pp. 35–39, doi:10.1007/0-387-33006-2_4, ISBN 978-0-387-32774-7 
  3. Munkres, James (1999). Topology (2nd ed.). Prentice Hall. pp. 280–281. ISBN 0-13-181629-2. https://books.google.com/books?id=XjoZAQAAIAAJ&pg=PA280. 
  4. Diameter and Hausdorff Distance, Math.SE
  5. Hausdorff Distance and Intersection, Math.SE
  6. Henrikson, Jeff (1999). "Completeness and total boundedness of the Hausdorff metric". MIT Undergraduate Journal of Mathematics: 69–80. http://www-math.mit.edu/phase2/UJM/vol1/HAUSF.PDF. 
  7. Barnsley, Michael (1993). Fractals Everywhere. Morgan Kaufmann. pp. Ch. II.6. ISBN 0-12-079069-6. 
  8. Cignoni, P.; Rocchini, C.; Scopigno, R. (1998). "Metro: Measuring Error on Simplified Surfaces". Computer Graphics Forum 17 (2): 167–174. doi:10.1111/1467-8659.00236. 

External links