Beruflich Dokumente
Kultur Dokumente
quantization
1.
Introduction
2.
- Grey scale images can be seen as a 2-D generalization of time-varying signals (both in the analog and
in the digital case); the following equivalence applies:
Time coordinate t
F x , y f x, y e
j x x j y y
dxdy f x, y e
j 2 x x y y
dxdy.
F ( x , y ) 0,| x | x 0 ,| y | y 0
Thespectrumofalimitedbandwidthimageanditsspectralsupport
g ( x, y ) ( x, y )
( x mx, y ny )
m n
Image sampling = read from the original, spatially continuous, brightness function f(x,y), only in the black
dots positions ( only where the grid allows):
f ( x, y ), x mx, y ny
,
0
,
otherwise
f s ( x, y )
m, n Z.
f s ( x, y ) f ( x, y ) g ( x, y ) ( x, y )
f (mx, ny ) ( x mx, y ny )
m n
FS ( x , y ) f S ( x, y ) e j 2 x x e
j 2 y y
dxdy f ( x, y ) g ( x, y ) ( x, y ) e j 2 x x e
j 2 y y
dxdy.
The sampling grid function g(x, y) is periodical with period (x, ly) => can be expressed by its Fourier
k
j 2 x j 2 y
series expansion:
y
x
g ( x, y ) ( x, y )
a(k , l ) e
k l
where :
k
j 2 x j 2 y
1 1 x y
y
x e
a(k , l )
g ( x, y ) ( x, y )e
dxdy.
x y 0 0
1, if x y 0
,
0
,
otherwise
1 1
, k , l ; .
x y
2 k x
2 l y
j
j
1
x
FS ( x , y ) f ( x, y )
e
e y
k l x y
j 2 x x
e
e
j 2 y y
l
k
j 2 y y
j 2 x x
1
y
x e
FS ( x , y )
f ( x, y ) e
x y k l
dxdy
l
k
j 2 y y
j 2 x x
1
y
x e
FS ( x , y )
f ( x, y ) e
dxdy
x y k l
1
k
l
FS ( x , y )
F x , y .
x y k l
x
y
dxdy
The spectrum of the sampled image = the collection of an infinite number of scaled spectral replicas
Original image
xs 2 x 0 , ys 2 y 0
H ( x , y )
1
1
,y
2 x 0
2 y 0
1
,( x , y )
( xs ys )
0,
otherwise
~
F ( x , y ) H ( x , y ) Fs ( x , y ) F ( x , y )
~
f x, y h x, y f s x, y
~
f x, y
f s mx, ny h x mx, y ny
m n
Let us assume that the filtering region R is rectangular, at the middle distance between two spectral
replicas:
ys
xs
1
sin x xs sin y ys
,
and
x
y
H ( x , y ) ( xs ys )
2
2 h x, y
y ys
xs
0,
otherwise
~
f x, y
sin x xs m sin y ys n
f
m
x
,
n
y
h
x
x
,
y
f
m
x
,
n
y ys n
xs
m n
m n
~
f x, y
m n
sin a
a
Since the sinc function has infinite extent => it is impossible to implement in practice the ideal LPF
it is impossible to reconstruct in practice an image from its samples without error if we sample it
at the Nyquist rates.
Practical solution: sample the image at higher spatial frequencies + implement a real LPF (as close to
the ideal as possible).
xs 2 x 0 , ys 2 y 0
Jagged boundaries
1/2
F(x, y)=1
1/ 2
x
1/2
-1/2
-1/2
a) Image spectrum
x
-1
Interlacedsampling
f ( x, y)
m ,n 0
m ,n
m ,n
quantization
-x/2
Original
x/2
Sampled
Reconstructed
quantization
-x
Original
Sampled
Reconstructed
quantization
3. Cubic interpolation filter, or bicubic filter begins to better approximate the sinc function:
2x
Original
Sampled
Reconstructed
Fig. 7 The block diagram of a real sampler & reconstruction (display) system
3. Image quantization
3.1. Overview
u lmin ; LMax
Let B the number of bits of the quantizer => L=2B reconstruction levels
E.g. B=2 => L=4
t1 l min ; t L 1 LMax
L
l
t
t
q L 1 1 ,t k t k 1 q q Max min
L
L
Reconstruction levels
t k t k 1 t k 1 t k constant q
r4=224
r3=160
r2=96
t t
q
rk k k 1 rk t k
2
2
t1=0
t2=64
t3=128
Decision levels
t4=192
t5=256
Non-quantized image
Quantized image
Reconstruction levels
r2=192
r1=64
t1=0
t2=128
Decision levels
t3=256
1000
900
800
700
600
500
400
300
200
100
0
0
50
100
150
200
250
Non-quantized image
Quantized image
Reconstruction levels
r4=224
r3=160
r2=96
r1=32
t1=0
t2=64
t3=128
Decision levels
t4=192
t5=256
1000
900
800
700
600
500
400
300
200
100
0
0
50
100
150
200
250
Non-quantized image
Quantized image
r8=240
Reconstruction levels
r7=208
r6=176
r5=144
r4=112
r3=80
r2=48
r1=16
t1=0
t2=32
t3=64
t7=192
t8=224
t9=256
1000
900
800
700
600
500
400
300
200
100
0
0
50
100
150
200
250
(tk rk 1 ) 2 (t k rk ) 2 hu (t k ) 0
t k
t k 1
2 (u rk )hu (u )du 0 1 k L
rk
t
k
t k 1
r r
t k k k 1
2
rk
uhu (u)du
tk
t k 1
E u | u k
hu (u)du
tk
pu (u) pu (tj ),
tj
z k t1
A
t k 1
1
(t j t j 1 ),
2
[hu (u )]
1 / 3
du
t1
t L 1
[hu (u )]
t1
1 / 3
t1
du
t j u t j 1
12 L2
t L1
t1
[hu (u )]
1/ 3
du
pu(u)
u
t1
t2
(u ) 2
hu (u )
exp
2
2
2
2
(Laplacian)
1
2
(
tj
tj+1
tL+1
h
(
u
)
exp u
u
(Gaussian)
,2 or
variance , - mean)
Non-quantized image
Nivelele de reconstructie
Quantized image
r2=153
r1=24
t1=0
t2=89
Nivelele de decizie
t3=256
1000
900
800
38
700
36
600
34
500
32
400
30
300
28
200
26
100
24
22
250
20
18
50
100
150
200
Non-quantized image
Nivelele de reconstructie
Quantized image
r4=181
r3=156
r2=115
r1=20
t1=0
t2=68
t3=136 t4=169
Nivelele de decizie
t5=256
1000
900
800
15
700
600
14
500
13
400
300
12
200
11
100
0
10
50
100
150
200
250
10
Nivelele de reconstructie
Non-quantized image
Quantized image
r8=224
r7=181
r6=165
r5=147
r4=125
r3=101
r2=54
r1=14
t1=0
t2=34
t3=78
t8=203
t9=256
1000
900
800
700
7.5
600
7
500
400
6.5
300
6
200
100
5.5
0
5
50
100
150
200
250
4.5
10
12
14
3.3. The uniform quantizer = the optimal quantizer for the uniform grey level
distribution:
1
, t1 u t L 1
hu (u ) t L 1 t1
0 otherwise
(t k21 t k2 ) t k 1 t k
rk
2(t k 1 t k )
2
t k 1 t k 1
t k t k 1 t k 1 t k constant q
2
t t
q
q L 1 1 ,
t k t k 1 q ,
rk t k
L
2
tk
q /2
1
q2
2
u du
q q/ 2
12
1
0.9
200
0.8
Reconstruction levels
0.7
0.6
0.5
150
100
0.4
0.3
50
0.2
0.1
0
0
t2=3.9844
t1=0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
t3=31.875
t4=107.5781
Decision levels
1000
900
800
700
600
500
400
300
200
100
0
0
50
100
150
200
250
t5=255
250
5
4.5
200
Reconstruction levels
4
3.5
3
2.5
2
150
100
1.5
50
1
0.5
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
1000
900
800
700
600
500
400
300
200
100
0
0.8
0.9
0
t1=0
t2=46.0273
t3=102.2733
t4=171.0068
Decision levels
t5=255
Fig.14Digitalgenerationofhalftoneimages
Demo: http://markschulze.net/halftone/index.html
Fig.15Halftonematrices
Fig.3.16
Fig.17Colorimagesquantization