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 [math]\displaystyle{ N }[/math] and the width of the neighborhood [math]\displaystyle{ n }[/math], must be specified. The dimension of a neighborhood is valid for any dimension [math]\displaystyle{ n\geq1 }[/math]. 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 [math]\displaystyle{ M_N^n }[/math] represent a N-dimensional hypercubic neighborhood with size on each dimension of [math]\displaystyle{ n=2k+1, k\in\mathbb{Z} }[/math]
Let [math]\displaystyle{ \vec{q} }[/math] represent a discrete vector in the first orthant from the center structuring element to a point on the boundary of [math]\displaystyle{ M_N^n }[/math]. This implies that each element [math]\displaystyle{ q_i \in \{0,1,...,k\} ,\forall i \in \{1,2,...,N\} }[/math] and that at least one component [math]\displaystyle{ q_i = k }[/math]
Let [math]\displaystyle{ S_N^d }[/math] represent a N-dimensional hypersphere with radius of [math]\displaystyle{ d=\left \Vert \vec{q} \right \Vert }[/math].
Define the amount of elements on the hypersphere [math]\displaystyle{ S_N^d }[/math] within the neighborhood [math]\displaystyle{ M_N^n }[/math] as [math]\displaystyle{ E }[/math]. For a given [math]\displaystyle{ \vec{q} }[/math], [math]\displaystyle{ E }[/math] will be equal to the amount of permutations of [math]\displaystyle{ \vec{q} }[/math] multiplied by the number of orthants.
Let [math]\displaystyle{ n_j }[/math] represent the amount of elements in vector [math]\displaystyle{ \vec{q} }[/math] which take the value [math]\displaystyle{ j }[/math]. [math]\displaystyle{ n_j = \sum_{i=1}^N (q_i=j) }[/math]
The total number of permutation of [math]\displaystyle{ \vec{q} }[/math] can be represented by a multinomial as [math]\displaystyle{ \frac{N!} {\prod_{j=0}^kn_j!} }[/math]
If any [math]\displaystyle{ q_i = 0 }[/math], then the vector [math]\displaystyle{ \vec{q} }[/math] is shared in common between orthants. Because of this, the multiplying factor on the permutation must be adjusted from [math]\displaystyle{ 2^{N} }[/math] to be [math]\displaystyle{ 2^{N-n_0} }[/math]
Multiplying the number of amount of permutations by the adjusted amount of orthants yields,
Let [math]\displaystyle{ V }[/math] represent the number of elements inside of the hypersphere [math]\displaystyle{ S_N^d }[/math] within the neighborhood [math]\displaystyle{ M_N^n }[/math]. [math]\displaystyle{ V }[/math] 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 [math]\displaystyle{ \left \Vert \vec{q} \right \Vert = r }[/math]. Assume the ordered vectors [math]\displaystyle{ \vec{q} }[/math] are assigned a coefficient [math]\displaystyle{ p }[/math] representing its place in order. Then an ordered vector [math]\displaystyle{ \vec{q_p}, p \in \{1, 2, ..., \sum_{x=1}^k (x+1)\} }[/math] if all [math]\displaystyle{ r }[/math] are unique. Therefore [math]\displaystyle{ V }[/math] can be defined iteratively as
or
If some [math]\displaystyle{ \left \Vert \vec{q_x} \right \Vert = \left \Vert \vec{q_y} \right \Vert }[/math], then both vectors should be considered as the same [math]\displaystyle{ p }[/math] such that
[math]\displaystyle{ V_{\vec{q_p}} = V_{\vec{q_{p-1}}} + E_{\vec{q_{p,1}}} + E_{\vec{q_{p,2}}}, V_{\vec{q_0}}=0 }[/math]
Note that each neighborhood will need to have the values from the next smallest neighborhood added. Ex. [math]\displaystyle{ V_{\vec{q}=(0,2)} = V_{\vec{q}=(1,1)} + E_{\vec{q}=(0,2)} }[/math]
[math]\displaystyle{ V }[/math] includes the center hypervoxel, which is not included in the connectivity. Subtracting 1 yields the neighborhood connectivity, [math]\displaystyle{ G }[/math]
Neighborhood Size:
[math]\displaystyle{ M^n_N }[/math] |
Connectivity Type | Typical Vector:
[math]\displaystyle{ \vec{q} }[/math] |
Sphere Radius
[math]\displaystyle{ d }[/math] |
Elements on Sphere:
[math]\displaystyle{ E }[/math] |
Elements in Sphere:
[math]\displaystyle{ V }[/math] |
Neighborhood Connectivity:
[math]\displaystyle{ G }[/math] |
---|---|---|---|---|---|---|
1 | edge | (0) | 1*1=1 | 1 | 0 | |
3 | point | (1) | 1*2=2 | 3 | 2 | |
5 | point-point | (2) | 1*2=2 | 5 | 4 | |
... | ||||||
1x1 | face | (0,0) | 1*1=1 | 1 | 0 | |
3x3 | edge | (0,1) | 2*2=4 | 5 | 4 | |
point | (1,1) | 1*4=4 | 9 | 8 | ||
5x5 | edge-edge | (0,2) | 2*2=4 | 13 | 12 | |
point-edge | (1,2) | 2*4=8 | 21 | 20 | ||
point-point | (2,2) | 1*4=4 | 25 | 24 | ||
... | ||||||
1x1x1 | volume | (0,0,0) | 1*1=1 | 1 | 0 | |
3x3x3 | face | (0,0,1) | 3*2=6 | 7 | 6 | |
edge | (0,1,1) | 3*4=12 | 19 | 18 | ||
point | (1,1,1) | 1*8=8 | 27 | 26 | ||
5x5x5 | face-face | (0,0,2) | 3*2=6 | 33 | 32 | |
edge-face | (0,1,2) | 6*4=24 | 57 | 56 | ||
point-face | (1,1,2) | 3*8=24 | 81 | 80 | ||
edge-edge | (0,2,2) | 3*4=12 | 93 | 92 | ||
point-edge | (1,2,2) | 3*8=24 | 117 | 116 | ||
point-point | (2,2,2) | 1*8=8 | 125 | 124 | ||
... | ||||||
1x1x1x1 | hypervolume | (0,0,0,0) | 1*1=1 | 1 | 0 | |
3x3x3x3 | volume | (0,0,0,1) | 4*2=8 | 9 | 8 | |
face | (0,0,1,1) | 6*4=24 | 33 | 32 | ||
edge | (0,1,1,1) | 4*8=32 | 65 | 64 | ||
point | (1,1,1,1) | 1*16=16 | 81 | 80 | ||
... |
Consider solving for [math]\displaystyle{ G|\vec{q}=(0,1,1) }[/math]
In this scenario, [math]\displaystyle{ N=3 }[/math] since the vector is 3-dimensional. [math]\displaystyle{ n_0=1 }[/math] since there is one [math]\displaystyle{ q_i=0 }[/math]. Likewise, [math]\displaystyle{ n_1=2 }[/math]. [math]\displaystyle{ k=1, n=3 }[/math] since [math]\displaystyle{ \max q_i = 1 }[/math]. [math]\displaystyle{ d=\sqrt{0^2 + 1^2 + 1^2}=\sqrt{2} }[/math]. The neighborhood is [math]\displaystyle{ M^3_3 }[/math] and the hypersphere is [math]\displaystyle{ S_3^\sqrt{2} }[/math]
The basic [math]\displaystyle{ \vec{q} }[/math] in the neighborhood [math]\displaystyle{ N^3_3 }[/math], [math]\displaystyle{ \vec{q_1} = (0,0,0) }[/math]. The Manhattan Distance between our vector and the basic vector is [math]\displaystyle{ \left \Vert \vec{q} - \vec{q_0} \right \Vert_1 = 2 }[/math], so [math]\displaystyle{ \vec{q} = \vec{q_3} }[/math]. Therefore,
Which matches the supplied table
The assumption that all [math]\displaystyle{ \left \Vert \vec{q_p} \right \Vert = r }[/math] are unique does not hold for higher values of k & N. Consider [math]\displaystyle{ N=2, k=5 }[/math], and the vectors [math]\displaystyle{ \vec{q_A}=(0,5), \vec{q_B}=(3,4) }[/math]. Although [math]\displaystyle{ \vec{q_A} }[/math] is located in [math]\displaystyle{ M_2^5 }[/math], the value for [math]\displaystyle{ r=25 }[/math], whereas [math]\displaystyle{ \vec{q_B} }[/math] is in the smaller space [math]\displaystyle{ M_2^4 }[/math] but has an equivalent value [math]\displaystyle{ r=25 }[/math]. [math]\displaystyle{ \vec{q_C}=(4,4) \in M_{2}^{4} }[/math] but has a higher value of [math]\displaystyle{ r=32 }[/math] than the minimum vector in [math]\displaystyle{ M_2^5 }[/math].
For this assumption to hold, [math]\displaystyle{ \begin{cases} N=2, k \leq 4 \\ N=3, k \leq 2 \\ N=4, k \leq 1 \end{cases} }[/math]
At higher values of [math]\displaystyle{ k }[/math] & [math]\displaystyle{ N }[/math], Values of [math]\displaystyle{ d }[/math] will become ambiguous. This means that specification of a given [math]\displaystyle{ d }[/math] could refer to multiple [math]\displaystyle{ \vec{q_p} \in M_n^N }[/math].
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
is connected to the pixel at [math]\displaystyle{ \textstyle(x, y) }[/math].
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 [math]\displaystyle{ \textstyle(x+1,y+1) }[/math] and [math]\displaystyle{ \textstyle(x-1,y-1) }[/math] are connected to the pixel at [math]\displaystyle{ \textstyle(x,y) }[/math].
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 [math]\displaystyle{ \textstyle(x\pm1,y\pm1) }[/math] is connected to the pixel at [math]\displaystyle{ \textstyle(x,y) }[/math].
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 [math]\displaystyle{ \textstyle(x\pm1, y, z) }[/math], [math]\displaystyle{ \textstyle(x, y\pm1, z) }[/math], or [math]\displaystyle{ \textstyle(x, y, z\pm1) }[/math] is connected to the pixel at [math]\displaystyle{ \textstyle(x, y, z) }[/math].
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 [math]\displaystyle{ \textstyle(x\pm1, y\pm1, z) }[/math], [math]\displaystyle{ \textstyle(x\pm1, y\mp1, z) }[/math], [math]\displaystyle{ \textstyle(x\pm1, y, z\pm1) }[/math], [math]\displaystyle{ \textstyle(x\pm1, y, z\mp1) }[/math], [math]\displaystyle{ \textstyle(x, y\pm1, z\pm1) }[/math], or [math]\displaystyle{ \textstyle(x, y\pm1, z\mp1) }[/math] is connected to the pixel at [math]\displaystyle{ \textstyle(x, y, z) }[/math].
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 [math]\displaystyle{ \textstyle(x\pm1, y\pm1, z\pm1) }[/math], [math]\displaystyle{ \textstyle(x\pm1, y\pm1, z\mp1) }[/math], [math]\displaystyle{ \textstyle(x\pm1, y\mp1, z\pm1) }[/math], or [math]\displaystyle{ \textstyle(x\mp1, y\pm1, z\pm1) }[/math] is connected to the pixel at [math]\displaystyle{ \textstyle(x, y, z) }[/math].
Original source: https://en.wikipedia.org/wiki/Pixel connectivity.
Read more |