Basic Relationship between pixels
Contents
• Neighborhood
• Adjacency
• Connectivity
• Paths
• Regions and boundaries
Relationship between pixels
• Conventional indexing method
y
(0,0)
(x-1, y-1) (x-1,y) (x-1,y+1)
x (x,y-1) (x,y) (x,y+1)
(x+1, y-1) (x+1,y) (x+1, y+1)
Neighbors of a pixel
• N4(P): 4-neighbors of p
(x-1, y-1) (x-1,y) (x-1,y+1)
(x,y-1) (x,y) (x,y+1)
(x+1, y-1) (x+1,y) (x+1, y+1)
• N D ( p) : four diagonal neighbors of p
(x-1, y-1) (x-1,y) (x-1,y+1)
(x,y-1) (x,y) (x,y+1)
(x+1, y-1) (x+1,y) (x+1, y+1)
• N8(P): 8-neighbors of p
• N4(P) and ND(P)
(x-1, y-1) (x-1,y) (x-1,y+1)
(x,y-1) (x,y) (x,y+1)
(x+1, y-1) (x+1,y) (x+1, y+1)
Adjacency
• V: The set of gray-level values used to define adjacency
• 4-adjacency: Two pixels p and q with values from V are 4-adjacent if q is in the set
N4(p).
• 8-adjacency: Two pixels p and q with values from V are 8-adjacent if q
is in the set N8(p).
V={0,1} V={1,2}
0 1 0 0 1 1
0 1 0
0 2 0
0 0 0 0 0 1
➢m-adjacency: Two pixels p and q with values from V are m-
adjacent if
(i) q is in the set N4(p), or
(ii) q is in the set ND(p) and the set N4(p) ∩ N4(p) has no pixels whose
values are from V.
V={1}
Digital Path
• A path from pixel p with coordinates (x, y) to pixel q with coordinates
(s, t) is a sequence of distinct pixels with coordinates:
• (x 0, y 0), (x 1, y 1), (x2, y 2) … (x n, y n), where (x 0, y 0)=(x, y) and
(x n,yn)=(s, t); (x i, y i ) is adjacent to (xi-1, yi-1)
• Length of path = n
• 4/8/m-paths
Connectivity
• Connected Pixels:
If p and q are pixels of an image subset S then p is connected to q
in S if there is a path from p to q consisting entirely of pixels in S
• Connected component:
For every pixel p in S, the set of pixels in S that are connected to
p is called a connected component of S
• Connected Set:
If S has only one connected component then S is called
Connected Set
Region and boundary
• Region: A subset R of pixels in an image is called a Region of the
image if R is a connected set.
• Adjacent Regions:
Border and Edge
• Foreground: If an image contains ‘K’ disjoint regions, Rk, k=1,2,…..N,
then
𝑅𝑢 = σ𝑁 𝐾=1 𝑅𝑘
• Background: (𝑅𝑢)c
• Border: of a region ‘R’ is the set of points that are adjacent to points
in complement of ‘R’
• Spatial resolution- No. of pixels per unit distance (dpi)
• Intensity resolution- No. of bits used to quantize intensity (k)
• No.of intensity levels- [0 L-1] where L = 2k
• Image contrast = max.intensity – min.intensity
• No. of bits for storage = b = M * N * k
• Edge: It is intensity discontinuity
Edge point Edge segment border
Distance Measures
Practice Exercises: let v={2,3,4,5,6}.
Types- Compute the distances between
two pixels p and q.
• D4<=2 from (x, y)
• D8<=2 from (x, y)
Practice Exercises
V= {2,3,5}
• Compute shortest 4-, 8-, m-paths between pixels p and q where
V= {1, 2}
• Consider the following matrix corresponding to pixel values of image.
• Compute:
1) Spatial Resolution
2) Intensity resolution
3) Image contrast 1.Matrix size: 4×4So:𝑀=4,𝑁=4 Number
of pixels:Total Pixels=𝑀×𝑁=16
4) Dynamic range 2. From the matrix:Min intensity = 85
Max intensity = 145
5) Gray scale 3. Dynamic contrast=145−85=60
4) Dynamic range=145/85=1.705
5) If stored with k bits per pixel:𝐿=2^𝑘
if 𝑘=8:𝐿=256
Storage Requirement:
b=M×N×k
If 𝑘=8
𝑏=4×4×8=128 bits (16 bytes)