Pixel connectivity

In image processing, pixel connectivity is the way in which pixels in 2-dimensional (or hypervoxels in n-dimensional) images relate to their neighbors.

In order to specify a set of connectivities, the dimension N and the width of the neighborhood n, must be specified.

A common width is 3, which means along each dimension, the central cell will be adjacent to 1 cell on either side for all dimensions.

represent a N-dimensional hypercubic neighborhood with size on each dimension of

represent a discrete vector in the first orthant from the center structuring element to a point on the boundary of

represent a N-dimensional hypersphere with radius of

Define the amount of elements on the hypersphere

, E will be equal to the amount of permutations of

multiplied by the number of orthants.

represent the amount of elements in vector

The total number of permutation of

is shared in common between orthants.

Because of this, the multiplying factor on the permutation must be adjusted from

Multiplying the number of amount of permutations by the adjusted amount of orthants yields, Let V represent the number of elements inside of the hypersphere

V will be equal to the number of elements on the hypersphere plus all of the elements on the inner shells.

Assume the ordered vectors

are assigned a coefficient p representing its place in order.

Note that each neighborhood will need to have the values from the next smallest neighborhood added.

Subtracting 1 yields the neighborhood connectivity, G

Therefore, Which matches the supplied table The assumption that all

are unique does not hold for higher values of k & N. Consider

This means that specification of a given d could refer to multiple

These pixels are connected horizontally and vertically.

6-connected pixels are neighbors to every pixel that touches one of their corners (which includes pixels that touch one of their edges) in a hexagonal grid or stretcher bond rectangular grid.

There are several ways to map hexagonal tiles to integer pixel coordinates.

These pixels are connected horizontally, vertically, and diagonally.

These pixels are connected along one of the primary axes.

These pixels are connected along either one or two of the primary axes.

26-connected pixels are neighbors to every pixel that touches one of their faces, edges, or corners.

These pixels are connected along either one, two, or all three of the primary axes.

The 9 possible connectivities in a 5x5x5 neighborhood
Example of neighborhood of pixels - association of eight and four pixels