Img Mod1 Session5 PDF
Img Mod1 Session5 PDF
Module1
Dr.G.Malathi
Associate Professor Senior,
Imaging and Computer Vision Research Group Chair
School of Computing Science and Engineering
Vellore Institute of Technology, Chennai
1
Syllabus
Module1: Introduction, Digital Image, its
Representations 6 hours
Image Representation and image processing
Paradigm – Elements of digital image processing
– image model – Sampling and quantization –
relationships between pixels – connectivity,
distance measures between pixels – color
image(overview, various color models) – various
image formats –bmp, jpeg, tiff,pnd, gif, etc
2
3
Pixel Connectivity
• 4 connectivity
4
Pixel Connectivity
• 4 connectivity
5
Pixel Connectivity
• 8 connectivity
NW N NE
W C E
SW S SE
6
Pixel Relationship
7
Pixel Relationship
After digitization of pixels, the image can be represented
as a matrix.
Each point in a matrix is called as pixel.
1. Neighborhood
2. Connectivity
3. Adjacency
4. Distance Measures
8
Previous Col Current Col Next Col
Y-1 Y Y+1
Previous Row
(X-1, Y) X-1
Next Row
(X+1, Y) X+1
P X
10
We can find four other points in the diagonal direction
Previous Col Current Col Next Col
Y-1 Y Y+1
(x-1,y+1) Previous Row
(x-1,y-1)
X-1
11111
11111
13
If F(x,y) > Threshold
(x,y) ϵ Object
Else
(x,y) ϵ Background
11111 11111
11111 11111
000000000000
0 00000000000
14
WHAT IS CONNECTIVITY
Two pixels are said to be connected if they are adjacent
in some sense
They are neighbors N4(P) , N8(P) and ND(P)
Their intensity values (gray levels) are similar
q q
P P P q
15
CONNECTIVITY
Let V be the set of gray levels used to define connectivity for two
points (P)(q) ϵV,
Three types of connectivity are defined
N4(P) ∩ N4(q) -> set of pixels that are 4-neighbors of both P and q
and whose Values are from V.
16
Connectivity
Ex: V= { 1 }
0 1 1 0 1 1 0 1 1
0 1 0 0 1 0 0 1 0
0 1 0 1 0 1
P
q
Where
For 1 ≤ I ≤ n
N= length of the path
All the points traversed between p and q we say that they are
adjacent. 20
Connected Component
Let
S ⊆ I and p,q ϵ S
where S is a subset of Image I, and two points p,q which
also belongs to the subset S
21
A This is the entire image A.
Within this image I take a subimage say S.
Q
We have a point P
If there a number of such points to which a path exists from the point P in S, then the set
Of all these points are said to be connected to P and they form connected component of S
What can I do with this connected component?
I can identify a region in an image
22
Region
A subset R of pixels in an image is
called a Region of the image if R is a
connected set.
23
Boundary
The boundary of the region R is the
set of pixels in the region that have
neighbors that are not
in R.
24
Connected Component Labelling
25
Connected Component Labelling
26
How to find the group identification for the particular region
r
t p
27
Steps
l(p) = Pixel value at position p
L(p) = Label assigned to pixel location p.
If l(p)=0, move to next scanning position
If l(p)=1 and l(l)=l(t)=0 then
Assign a new label to position p
If l(p) = 1 and only one of the two neighbor is 1 then
Assign its label to p
If l(p) = 1 and both r and t are 1’s then
If L(r) = L(t) then L(p) = L(r)
If L(r) ≠ L(t) then assign one of the labels to p and make a note
that the two labels are equivalent
At the end of the scan all pixels with value 1 are labelled
29
(1,2) , (3,4) , (1,5)
30
Equivalent Class: (1,2) , (3,4) , (1,5)
32