Pixel connectivity explained

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

Formulation

In order to specify a set of connectivities, the dimension and the width of the neighborhood, must be specified. The dimension of a neighborhood is valid for any dimension

n\geq1

. 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.

Let

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

n=2k+1,k\inZ

Let

\vec{q}

represent a discrete vector in the first orthant from the center structuring element to a point on the boundary of
n
M
N
. This implies that each element

qi\in\{0,1,...,k\},\foralli\in\{1,2,...,N\}

and that at least one component

qi=k

Let

d
S
N
represent a N-dimensional hypersphere with radius of

d=\left\Vert\vec{q}\right\Vert

.

Define the amount of elements on the hypersphere

d
S
N
within the neighborhood
n
M
N
as . For a given

\vec{q}

, will be equal to the amount of permutations of

\vec{q}

multiplied by the number of orthants.

Let

nj

represent the amount of elements in vector

\vec{q}

which take the value .

nj=

N
\sum
i=1

(qi=j)

The total number of permutation of

\vec{q}

can be represented by a multinomial as
N!
kn
\prod
j!

If any

qi=0

, then the vector

\vec{q}

is shared in common between orthants. Because of this, the multiplying factor on the permutation must be adjusted from

2N

to be
N-n0
2

Multiplying the number of amount of permutations by the adjusted amount of orthants yields,

E=N!
kn
\prod
j!
N-n0
2

Let represent the number of elements inside of the hypersphere

d
S
N
within the neighborhood
n
M
N
. will be equal to the number of elements on the hypersphere plus all of the elements on the inner shells. The shells must be ordered by increasing order of

\left\Vert\vec{q}\right\Vert=r

. Assume the ordered vectors

\vec{q}

are assigned a coefficient representing its place in order. Then an ordered vector

\vec{q}p,p\in\left\{1,2,...,

k
\sum
x=1

(x+1)\right\}

if all are unique. Therefore can be defined iteratively as

V\vec{qp

} = V_ + E_, V_=0,

or

V\vec{qp

} = \sum_^p E_If some

\left\Vert\vec{q}x\right\Vert=\left\Vert\vec{q}y\right\Vert

, then both vectors should be considered as the same such that V_ = V_ + E_ + E_, V_=0Note that each neighborhood will need to have the values from the next smallest neighborhood added. Ex.

V\vec{q=(0,2)}=V\vec{q=(1,1)}+E\vec{q=(0,2)}

includes the center hypervoxel, which is not included in the connectivity. Subtracting 1 yields the neighborhood connectivity,

G=V-1

[1]

Table of Selected Connectivities

!Neighborhood
Size:
n
M
N
!Connectivity
Type!Typical
Vector:

\vec{q}

!Sphere
Radius:
!Elements
on Sphere:
!Elements
in Sphere:
!Neighborhood
Connectivity:
1edge(0)11 = 110
3point(1)12 = 232
5point-point(2)12 = 254
...
11face(0,0)11 = 110
33edge(0,1)22 = 454
point(1,1)14 = 498
55edge-edge(0,2)22 = 41312
point-edge(1,2)24 = 82120
point-point(2,2)14 = 42524
...
111volume(0,0,0)11 = 110
333face(0,0,1)32 = 676
edge(0,1,1)34 = 121918
point(1,1,1)18 = 82726
555face-face(0,0,2)32 = 63332
edge-face(0,1,2)64 = 245756
point-face(1,1,2)38 = 248180
edge-edge(0,2,2)34 = 129392
point-edge(1,2,2)38 = 24117116
point-point(2,2,2)18 = 8125124
...
1111hypervolume(0,0,0,0)11 = 110
3333volume(0,0,0,1)42 = 898
face(0,0,1,1)64 = 243332
edge(0,1,1,1)48 = 326564
point(1,1,1,1)116 = 168180
...

Example

Consider solving for

G|\vec{q}=(0,1,1)

In this scenario,

N=3

since the vector is 3-dimensional.

n0=1

since there is one

qi=0

. Likewise,

n1=2

.

k=1,n=3

