0% found this document useful (0 votes)
77 views31 pages

Today's Contents: Basics Relationships Between Pixels

1. Pixels have different types of neighbors including 4-neighbors (N4), diagonal neighbors (ND), and 8-neighbors (N8) which are used to define relationships between pixels. 2. Pixels can be adjacent based on their neighborhood and having similar pixel values, with 4-adjacency, 8-adjacency, and m-adjacency defined based on N4, N8, and N4/ND neighborhoods respectively. 3. Connected components and regions are sets of connected pixels, with region boundaries defined as pixels on the edge of a region. Distance metrics such as city block distance (D4) and chessboard distance

Uploaded by

Jahidul Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views31 pages

Today's Contents: Basics Relationships Between Pixels

1. Pixels have different types of neighbors including 4-neighbors (N4), diagonal neighbors (ND), and 8-neighbors (N8) which are used to define relationships between pixels. 2. Pixels can be adjacent based on their neighborhood and having similar pixel values, with 4-adjacency, 8-adjacency, and m-adjacency defined based on N4, N8, and N4/ND neighborhoods respectively. 3. Connected components and regions are sets of connected pixels, with region boundaries defined as pixels on the edge of a region. Distance metrics such as city block distance (D4) and chessboard distance

Uploaded by

Jahidul Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Today’s Contents

❑ Basics Relationships between Pixels


▪ Neighborhood

▪ Adjacency

▪ Connectivity

▪ Regions and boundaries

▪ Distance

Chapter 2 from R.C. Gonzalez and R.E. Woods, Digital Image Processing
(3rd Edition), Prentice Hall, 2008 [ Section 2.5 ] [Problems: 2.9 ~ 2.17
excluding 2.14]
Pixel and their Relationships
Conventional indexing method of Pixels
(0,0)
x

(x-1,y-1) (x,y-1) (x+1,y-1)

y (x-1,y) (x , y) (x+1,y)

(x-1,y+1) (x,y+1) (x+1,y+1)

Conventional indexing method


2019/1/19 [email protected] 4
Pixel and their Relationships

❑ Neighbors of a pixel

❑ Neighborhood relation is used


to tell adjacent pixels.
❑ It is useful for analyzing regions.

❑ 3 types of neighbors
❑ N4(p): 4-neighbor of p
❑ ND(p): diagonal neighbor of p

❑ N8(p): 8-neighbor of p

4
N4(p): 4-neighbor of p
❑considers only vertical and horizontal neighbors
pixels.
❑ Note: q ∈ N4(p) implies p ∈ N4(q)

(x,y-1)
4-neighbors of p:

(x−1,y)
(x-1,y) p (x+1,y) (x+1,y)
N4(p) (x,y−1)
(x,y+1)
(x,y+1) =

❖ Each of them is at a unit distance from


P. 5
ND(p): diagonal neighbor of p

❑ considers only diagonal neighbors pixels.

❑ Note: q ∈ ND(p) implies p ∈ ND(q)

(x-1,y-1) (x+1,y-1)
Diagonal neighbors of p:

(x−1,y−1)
p (x+1,y−1)
ND(p) (x−1,y+1)
(x+1,y+1)
(x-1,y+1) (x+1,y+1) =

❖ Each of them are at Euclidean distance of 1.414 from


P. 6
N8(p): 8-neighbor of p

❑ considers all neighbors pixels.


❑ Note: q ∈ N8(p) implies p ∈ N8(q)

8-neighbors of p:
(x-1,y-1) (x,y-1) (x+1,y-1)
(x−1,y−1)
(x,y−1)
(x+1,y−1)
(x-1,y) p (x+1,y)
(x−1,y)
N8(p) = (x+1,y)
(x−1,y+1)
(x-1,y+1) (x,y+1) (x+1,y+1)
(x,y+1)
(x+1,y+1)

7
• Some of the points in the N4, ND and N8 may fall
outside image when P lies on the border of image.
Pixel Adjacencies

❑ Adjacencies depends on both


– neighborhood
– Pixel gray values

Two pixels are connected if they are neighbors


and their gray levels satisfy some specified
criterion of similarity.

