Upload
tranbao
View
229
Download
0
Embed Size (px)
Citation preview
Sampling and Quantization
Lecture #5January 21, 2002
Jan 21, 2003 Sampling 2
Sampling and Quantization
� Spatial Resolution (Sampling)� Determines the smallest perceivable image
detail.� What is the best sampling rate?
� Gray-level resolution (Quantization)� Smallest discernible change in the gray level
value.� Is there an optimal quantizer?
Jan 21, 2003 Sampling 3
Image sampling and quantization
In 1-D
f(x,y)
(Continuous image)
Samplerfs(m,n)
Quantizeru(m,n)
To Computer
Jan 21, 2003 Sampling 4
1-D1−D
x(t)
Time domain
X(u)
Frequency
Ts(t)
xs(t) = x(t) s(t) = Σ x(kt) δ (t-kT)
s(t)1/T
1/TXs(f)
Jan 21, 2003 Sampling 5
2-D: Comb function
ycomb(x,y;∆x,∆y)
x∆x
∆y
Comb( , ; , ) ( , )x y x y x m x y n ynm
∆ ∆ ∆ ∆≅ − −=−∞
∞
=−∞
∞
∑∑ δ
Jan 21, 2003 Sampling 6
Sampled Image
f x y f x y x y x y
f m x n y x m x y n y
x y x y u v
x yu v
x y
s
nm
( , ) ( , ) ( , ; , )
( , ) ( , )
( , ; , ) ( , )
, ; , )
=
= − −
← → ==−∞
∞
=−∞
∞
ℑ
∑∑
comb
comb COMB
comb(
∆ ∆
∆ ∆ ∆ ∆
∆ ∆
∆ ∆ ∆ ∆
δ
1 1 1
Jan 21, 2003 Sampling 7
Sampled Spectrum
F u v F u v u v
x yF u v u k
xv l
y
x yF u k
xv l
y
s
k l
k l
( , ) ( , ) ( , )
( , ) ,
,
,
,
= ∗
= ∗ − −FHG
IKJ
= − −FHG
IKJ
∑∑
∑∑
=−∞
∞
=−∞
∞
COMB
1
1
∆ ∆ ∆ ∆
∆ ∆ ∆ ∆
δ
Jan 21, 2003 Sampling 8
Sampled Spectrum: Example
Jan 21, 2003 Sampling 9
Bandlimited Images
A function f(x,y) is said to be band limited if the Fourier transform
F(u,v) = 0 for | u | > u0, | v | > v0
u0, v0 Band width of the image in the x- and y- directions
v0
u0region of support
Jan 21, 2003 Sampling 10
Foldover Frequencies
Sampling frequencies:Let us and vs be the sampling frequencies
Then us > 2u0 ; vs > 2v0
or ∆ x <1/2u0 ; ∆ y <1/2v0
Frequencies above half the sampling frequencies are called fold over frequencies.
Jan 21, 2003 Sampling 11
Sampling Theorem
A band limited image f(x,y) with F(u,v) as its Fourier transform; and F(u,v) = 0 |u| > u0 |v| > v0 ; and sampled uniformly on a rectangular grid with spacing ∆∆∆∆x and ∆∆∆∆y, can be recovered without error from the sample values f(m ∆∆∆∆x, n ∆∆∆∆y) provided the sampling rate is greater than the nyquist rate.
i.e 1/ ∆∆∆∆x = us > 2 u0, 1/ ∆∆∆∆y = vs > 2 v0
The reconstructed image is given by the interpolation formula:
f x y f m x n y xu mxu m
y v ny v nm n
s
s
s
s
( , ) ( , ) ( )( )
( )( ),
= −−
−−∑∑
=−∞
∞
∆ ∆ sin sinππ
ππ
Jan 21, 2003 Sampling 12
Reconstruction
0
R1
R2
δR
Jan 21, 2003 Sampling 13
Reconstruction via LPF
F(u,v) can be recovered by a LPF with
H u vx y u v R
R RR
R
F u v H u v F u v F u vf x y F u v
s
( , )( , )
~( , ) ( , ) ( , ) ( , )
( , ) [ ( , )]
=∈RST
= =
= ℑ −
∆ ∆0
1
2
1
Other wise is any region whose boundary is contained
within the annular ring between the rectangles and in the figure. Reconstructed signal is
∂
Jan 21, 2003 Sampling 14
Aliasing
Note: If us and vs are below the Nyquist rate, the periodicreplications will overlap, resulting in a distorted spectrum.
This overlapping of successive periods of the spectrumcauses the foldover frequencies in the original image toappear as frequencies below us/2, vs/2 in the sampled image. This is called aliasing.
Jan 21, 2003 Sampling 15
Jan 21, 2003 Sampling 16
Example
there will be aliasing.
f x y x yF u v u v u v
u v
x y u v u vs s
( , ) ( ( ))( , ) ( , ) ( , )
,
. ,.
= += - - + + +
fi = =
= = fi = = = <
2 2 3 43 4 3 4
3 4
0 2 10 2
5 2
0 0
0 0
cos
Let ,< 2
pd d
D D
Jan 21, 2003 Sampling 17
Example:(contd.)
F
Let
Otherwise
cos
s ( , ) ( , )
[ ( , ) ( , )]
( , ). . , . .
( , ) ( , ) ( , )( , ) ( , )
~( , ) (2 (2 ))
,
,
u v F u ku v lv
u k v l u k v l
H u vu u
F u v H u v F u vu v u v
f x y x y
s sk l
k l
s
= − −
= − − − − + + − + −
=− ≤ ≤ − ≤ ≤RST
∴ == + + + − −
∴ = +
∑∑
∑∑
=−∞
∞
=−∞
∞
25
25 3 5 4 5 3 5 4 5
2 5 2 5 2 5 2 50
2 1 2 1
2
125
δ δ
δ δπ
Jan 21, 2003 Sampling 18
Examples
Original and the reconstructed image from samples.
Jan 21, 2003 Sampling 19
Another example
Sampling filter
sampled image
Jan 21, 2003 Sampling 20
Aliasing Problems (real images!)