Metric

From HandWiki


A metric or distance function is a function d(p,q) of two points p and q which satisfies:

File:Hepa img677.gif

Frequently used examples are:

The Euclidean distance: in two dimensions,

File:Hepa img678.gif

In a digital image, the elements of p and q are row and column numbers. Generalized to any number of elements in p and q, one can write

File:Hepa img679.gif

Points with equal File:Hepa img680.gif from p form a circle (sphere, hypersphere) of radius File:Hepa img680.gif around p.

The city block distance: in two dimensions,

File:Hepa img681.gif

with obvious generalization to more dimensions. Points (pixels in an image) with equal File:Hepa img682.gif from p form a diamond around p; in an image:

File:Hepa img683.gif

Points with File:Hepa img684.gif from p are called the 4-connected neighbours of p.

The chess board distance: in two dimensions,

File:Hepa img685.gif

Points with equal File:Hepa img686.gif from p form a square around p; in an image:

File:Hepa img687.gif

Points (pixels in an image) with File:Hepa img688.gif from p are called the 8-connected neighbours of p. Hepa img1.gif e.g. Rosenfeld76.

A metric can also be defined in a binary space, e.g. as the distance between two bit patterns ( Hepa img2.gif Hamming Distance).