Frequently used examples are:
The Euclidean distance: in two dimensions,
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
Points with equal
from p form a circle (sphere, hypersphere) of radius
around p.
The city block distance: in two dimensions,
with obvious generalization to more dimensions.
Points (pixels in an image) with equal
from p form a diamond around p; in an image:
Points with
from p are called the 4-connected neighbours of p.
The chess board distance: in two dimensions,
Points with equal
from p form a square around p; in an image:
Points (pixels in an image) with
from p are called the 8-connected neighbours of p.
e.g. [Rosenfeld76].
A metric can also be defined in a binary space, e.g. as the distance between two bit patterns (
Hamming Distance).