0% found this document useful (0 votes)
13 views67 pages

4pixelrelationships 120321052747 Phpapp02

Uploaded by

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

4pixelrelationships 120321052747 Phpapp02

Uploaded by

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

Basic Relationships between

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).

 Each pixel is unit distance from ( x ,y).


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 3) I - - - neighbors.
diagonal
I I I I
 Their coordinates Iare given by:
(x+1, (x+1, y- (x-1, & (x-1, y-
y+1) 1) y+1) 1)
 This
f(2,2)
set of pixels isf(2,0) f(0,2)
called the diagonal-neighbors f(0,0)
of p
denoted by ND(p).

 diagonal neighbors + 4-neighbors = 8-neighbors


of p.
Basic Relationships Between Pixels

• Neighborhood

• Adjacency

• Connectivity

• Paths

• Regions and boundaries

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-1, y) P (x,y) (x+1, y)

(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)

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


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

and are denoted by ND (p).


These points, together with the 4-neighbors, are called the 8-neighbors of p, denoted by N8 (p).
(x-1, y+1) (x, y-1) (x+1, y-1)
(x-1, y) P (x,y) (x+1, y)
(x-1, y-1) (x, 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

• Neighbors of a pixel p at coordinates (x,y)

 4-neighbors of p, denoted by N4(p):


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

 4 diagonal neighbors of p, denoted by ND(p):


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

 8 neighbors of p, denoted N8(p)


N8(p) = N4(p) U ND(p)
Weeks 1 & 2 16
Basic Relationships Between
Pixels
• Adjacency
Let V be the set of intensity values

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).

Weeks 1 & 2 17
Basic Relationships Between
Pixels
• Adjacency
Let V be the set of intensity values

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.

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

(x0, y0), (x1, y1), …, (xn, yn)

Where (xi, yi) and (xi-1, yi-1) are adjacent for 1 ≤ i ≤ n.

 Here n is the length of the path.

 If (x0, y0) = (xn, yn), the path is closed path.

 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}

In binary images, 2 pixels are adjacent if they are


neighbors & have some intensity values either 0 or 1.

In gray scale, image contains more gray level values


in range 0 to
255.
Adjacency,
Connectivity
4-adjacency: Two pixels p and q with the values from
set ‘V’ are 4-
adjacent if q is in the set of N4(p).

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

Soln: b & c are m-


adjacent.
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 }
(ii) b
&e
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 }
(ii) b
&e
0 a 1 b 1
c
0 d 1 e 1f
0 g 0 h 1I

Soln: b & e are m-


adjacent.
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
e.g. V = { 1 }
(iii) e
&i
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 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
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

Soln: e & i are m-


adjacent.
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 }
(iv) e & c
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)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 }
(iv) e & c
0 a 1b1c
0 d 1e0f
0 g 0h1I
Soln: e & c are NOT m-
adjacent.
Adjacency,
Connectivity
Connectivity: 2 pixels are said to be connected if
their exists a path
between them.

Let ‘S’ represent subset of pixels in an image.

Two pixels p & q are said to be connected in ‘S’ if their


exists a path between them consisting entirely of
pixels in ‘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.
Paths
Paths: A path from pixel p with coordinate (
x, y) with pixel q with coordinate ( s, t) is a
sequence of distinct sequence with
coordinates (x0, y0), (x1, y1), ….., (xn, yn)
where

(x, y) = (x0, y0)


& (s, t) = (xn, yn)

Closed path: (x0, y0) = (xn, yn)


Paths
Example # 1: Consider the image segment shown in
figure. Compute length of the shortest-4, shortest-8 &
shortest-m paths between pixels p & q where,
V = {1, 2}.

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.

Regions that are not adjacent are said to be disjoint.

We consider 4- and 8- adjacency when referring to regions.

Below regions are adjacent only if 8-adjacency is used.


1 1 1
1 0 1 Ri
0 1 0
0 0 1
1 1 1 Rj
1 1 1
Regions &
Boundaries
Boundaries (border or contour): The boundary of
a region R is
the set of points that are adjacent to points in the
compliment of0R. 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0

RED colored 1 is NOT a member of border if 4-


connectivity is used between region and
background. It is if 8-connectivity is used.
Distance
Measures
Distance Measures: Distance between pixels p,
q & z with co-
ordinates ( x, y), ( s, t) & ( v, w) resp. is given by:
a) D( p, q) ≥ 0 [ D( p, q) = …………..called
0 if p = q] reflexivity
b) D( p, q) = D( q, p) .………….called
c) D( p, z) ≤ D( p, q) + symmetry
D( q, z) ..………….called
Euclidean distance between p & q is
transmitivity
defined as-

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|

In this case, pixels having D4 distance from ( x, y) less


than or equal to some value r form a diamond
centered at ( x, y).
2
2 1 2
2 1 0 1 2
2 1 2
2
Pixels with D4 distance ≤ 2 forms the following contour
Distance
Measures
Chess-Board Distance: The D8 distance between p
& q is
defined as

D8( p, q) = max( |x - s| , |y - t| )

In this case, pixels having D8 distance from ( x, y) less


than or equal 2 2 2 2 2
to some value r form a square centered at ( x, y).
2 1 1 1 2
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2
Pixels with D8 distance ≤ 2 forms the following contour
of constant distance.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy