The black pixels are considered to be neighbors of the red pixel in the following schemes.
4-connected | 8-connected | 6P-connected | 6N-connected |
Depending on the definition of connectivity the black pixels below form either one or two connected regions.
If the border is 8-connected then the interior is 4-connected and vice versa.
City Block metricD4 distance, 1-norm, |x2-x1|+|y2-y1|
|
Chessboard metricD8 distance, infinity-norm, max(|x2-x1|,|y2-y1|)
|
average metricAverage of cityblock and chessboard metrics
|
Euclidian metricPythogorean metric
|
The diagram below shows the contours of equal distance for the 1-norm (diamond), 2-norm (circle), and infinity-norm (square)
Maintained by John Loomis, last updated 29 May 1998