UCSE715 - Slide 2
UCSE715 - Slide 2
► Neighborhood
► Adjacency
► Connectivity
► Paths
1
31-07-2024
► Adjacency
Let V be the set of intensity values
2
31-07-2024
► 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.
► 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.
3
31-07-2024
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
8-adjacent
4
31-07-2024
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
8-adjacent m-adjacent
0 1 1
1,1 1,2 1,3 0 1 1 0 1 1
0 2 0
2,1 2,2 2,3 0 2 0 0 2 0
0 0 1
3,1 3,2 3,3 0 0 1 0 0 1
8-adjacent m-adjacent
The 8-path from (1,3) to (3,3): The m-path from (1,3) to (3,3):
(i) (1,3), (1,2), (2,2), (3,3) (1,3), (1,2), (2,2), (3,3)
(ii) (1,3), (2,2), (3,3)
5
31-07-2024
► Connected in S
Let S represent a subset of pixels in an image. Two pixels
p with coordinates (x0, y0) and q with coordinates (xn, yn)
are said to be connected in S if there exists a path
Where i, 0 i n, ( xi , yi ) S
6
31-07-2024
7
31-07-2024
bwlabel(BW) returns the label matrix L that contains labels for the 8-connected objects found in BW.
BW = imread('text.png');
imshow(BW);
CC = bwconncomp(BW);
numPixels = cellfun(@numel,CC.PixelIdxList);
[biggest,idx] = max(numPixels);
BW(CC.PixelIdxList{idx}) = 0;
figure, imshow(BW);
8
31-07-2024
The boundary of the region R is the set of pixels in the region that
have one or more neighbors that are not in R.
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 of the image.
Question 1
1 1 1
Region 1
1 0 1
0 1 0
0 0 1 Region 2
1 1 1
1 1 1
9
31-07-2024
Question 2
1 1 1
Part 1
1 0 1
0 1 0
0 0 1 Part 2
1 1 1
1 1 1
1 1 1
Region 1
1 0 1
0 1 0
0 0 1 Region 2
1 1 1
1 1 1
10
31-07-2024
1 1 1
foreground
1 0 1
0 1 0
0 0 1 background
1 1 1
1 1 1
Question 3
0 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
11
31-07-2024
Question 4
0 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
Distance Measures
b. D(p, q) = D(q, p)
12
31-07-2024
Distance Measures
a. Euclidean Distance :
De(p, q) = [(x-s)2 + (y-t)2]1/2
Question 5
0 0 0 0 0
0 0 1 1 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
13
31-07-2024
Question 6
0 0 0 0 0
0 0 1 1 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
a a12 b b
A 11 B 11 12
a21 a22
b21 b22
Array
product
operator
a b a12b12 Array product
A .* B 11 11
a21b21 a22b22
Matrix
product
operator
a b a b a11b12 a12b22 Matrix product
A * B 11 11 12 21
a21b11 a22b21 a21b12 a22b22
14
31-07-2024
H f ( x, y ) g ( x, y )
H ai f i ( x, y ) a j f j ( x, y )
Additivity
H ai f i ( x, y ) H a j f j ( x, y )
ai H fi ( x, y ) a j H f j ( x, y ) Homogeneity
ai g i ( x, y ) a j g j ( x, y )
H is said to be a linear operator;
H is said to be a nonlinear operator if it does not meet the
above qualification.
Arithmetic Operations
15
31-07-2024
K
1
g ( x, y )
K
g ( x, y )
i 1
i
1 K
E g ( x, y ) E gi ( x, y )
2
2 K
K i 1 g ( x ,y ) 1
gi ( x , y )
K i 1
1 K
E f ( x, y ) ni ( x, y )
K i 1 1 2
2K n( x, y )
1 K
1
K
ni ( x , y )
f ( x, y ) E ni ( x, y ) K i 1
K i 1
f ( x, y )
16
31-07-2024
17
31-07-2024
18
31-07-2024
19
31-07-2024
A {( x, y, z ) | z f ( x, y )}
► The complement of A is denoted Ac
Ac {( x, y, K z ) | ( x, y, z ) A}
K 2k 1; k is the number of intensity bits used to represent z
A B {max(a, b) | a A, b B}
z
20
31-07-2024
21
31-07-2024
Spatial Operations
► Single-pixel operations
Alter the values of an image’s pixels based on the intensity.
s T ( z)
e.g.,
Spatial Operations
► Neighborhood operations
22
31-07-2024
Spatial Operations
► Neighborhood operations
( x, y ) T {(v, w)}
— intensity interpolation that assigns intensity values to the spatially
transformed pixels.
► Affine transform
t11 t12 0
x y 1 v w 1 t21 t22 0
t31 t32 1
23
31-07-2024
Image Registration
24
31-07-2024
Image Registration
x c1v c2 w c3vw c4
y c5v c6 w c7 vw c8
Image Registration
25
31-07-2024
Image Transform
Image Transform
M 1 N 1
f ( x, y ) T (u , v ) s( x, y, u , v)
u 0 v 0
26
31-07-2024
Image Transform
27
31-07-2024
28
31-07-2024
M 1 N 1
T (u , v) f ( x, y )e j 2 ( ux / M vy / N )
x 0 y 0
M 1 N 1
1
f ( x, y )
MN
T (u, v)e
u 0 v0
j 2 ( ux / M vy / N )
Probabilistic Methods
Let zi , i 0, 1, 2, ..., L -1, denote the values of all possible intensities
in an M N digital image. The probability, p( zk ), of intensity level
zk occurring in a given image is estimated as
nk
p ( zk ) ,
MN
where nk is the number of times that intensity zk occurs in the image.
L 1
p( z ) 1
k 0
k
29
31-07-2024
Probabilistic Methods
k 0
30