since

maxqi=1

.

d=\sqrt{02+12+12}=\sqrt{2}

. The neighborhood is
3
M
3
and the hypersphere is
\sqrt{2}
S
3
E=3!
1!*2!*0!

23-1=

6
2

4=12

The basic

\vec{q}

in the neighborhood
3
N
3
,

\vec{q}1=(0,0,0)

. The Manhattan Distance between our vector and the basic vector is

\left\Vert\vec{q}-\vec{q}0\right\Vert1=2

, so

\vec{q}=\vec{q}3

. Therefore,

G\vec{q3

} = V_ - 1 = E_ + E_ + E_ - 1 = E_ + E_ + E_

E\vec{q=(0,0,0)}=

3!
3!*0!*0!

23-3=

6
6

1=1

E\vec{q=(0,0,1)}=

3!
2!*1!

23-2=

6
2

2=6

G=1+6+12-1=18

Which matches the supplied table

Higher values of k & N

The assumption that all

\left\Vert\vec{q}p\right\Vert=r

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

N=2,k=5

, and the vectors

\vec{q}A=(0,5),\vec{q}B=(3,4)

. Although

\vec{q}A

is located in
5
M
2
, the value for

r=25

, whereas

\vec{q}B

is in the smaller space
4
M
2
but has an equivalent value

r=25

.

\vec{q}C=(4,4)\in

4
M
2
but has a higher value of

r=32

than the minimum vector in
5
M
2
.

For this assumption to hold,

\begin{cases}N=2,k\leq4\N=3,k\leq2\N=4,k\leq1\end{cases}

At higher values of &, Values of will become ambiguous. This means that specification of a given could refer to multiple

\vec{q}p\in

N
M
n
.

Types of connectivity

2-dimensional

4-connected

4-connected pixels are neighbors to every pixel that touches one of their edges. These pixels are connected horizontally and vertically. In terms of pixel coordinates, every pixel that has the coordinates

style(x\pm1,y)

or

style(x,y\pm1)

is connected to the pixel at

style(x,y)

.

See also: Von Neumann neighborhood.

6-connected

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. With one method, in addition to the 4-connected pixels, the two pixels at coordinates

style(x+1,y+1)

and

style(x-1,y-1)

are connected to the pixel at

style(x,y)

.

8-connected

8-connected pixels are neighbors to every pixel that touches one of their edges or corners. These pixels are connected horizontally, vertically, and diagonally. In addition to 4-connected pixels, each pixel with coordinates

style(x\pm1,y\pm1)

is connected to the pixel at

style(x,y)

.

See also: Moore neighborhood.

3-dimensional

6-connected

6-connected pixels are neighbors to every pixel that touches one of their faces. These pixels are connected along one of the primary axes. Each pixel with coordinates

style(x\pm1,y,z)

,

style(x,y\pm1,z)

, or

style(x,y,z\pm1)

is connected to the pixel at

style(x,y,z)

.

18-connected

18-connected pixels are neighbors to every pixel that touches one of their faces or edges. These pixels are connected along either one or two of the primary axes. In addition to 6-connected pixels, each pixel with coordinates

style(x\pm1,y\pm1,z)

,

style(x\pm1,y\mp1,z)

,

style(x\pm1,y,z\pm1)

,

style(x\pm1,y,z\mp1)

,

style(x,y\pm1,z\pm1)

, or

style(x,y\pm1,z\mp1)

is connected to the pixel at

style(x,y,z)

.

26-connected

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. In addition to 18-connected pixels, each pixel with coordinates

style(x\pm1,y\pm1,z\pm1)

,

style(x\pm1,y\pm1,z\mp1)

,

style(x\pm1,y\mp1,z\pm1)

, or

style(x\mp1,y\pm1,z\pm1)

is connected to the pixel at

style(x,y,z)

.

See also

Notes and References

  1. Book: Jonker, Pieter. Morphological Image Processing: Architecture and VLSI design. Kluwer Technische Boeken B.V.. 1992. 978-1-4615-2804-3. 92–96.