ECE 178: Introduction (contd.) Light and the EM Spectrum

ECE 178: Introduction (contd.)
Lecture Notes #2: more basics
Section 2.4 –sampling and quantization
 Section 2.5 –relationship between pixels, connectivity analysis
Ack: Figures are mostly from Gonzalez & Woods

Introduction (contd.)
1
Light and the EM Spectrum
Introduction (contd.)
2
1
Digial Image Acquisition
Introduction (contd.)
3
Sampling and Quantization
Introduction (contd.)
4
2
Sampling & Quantization (contd.)
Introduction (contd.)
5
Digital Image: Representation
Introduction (contd.)
6
3
Storage Requirement
Image Dimension: NxN; k bits per pixel.
Introduction (contd.)
7
Introduction (contd.)
8
Spatial Resolution
4
Re-sampling…
Introduction (contd.)
9
Quantization: Gray-scale resolution
Introduction (contd.)
10
5
…false contouring
Introduction (contd.)
11
Sampling and Aliasing
Introduction (contd.)
12
6
Relationship between pixels

Neighbors of a pixel
– 4-neighbors (N,S,W,E pixels) == N4(p). A pixel p at
coordinates (x,y) has four horizontal and four vertical
neighbors:
• (x+1,y), (x-1, y), (x,y+1), (x, y-1)
– You can add the four diagonal neighbors to give the 8neighbor set. Diagonal neighbors == ND(p).
– 8-neighbors: include diagonal pixels == N8(p).
Introduction (contd.)
13
Pixel Connectivity
Connectivity -> to trace contours, define object boundaries,
segmentation.
In order for two pixels to be connected, they must be
“neighbors” sharing a common property—satisfy some
similarity criterion. For example, in a binary image with
pixel values “0” and “1”, two neighboring pixels are said
to be connected if they have the same value.
Let V: Set of gray level values used to define
connectivity; e.g., V={1}.
Introduction (contd.)
14
7
Connectivity-contd.



4-adjacency: Two pixels p and q with values
in V are 4-adjacent if q is in the set N4(p).
8-adjacency: q is in the set N8(p).
m-adjacency: Modification of 8-A to eliminate
multiple connections.
– q is in N4(p) or
– q in ND(p) and N4(p) Ç N4(q) is empty.
Introduction (contd.)
15
Connected components



Let S represent a subset of pixels in an
image.
If p and q are in S, p is connected to q in S if
there is a path from p to q entirely in S.
Connected component: Set of pixels in S that
are connected; There can be more than one
such set within a given S.
Introduction (contd.)
16
8
4-connected components
t
r
p
p=0: no action;
p=1: check r and t.
– both r and t = 0; assign new label to p;
– only one of r and t is a 1. assign that label to p;
– both r and t are 1.
• same label => assign it to p;
• different label=> assign one of them to p and
establish equivalence between labels (they are
the same.)
Second pass over the image to merge equivalent labels.
Introduction (contd.)
17
Exercise
Develop a similar algorithm for 8connectivity.
Introduction (contd.)
18
9
Problems with 4- and 8-connectivity

Neither method is satisfactory.
– Why? A simple closed curve divides a plane into
two simply connected regions.
– However, neither 4-connectivity nor 8-connectivity
can achieve this for discrete labelled components.
– Give some examples..
Introduction (contd.)
19
Related questions

Can you “tile” a plane with a pentagon?
Introduction (contd.)
20
10
Distance Measures

What is a Distance Metric?
For pixels p,q, and z, with coordinates (x,y), (s,t),
and (u,v), respectively:
D( p, q ) ! 0 ( D( p, q ) = 0 iff p = q )
D( p, q ) = D(q, p)
D( p, z ) " D( p, q ) + D(q, z )
Introduction (contd.)
21
Distance Measures

Euclidean

City Block

Chessboard
De ( p, q ) = ( x ! s) 2 + ( y ! t ) 2
D4 ( p, q ) = x ! s + y ! t
D8 ( p, q ) = max( x ! s , y ! t )
2
2
2
2
2
1
1
1
2
1
0
1
2
1
1
1
2
2
2
2
2 2 2 2 2
Introduction (contd.)
22
11