Distance Measure
The meat of the k-means algorithm is calculating the distance between
each pixel and each class center. There are different distance
measures that can be used. The most common are:
- L1 distance (Manhattan distance): The absolute value of the
componentwise difference between the pixel and the class. This is the
simplest distance to calculate and may be more robust to outliers.
- L2 distance (Euclidean distance): The square root of the
componentwise square of the difference between the pixel and the
class. Since we are only comparing the results, you can omit the
square root. Computing the L2 distance requires squaring the data,
which introduces extra bits of precision into the data. The squaring
operation is expensive in hardware. One advantage of this metric is
that the distance is a sphere around the centroid.
This page is maintained
by Prof. Miriam Leeser
Last updated September 16, 1999.
Email: mel@ece.neu.edu