Lably
Skip to content

Pixel connectivity

  • 4 min read
  • 2 chapters

Related on Lably

Through Digital image processing, Pixel and Cartesian coordinate system

Formulation

In order to specify a set of connectivities, the dimension N and the width of the neighborhood n, must be specified. The dimension of a neighborhood is valid for any dimension n≥1. 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 MNn represent a N-dimensional hypercubic neighborhood with size on each dimension of n=2k+1,k∈Z

Let q→ represent a discrete vector in the first orthant from the center structuring element to a point on the boundary of MNn. This implies that each element qi∈{0,1,...,k},∀i∈{1,2,...,N} and that at least one component qi=k

Let SNd represent a N-dimensional hypersphere with radius of d=‖q→‖.

Define the amount of elements on the hypersphere SNd within the neighborhood MNn as E. For a given q→, E will be equal to the amount of permutations of q→ multiplied by the number of orthants.

Let nj represent the amount of elements in vector q→ which take the value j. nj=∑i=1N(qi=j)

The total number of permutation of q→ can be represented by a multinomial as N!∏j=0knj!

If any qi=0, then the vector q→ is shared in common between orthants. Because of this, the multiplying factor on the permutation must be adjusted from 2N to be 2N−n0

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

E=N!∏j=0knj!2N−n0

Let V represent the number of elements inside of the hypersphere SNd within the neighborhood MNn. V 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 ‖q→‖=r. Assume the ordered vectors q→ are assigned a coefficient p representing its place in order. Then an ordered vector q→p,p∈{1,2,...,∑x=1k(x+1)} if all r are unique. Therefore V can be defined iteratively as

Vq→p=Vq→p−1+Eq→p,Vq→0=0,

or

Vq→p=∑x=1pEq→x

If some ‖q→x‖=‖q→y‖, then both vectors should be considered as the same p such that Vq→p=Vq→p−1+Eq→p,1+Eq→p,2,Vq→0=0 Note that each neighborhood will need to have the values from the next smallest neighborhood added. Ex. Vq→=(0,2)=Vq→=(1,1)+Eq→=(0,2)

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

G=V−1

Table of Selected Connectivities

Example

Consider solving for G|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=02+12+12=2. The neighborhood is M33 and the hypersphere is S32

E=3!1!∗2!∗0!23−1=624=12

The basic q→ in the neighborhood N33, q→1=(0,0,0). The Manhattan Distance between our vector and the basic vector is ‖q→−q→0‖1=2, so q→=q→3. Therefore,

Gq→3=Vq→3−1=Eq→1+Eq→2+Eq→3−1=Eq→=(0,0,0)+Eq→=(0,0,1)+Eq→=(0,1,1)
Eq→=(0,0,0)=3!3!∗0!∗0!23−3=661=1
Eq→=(0,0,1)=3!2!∗1!23−2=622=6
G=1+6+12−1=18

Which matches the supplied table

Higher values of k & N

The assumption that all ‖q→p‖=r are unique does not hold for higher values of k & N. Consider N=2,k=5, and the vectors q→A=(0,5),q→B=(3,4). Although q→A is located in M25, the value for r=25, whereas q→B is in the smaller space M24 but has an equivalent value r=25. q→C=(4,4)∈M24 but has a higher value of r=32 than the minimum vector in M25.

For this assumption to hold, {N=2,k≤4N=3,k≤2N=4,k≤1

At higher values of k & N, Values of d will become ambiguous. This means that specification of a given d could refer to multiple q→p∈MnN.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication