Pixel connectivity

From testwiki
Revision as of 13:51, 5 July 2024 by imported>Citation bot (Added bibcode. Removed parameters. | Use this bot. Report bugs. | Suggested by Abductive | Category:Graph connectivity | #UCB_Category 29/36)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Graph connectivity sidebar 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

The 9 possible connectivities in a 5x5x5 neighborhood

In order to specify a set of connectivities, the dimension Template:Mvar and the width of the neighborhood Template:Mvar, must be specified. The dimension of a neighborhood is valid for any dimension n1. 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

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 Template:Mvar. For a given q, Template:Mvar 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 Template:Mvar. 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 2Nn0

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

E=N!j=0knj!2Nn0

Let Template:Mvar represent the number of elements inside of the hypersphere SNd within the neighborhood MNn. Template:Mvar 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 Template:Mvar representing its place in order. Then an ordered vector qp,p{1,2,...,x=1k(x+1)} if all Template:Mvar are unique. Therefore Template:Mvar can be defined iteratively as

Vqp=Vqp1+Eqp,Vq0=0,

or

Vqp=x=1pEqx

If some qx=qy, then both vectors should be considered as the same Template:Mvar such that Vqp=Vqp1+Eqp,1+Eqp,2,Vq0=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)

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

G=V1[1]

Table of Selected Connectivities

Neighborhood
Size:

MNn

Connectivity
Type
Typical
Vector:

q

Sphere
Radius:

Template:Nobold

Elements
on Sphere:

Template:Nobold

Elements
in Sphere:

Template:Nobold

Neighborhood
Connectivity:

Template:Nobold

1 edge (0) Template:Square root 1Template:Times1 = 1 1 0
3 point (1) Template:Square root 1Template:Times2 = 2 3 2
5 point-point (2) Template:Square root 1Template:Times2 = 2 5 4
...
1Template:Times1 face (0,0) Template:Square root 1Template:Times1 = 1 1 0
3Template:Times3 edge (0,1) Template:Square root 2Template:Times2 = 4 5 4
point (1,1) Template:Square root 1Template:Times4 = 4 9 8
5Template:Times5 edge-edge (0,2) Template:Square root 2Template:Times2 = 4 13 12
point-edge (1,2) Template:Square root 2Template:Times4 = 8 21 20
point-point (2,2) Template:Square root 1Template:Times4 = 4 25 24
...
1Template:Times1Template:Times1 volume (0,0,0) Template:Square root 1Template:Times1 = 1 1 0
3Template:Times3Template:Times3 face (0,0,1) Template:Square root 3Template:Times2 = 6 7 6
edge (0,1,1) Template:Square root 3Template:Times4 = 12 19 18
point (1,1,1) Template:Square root 1Template:Times8 = 8 27 26
5Template:Times5Template:Times5 face-face (0,0,2) Template:Square root 3Template:Times2 = 6 33 32
edge-face (0,1,2) Template:Square root 6Template:Times4 = 24 57 56
point-face (1,1,2) Template:Square root 3Template:Times8 = 24 81 80
edge-edge (0,2,2) Template:Square root 3Template:Times4 = 12 93 92
point-edge (1,2,2) Template:Square root 3Template:Times8 = 24 117 116
point-point (2,2,2) Template:Square root 1Template:Times8 = 8 125 124
...
1Template:Times1Template:Times1Template:Times1 hypervolume (0,0,0,0) Template:Square root 1Template:Times1 = 1 1 0
3Template:Times3Template:Times3Template:Times3 volume (0,0,0,1) Template:Square root 4Template:Times2 = 8 9 8
face (0,0,1,1) Template:Square root 6Template:Times4 = 24 33 32
edge (0,1,1,1) Template:Square root 4Template:Times8 = 32 65 64
point (1,1,1,1) Template:Square root 1Template:Times16 = 16 81 80
...

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!231=624=12

The basic q in the neighborhood N33, q1=(0,0,0). The Manhattan Distance between our vector and the basic vector is qq01=2, so q=q3. Therefore,

Gq3=Vq31=Eq1+Eq2+Eq31=Eq=(0,0,0)+Eq=(0,0,1)+Eq=(0,1,1)
Eq=(0,0,0)=3!3!*0!*0!233=661=1
Eq=(0,0,1)=3!2!*1!232=622=6
G=1+6+121=18

Which matches the supplied table

Higher values of k & N

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

For this assumption to hold, {N=2,k4N=3,k2N=4,k1

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

Types of connectivity

2-dimensional

Example of neighborhood of pixels - association of eight and four pixels

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

(x±1,y) or (x,y±1)

is connected to the pixel at (x,y).

Template:See also

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 (x+1,y+1) and (x1,y1) are connected to the pixel at (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 (x±1,y±1) is connected to the pixel at (x,y).

Template:See also

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 (x±1,y,z), (x,y±1,z), or (x,y,z±1) is connected to the pixel at (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 (x±1,y±1,z), (x±1,y1,z), (x±1,y,z±1), (x±1,y,z1), (x,y±1,z±1), or (x,y±1,z1) is connected to the pixel at (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 (x±1,y±1,z±1), (x±1,y±1,z1), (x±1,y1,z±1), or (x1,y±1,z±1) is connected to the pixel at (x,y,z).

See also

References

Template:Reflist