For example, in a binary image two pixels are


connected if they are 4-neighbors and have same
value (0/1).
9
Pixel Adjacencies
❑ Adjacencies depends on both
– neighborhood
– Pixel gray values
Let V be the set of intensity values

Adjacent pixels must be neighbors and have gray values


from the same set, V
In binary image, V = {1} if we are referring to adjacency of
pixels with value 1
In gray-scale image, V can be any subset of 256 values
10
Pixel Adjacencies

❑ 3 types of adjacencies
▪ 4-adjacency
▪ 8-adjacency
▪ m-adjacency

11
Pixel Adjacencies

❑ 4-adjacency
– Two pixels p, q are 4-adjacent if
• q is in the set N4(p)
N4(p)
• p, q have values from set V,
(V be the set of intensity values )

p q
r

12
Pixel Adjacencies

❑ 8-adjacency
– Two pixels p, q are 8-adjacent if
• q is in the set N8(p) N8(p)
• p, q have values from set V,
(V be the set of intensity values)

q r
p

13
Pixel Adjacencies
❑ m-adjacency
– Two pixels p, q are m-adjacent if
• p, q have values from set V, and
– q in N4(p), or
– q in ND(p) and
– has no pixel with value from V

q
t
p s
p, q are not m-adjacency pixels
s, t are m-adjacency pixels
14
Connectivity / Digital Path

8-path m-path

p p p

q q q

m-path from p to q
8-path from p to q
solves this ambiguity
results in some ambiguity

16
Adjacency / Connectivity
❑ Let S represent a subset of pixels in an image,
– Two pixels p and q are connected in S if there
is a path between p and q entirely in S

p
S
q

❑ Two image subsets S1 and S2 are adjacent if


some pixel in S1 is adjacent to some pixel in S2
17
Connected Component

❑ Connected Component in a set of pixels, S


– For any pixel p in S, the set of pixels that are connected
to it in S is called a connected component of S

18
Definition of Region
❑ Connected Set, S
– If all pixels of S are connected to p

pp
S
q Region

❑ If it only has one connected component,


then set S is called a connected set.
And we call S a region of the image

Region is a Connected Set


❑ Region that are not adjacent are said to be disjoint.

❑Example: the two regions (of 1s) in figure, are


adjacent only if 8-adjacany is used.

❑4-path between the two regions does not exist,


(so their union in not a connected set).

20
Boundary of a
region
• Boundary of a region, R
– Set of pixels whose at least one neighbor is not in R
– also called border or contour) of a region R

Boundary
or contour

❑If R happens to be an entire image, then its boundary is defined as


the set of pixels in the first and last rows and columns in the image.

21
Distance Metrics

⬥ Let pixels p, q and z have coordinates (x,y),


(s,t) and (u,v) respectively.

D, distance function has following properties:


■ D(p,q) ≥ 0 [D(p,q) = 0 iff p = q and]
■ D(p,q) = D(q,p) and
■ D(p,z) ≤ D(p,q) + D(q,z)

22
Distance Metrics

23
City block distance (D4
distance)
D4 ( p, q) = x − s + y
−t
⬥ Diamond with center at (x,y)
⬥ D4 = 1 are the 4 neighbors of pixel p(x,y)

24
Chessboard distance (D8
distance)
D8 ( p, q) = max( x − s , y − t
)
⬥ Square centered at p(x,y)

⬥ D8 = 1 are the 8 neighbors of pixel p(x,y)

25
Euclidean Distance

A circle with radius r centered at (x,y) 26


Distance Measures

(7^2+6^2)^0.
5
= 9.22

29
Class/Home Work
3 1 2 1(a)
• N4(p) =? 2 2 0 2
• N8(p) =?
• Nm(p) =? If V={1,2} 1 2 (p) 1 1
• Is (a) 4-adjacent of (b)? 1(b) 0 1 2
• Is (a) 8-adjacent of (b)?
• Is (a) m-adjacent of (b)?
• Calculate D4 = ?, D8 = ?, De = ? for the point (a) ^ (b).

Text Book 1
Chapter 2: Problems: 2.9 ~ 2.17 excluding 2.14

You might also like