4pixelrelationships 120321052747 Phpapp02
4pixelrelationships 120321052747 Phpapp02
Pixels
Neighbors of a
Pixel
Y
X
Neighbors of a
Pixel
f(0, f(0, f(0,2 f(0, f(0,4) - - -
0) 1) ) 3) --
f(x,y) f(1, f(1, f(1, f(1, f(1,4) - - -
= 0) 1) 2) 3) --
f(2, f(2, f(2,2 f(2, f(2,4)
I - -- -- --
0) 1) ) 3) - --
f(3, f(3, f(3, f(3, f(3,4)
I - -- -- --
0) 1) I 2) I 3) I - --
I I I I
I Y
X
Neighbors of a
Pixel
f(0, f(0, f(0,2 f(0, f(0,4) - - -
0) 1) ) 3) --
f(x,y) f(1, f(1, f(1, f(1, f(1,4) - - -
= 0) 1) 2) 3) --
f(2, f(2, f(2,2 f(2, f(2,4) I -- - -
0) 1) ) 3) - --
f(3, f(3, f(3, f(3, f(3,4)I - -- -- --
0)
A Pixel p at coordinates 1)
( x,I y) 2)
hasI 4 horizontal
3) I - - - and
vertical neighbors.I I I I
I
Their
(x+1,coordinates(x-1, y) by: (x, y+1)
are given & (x, y-
y) 1)
f(2,1) f(0,1) f(1,2) f(1,0)
This set of pixels is called the 4-neighbors of p
denoted by N4(p).
• Neighborhood
• Adjacency
• Connectivity
• Paths
10
Neighbors of a Pixel
• A pixel p at coordinates (x,y) has four horizontal and vertical neighbors
whose coordinates are given by:
(x+1,y), (x-1, y), (x, y+1), (x,y-1)
(x, y-1)
(x, y+1)
This set of pixels, called the 4-neighbors or p, is denoted by N4(p). Each pixel is
one unit distance from (x,y) and some of the neighbors of p lie outside the
digital image if (x,y) is on the border of the image.
• Neighbors of a Pixel
• The four diagonal neighbors of p have coordinates:
(x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1)
As before, some of the points in ND (p) and N8 (p) fall outside the image if (x,y) is on the border of the image.
Adjacency and
Connectivity
• Let V: a set of intensity values used to define
adjacency and connectivity.
• In a binary image, V = {1}, if we are referring to
adjacency of pixels with value 1.
• In a gray-scale image, the idea is the same, but
V typically contains more elements, for
example, V = {180, 181, 182, …, 200}
• If the possible intensity values 0 – 255, V set can
be any subset of these 256 values.
Types of Adjacency
1. 4-adjacency: Two pixels p and q with values from
V are 4-adjacent if q is in the set N4(p).
2. 8-adjacency: Two pixels p and q with values from
V are 8-adjacent if q is in the set N8(p).
3. m-adjacency =(mixed)
Basic Relationships Between Pixels
Weeks 1 & 2 17
Basic Relationships Between
Pixels
• Adjacency
Let V be the set of intensity values
(ii) q is in the set ND(p) and the set N4(p) ∩ N4(p) has no pixels whose values
are from V.
Weeks 1 & 2 18
Basic Relationships Between
Pixels
• Path
A (digital) path (or curve) from pixel p with coordinates (x0, y0) to pixel q with
coordinates (xn, yn) is a sequence of distinct pixels with coordinates
We can define 4-, 8-, and m-paths based on the type of adjacency used.
Weeks 1 & 2 19
Adjacency,
Connectivity
Adjacency: Two pixels are adjacent if they are
neighbors and
their intensity level ‘V’ satisfy some specific criteria of
similarity.
e.g. V = {1}
V = { 0, 2}
Binary image = { 0, 1}
Gray scale image = { 0, 1, 2, ------, 255}
e.g. V = { 0,
1}
1 1 0
1 1 0
1 0 1
p in RED color
q can be any value in
GREEN color.
Adjacency,
Connectivity
8-adjacency: Two pixels p and q with the values
from set ‘V’ are 8-
adjacent if q is in the set of N8(p).
e.g. V = { 1,
2}
0 1 1
0 2 0
0 0 1
p in RED color
q can be any value in
GREEN color
Adjacency,
Connectivity
m-adjacency: Two pixels p and q with the values
from set ‘V’ are
m-adjacent if
(i) q is in N4(p)OR
(ii q is in ND(p) & the set N4(p) n N4(q) have
) no pixels whose values are from ‘V’.
e.g. V = { 1 }
0 a 1b1c
0 d 1e0f
0 g 0h1i
Adjacency,
Connectivity
m-adjacency: Two pixels p and q with the values
from set ‘V’ are
m-adjacent if
(i) q is in N4(p)
e.g. V = { 1 }
(i) b &
c
0 a 1 b 1
c
0 d 1 e 1f
0 g 0 h 1I
Adjacency,
Connectivity
m-adjacency: Two pixels p and q with the values
from set ‘V’ are
m-adjacent if
(i) q is in N4(p)
e.g. V = { 1 }
(i) b &
c
0 a 1 b 1
c
0 d 1 e 1f
0 g 0 h 1I
no pixels whose
values are from ‘V’.
e.g. V = { 1 } 0a 1b 1c
0
(iii) e & i
d 1e0f
0 g 0h1I
Adjacency,
Connectivity
m-adjacency: Two pixels p and q with the values
from set ‘V’ are
m-adjacent if
(i) q is in ND(p) & the set N4(p) n N4(q) have
no pixels whose
values are from ‘V’.
e.g. V = { 1 } 0a 1b 1c
0
(iii) e & i
d 1e0f
0 g 0h1I
4 2 3 2
q
3 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-4
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-4
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-4
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-4
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-4
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-4
path:
V = {1, 2}.
4 2 3
2q
3 3 1
3
So, Path does not
2 3 2
exist. 2
p2 1 2 3
Paths
Example #
1:
Shortest-8
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-8
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-8
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-8
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-8
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-8
path:
V = {1, 2}.
4 2 3
2q
3 3 1
3
So, shortest-8
2 3 2
path = 4 2
p2 1 2 3
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3 2
3
q 3 1 3
2 3 2 2
p 1 2 3
2
Paths
Example #
1:
Shortest-m
path:
V = {1, 2}.
4 2 3
2q
3 3 1
3
2 3 2
So, shortest-m
path = 5
2
p2 1 2 3
Regions &
Boundaries
Region: Let R be a subset of pixels in an image. Two
regions Ri and Rj are
said to be adjacent if their union form a connected set.
De( p, q) = [( x- s)2 + (y
- t)2]1/2
Distance
Measures
City Block Distance: The D4 distance between p & q
is defined as
D4( p, q) = |x - s| + |y - t|
D8( p, q) = max( |x - s| , |y - t| )