Anda di halaman 1dari 39

Digital image processing Chapter 3.

Image sampling and quantization


IMAGE SAMPLING AND IMAGE QUANTIZATION

1. Introduction

2. Sampling in the two-dimensional space
Basics on image sampling
The concept of spatial frequencies
I mages of limited bandwidth
Two-dimensional sampling
I mage reconstruction from its samples
The Nyquist rate. The alias effect and spectral replicas superposition
The sampling theorem in the two-dimensional case
Non-rectangular sampling grids and interlaced sampling
The optimal sampling
Practical limitations in sampling and reconstruction

3. Image quantization
4. The optimal quantizer
The uniform quantizer
5. Visual quantization
Contrast quantization
Pseudo-random noise quantization
Halftone image generation
Color image quantization























1. Introduction



f(x,y) f
s
(x,y) u(m,n)


u(m,n)
Sampling Quantization Computer
Computer
D/A
conversion
Display
Digitization
Analog display




Fig 1 Image sampling and quantization / Analog image display

Digital image processing Chapter 3. Image sampling and quantization






















2. Sampling in the two-dimensional space

Basics on image sampling



Digital image processing Chapter 3. Image sampling and quantization
x
y
f(x,y)
The concept of spatial frequencies

- 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:



Digital image processing Chapter 3. Image sampling and quantization
1-D signal (time varying) 2-D signal (grey scale image)
Time coordinate t Space coordinates x,y
Instantaneous value: f(t) Brightness level, point-wise: f(x,y)
A 1-D signal that doesnt vary in time (is constant)
= has 0 A.C. component, and only a D.C.
component
A perfectly uniform image (it has the same
brightness in all spatial locations); the D.C.
component = the brightness in any point
The frequency content of a 1-D signal is
proportional to the speed of variation of its
instantaneous value in time:

max
~ max(df/dt)
The frequency content of an image (2-D signal) is
proportional to the speed of variation of its
instantaneous value in space:

max,x
~ max(df/dx);
max,y
~ max(df/dy)
=>
max,x
,
max,y
= spatial frequencies
Discrete 1-D signal: described by its samples => a
vector: u=[u(0) u(1) u(N-1)], N samples; the
position of the sample = the discrete time moment
Discrete image (2-D signal): described by its
samples, but in 2-D => a matrix: U[MN],
U={u(m,n)}, m=0,1,,M-1; n=0,1,,N-1.
The spectrum of the time varying signal = the real
part of the Fourier transform of the signal, F();
=2.
The spectrum of the image = real part of the
Fourier transform of the image = 2-D
generalization of 1-D Fourier transform, F(
x
,
y
)

x
=2
x
;
y
=2
y
I mages of limited bandwidth

Limited bandwidth image =2-D signal with finite spectral support:

F(
x
,
y
) = the Fourier transform of the image:
















The Fourier transform of the The spectral support region
limited spectrum image
|F(
x,

y
)|
-
x0

x0

x0

y0

-
y0

-
y0

x

The spectrum of a limited bandwidth image and its spectral support
Digital image processing Chapter 3. Image sampling and quantization
( ) ( ) ( )
( )
. , , ,
2
} }
=
} }
=




dxdy e y x f dxdy e e y x f F
y x j y j
x j
y x
y x y
x
v v t e
e
v v
0 0
| | , | | , 0 ) , (
y y x x y x
F v v v v v v > > =
Two-dimensional sampling (1)








A A A A = =

=

=
A A
m n
y x s
y n y x m x y n x m f y x g y x f y x f ) , ( ) , ( ) , ( ) , ( ) , (
) , (
o
Digital image processing Chapter 3. Image sampling and quantization
The common sampling grid = the uniformly spaced, rectangular grid:












y
x
Ay
Ax

A A =

=

=
A A
m n
y x
y n y x m x y x g ) , ( ) , (
) , (
o
Image sampling = read from the original, spatially continuous, brightness function f(x,y), only in the black
dots positions ( only where the grid allows):

. ,
,
, 0
, ), , (
) , (
Z e

A = A =
=
n m
otherwise
y n y x m x y x f
y x f
s
Question: How to choose the values x, y to achieve:
-the representation of the digital image by the min. number of samples,
-at (ideally) no loss of information?
(I. e.: for a perfectly uniform image, only 1 sample is enough to completely represent the image =>
sampling can be done with very large steps; on the opposite if the brightness varies very sharply => very
many samples needed)
The sampling intervals x, y needed to have no loss of information depend on the spatial frequency
content of the image.
Sampling conditions for no information loss derived by examining the spectrum of the image by
performing the Fourier analysis:





The sampling grid function g
(x, y)
is periodical with period (x, y) => can be expressed by its Fourier
series expansion:


Two-dimensional sampling (2)








} }

}
=
}
=
=




A A




A A
. ) , ( ) , ( ) , ( ) , (
: ansform Fourier tr ) , ( ) , ( ) , (
2
2
) , (
2
2
) , (
dxdy e e y x g y x f dxdy e e y x f F
y x g y x f y x f
y
y
j
x
x
j
y x
y
y
j
x
x
j
S y x S
y x s
v t
v t
v t
v t
v v
Digital image processing Chapter 3. Image sampling and quantization
} }

A

A
=
=
A A
A

A

A A

A A
x y y
y
l
j
x
x
k
j
y x
k l
y
y
l
j
x
x
k
j
y x
dxdy e e y x g
y x
l k a
e e l k a y x g
0 0
2
2
) , (
2
2
) , (
. ) , (
1 1
) , (
: where
, ) , ( ) , (
t
t
t
t
Since:





Therefore the Fourier transform of f
S
is:













The spectrum of the sampled image =the collection of an infinite number of scaled spectral replicas
of the spectrum of the original image, centered at multiples of spatial frequencies 1/x, 1/ y.


Two-dimensional sampling (3)








. ,
1
) , (
) , (
1
) , (
) , (
1
) , (
1
) , ( ) , (
2
2
2
2
2
2
2
2

|
|
.
|

\
|
A

A

A A
=

} }

A A
=
} }
|
|
|
|
.
|

\
|

A A
= =>
} }

|
|
|
.
|

\
|

A A
=


|
|
.
|

\
|
A

|
.
|

\
|
A


|
|
.
|

\
|
A

|
.
|

\
|
A



A

A

=
k l
y x y x S
k l
y
l
y
y j
x
k
x
x j
y x S
y
l
y
y j
x
k
x
x j
k l
y x S
y
y
j
x
x
j y
y l
j
x
x k
j
k l
y x S
y
l
x
k
F
y x
F
dxdy e e y x f
y x
F
dxdy e e y x f
y x
F
dxdy e e e e
y x
y x f F
v v v v
v v
v v
v v
v t
v t
v t
v t
v t
v t
t
t
Digital image processing Chapter 3. Image sampling and quantization
( ). ; , ,
1 1
) , (
,
, 0
0 , 1
) , ( ), ; 0 [ ) ; 0 [ ) , ( for
) , (
e
A

A
=

= =
= A A e
A A
l k
y x
l k a
otherwise
y x if
y x g y x y x
y x


Digital image processing Chapter 3. Image sampling and quantization
Original image
Original image spectrum 3D Original image spectrum 2D
2-D rectangular sampling grid
Sampled image spectrum 3D Sampled image spectrum 2D
















Fig.4 The sampled image spectrum
v
xs

v
xs
-v
x0

2v
x0

v
x0

1/Ay
1/Ax
2v
y0

v
y0

v
ys
-v
y0

v
xs

9
3

c9
9
1

9
2

v
ys

v
x

v
y


I mage reconstruction from its samples



0 0
2 , 2
y ys x xs
v v v v > >
0 0
2
1
,
2
1
y x
y x
v v
< A < A

9 e
=
otherwise , 0
) , ( ,
) (
1
) , (
y x
ys xs y x
H
v v
v v v v
( ) ( ) ( )
( ) ( ) ( )

=
=
- =
v v = v v v v = v v
m n
y n y x m x h y n x m
s
f y x f
y x
s
f y x h y x f
y x
F
y x s
F
y x
H
y x
F
A A A A , , ,
~
, , ,
~
) , ( ) , ( ) , ( ) , (
~
Digital image processing Chapter 3. Image sampling and quantization

Let us assume that the filtering region R is rectangular, at the middle distance between two spectral
replicas:


( )
( )
( )
ys
y
ys
y
xs
x
xs
x
y x h
ys
y
xs
x
ys xs
y x
H
v t
v t

v t
v t
=

v
< v
v
< v
v v
= v v
sin
sin
,
otherwise , 0
2
and
2
,
) (
1
) , (
( ) ( ) ( ) ( )
( ) ( )
( )
( ) ( )
( ) n
ys
y
n
ys
y
m
xs
x
m
xs
x
m n
y n x m
s
f
m n
y n y x m x h y n x m
s
f y x f
v t
v t

v t
v t

=
=

=
=

sin
sin
, , , ,
~
A A A A A A







Digital image processing Chapter 3. Image sampling and quantization

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).


( ) ( ) ( ) ( ) ( )
a
a
a n
ys
y m
xs
x
m n
y n x m
s
f y x f
t
t
= v v

=
=

sin
sinc where , sinc sinc , ,
~
A A
1-D sinc function
2-D sinc function

The Nyquist rate. The aliasing. The fold-over frequencies













Note: Aliasing may also appear in the reconstruction process,
due to the imperfections of the filter!
How to avoid aliasing if cannot increase the sampling frequencies?
By a LPF on the image applied prior to sampling!
0 0
2 , 2
y ys x xs
v v v v < <












Fig. 5 Aliasing fold-over frequencies
0
v
y0

v
y

2v
x0

v
x

2v
y0

v
x0
0

Digital image processing Chapter 3. Image sampling and quantization
The Moire effect
Jagged boundaries
Non-rectangular sampling grids. Interlaced sampling grids


a) Image spectrum
1 2 /
F(
x
,
y
)=1

y

1/2
1/2
-1/2
-1/2












b) Rectangular grid G
1

n
m
-1
3 2
1
0 A
1

A
1













c) Interlaced grid G
2

n
2
1
A
2

A
2

1
-1 -2 2 0
m

d) The spectrum using G
1

x
x x
x
1
-1
1 0

1


e) The spectrum using G
2

2


Interlaced sampling


Digital image processing Chapter 3. Image sampling and quantization
f x y a
m n m n
m n
( , )
, ,
,
=
=


u
0
Optimal sampling = Karhunen-Loeve expansion:






Image reconstruction from its samples in the real case



















The question is: what to fill in the interpolated (new) dots?
Several interpolation methods are available; ideally sinc function in the spatial domain; in
practice simpler interpolation methods (i.e. approximations of LPFs).

Digital image processing Chapter 3. Image sampling and quantization






The 1-D
interpolation
function
Graphical
representation

p(x)
The 2-D
interpolation
function
p
a
(x,y)=p(x)p(y)
Frequency
response
p
a
(
1
,
2
)

p
a
(
1
,0)

Rectangular
(zero-order
filter)
p
0
(x)

0
x
1/Ax
Ax/2 -Ax/2



1
A A x
rect
x
x
|
\

|
.
|



p x p y
0 0
( ) ( )

sinc sinc

1
0
2
0
2 2
x y
|
\

|
.
|
|
\

|
.
|
|


4x0
0
1
x


Triangular
(first order
filter)
p
1
(x)

Ax -Ax
0
x
1/Ax


1
A A x
tri
x
x
|
\

|
.
|

p x p x
0 0
( ) ( )



p x p y
1 1
( ) ( )

sinc sinc

1
0
2
0
2
2 2
x y
|
\

|
.
|
|
\

|
.
|
|

(
(

4
x0
0
1
x


n-order filter
n=2, quadratic
n=3, cubic spline
p
n
(x)

0
x



p x p x
n
0 0
( ) ( )
convolu@ii



p x p y
n n
( ) ( )

sinc sinc

1
0
2
0
1
2 2
x y
n
|
\

|
.
|
|
\

|
.
|
|

(
(
+

4
x0
0
1
x



Gaussian
p
g
(x)
2o
0
x


1
2
2
2
2
2
to
o
exp

(
x


1
2 2
2
2 2
2
to o
exp
( )

(
x y



| | exp ( ) + 2
2 2
1
2
2
2
t o
0
1
x




Sinc

2Ax
0
x



1
A A x
x
x
sinc
|
\

|
.
|



1
A A A A x y
x
x
y
y
sinc sinc
|
\

|
.
|
|
\

|
.
|



rect rect
x y

1
0
2
0
2 2
|
\

|
.
|
|
\

|
.
|
|

1
2x0
0

Image interpolation filters:


Digital image processing Chapter 3. Image sampling and quantization





Image interpolation examples:


1. Rectangular (zero-order) filter, or nearest neighbour filter, or box filter:


Digital image processing Chapter 3. Image sampling and quantization
0
x
1/Ax
Ax/2
-Ax/2
Original Sampled Reconstructed





Image interpolation examples:


2. Triangular (first-order) filter, or bilinear filter, or tent filter:


Digital image processing Chapter 3. Image sampling and quantization
Original Sampled Reconstructed
Ax -Ax
0
x
1/Ax





Image interpolation examples:


3. Cubic interpolation filter, or bicubic filter begins to better approximate the sinc function:


Digital image processing Chapter 3. Image sampling and quantization
Original Sampled Reconstructed

2Ax
0
x


Practical limitations in image sampling and reconstruction








Fig. 7 The block diagram of a real sampler & reconstruction (display) system



Analog display
p
a
(-x,-y)

Ideal sampler
Ax,Ay

Scanning
system
aperture
p
s
(-x,-y)
Input
image
Real scanner model
g
~
(x,y)
g
s
(x,y) g(x,y)

Fig. 8 The real effect of the interpolation


Interpolation filter or
display system spectrum

1

xs
/2 -
xs
/2
P
a
(
1
,0)

0

Spectral losses
Interpolation error
Input image spectrum
Sampled
image
spectrum
Reconstructed
image spectrum
-

0

-
xs
/2
xs
/2
Digital image processing Chapter 3. Image sampling and quantization
3. I mage quantization






























Fig. 9 The quantizers transfer function



Quantizer
t
1

Quantizers
output
u u
t
k

t
L+1

t
2

r
L

r
k

r
2

r
1

Quantization
error
t
k+1

Digital image processing Chapter 3. Image sampling and quantization
3.1. Overview








3.2. The uniform quantizer
The quantizers design:
Denote the input brightness range:
Let B the number of bits of the quantizer => L=2
B
reconstruction levels
The expressions of the decision levels:




The expressions of the reconstruction levels:


Computation of the quantization error: for a given image of size MN pixels,
U non-quantized, and U quantized => we estimate the MSE:

2 2
1
q
k
t
k
r
k
t
k
t
k
r + =
+
+
=
t t t t q
k k k k
= = =
+ 1 1
constant
L
min
l
Max
L
q q
k
t
k
t
L
t
L
t
q

= +

+
=
1
,
1 1
Digital image processing Chapter 3. Image sampling and quantization
Max
L
L
t l t =
+
=
1
;
min 1
| |
Max
L
min
l u ; e
E.g. B=2 => L=4
t1=0 t2=64 t3=128 t4=192 t5=256
r1=32
r2=96
r3=160
r4=224
Uniform quantizer transfer function
Decision levels
R
e
c
o
n
s
t
r
u
c
t
i
o
n

l
e
v
e
l
s
( ) ( ) ( )

}

=
=

=
= c
+ L
k
t
t
du u
U lin
h
k
r u
M
m
N
n
n m u n m u
MN
k
k
1
) (
,
2
) (
1
0
1
0
2
, ' ,
1
1
Examples of uniform quantization and the resulting errors:
Digital image processing Chapter 3. Image sampling and quantization
B=1 => L=2
t1=0 t2=128 t3=256
r1=64
r2=192
Uniform quantizer transfer function
Decision levels
R
e
c
o
n
s
t
r
u
c
t
i
o
n

l
e
v
e
l
s
Non-quantized image Quantized image
Quantization error; MSE=36.2
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
The histogram of the non-quantized image
Examples of uniform quantization and the resulting errors:
Digital image processing Chapter 3. Image sampling and quantization
B=2 => L=4
Non-quantized image Quantized image
Quantization error; MSE=15
The histogram of the non-quantized image
t1=0 t2=64 t3=128 t4=192 t5=256
r1=32
r2=96
r3=160
r4=224
Uniform quantizer transfer function
Decision levels
R
e
c
o
n
s
t
r
u
c
t
i
o
n

l
e
v
e
l
s
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
Examples of uniform quantization and the resulting errors:
Digital image processing Chapter 3. Image sampling and quantization
B=3 => L=8; false contours present
Non-quantized image Quantized image
Quantization error; MSE=7.33
The histogram of the non-quantized image
t1=0 t2=32 t3=64 t4=96 t5=128 t6=160 t7=192 t8=224 t9=256
r1=16
r2=48
r3=80
r4=112
r5=144
r6=176
r7=208
r8=240
Uniform quantizer transfer function
Decision levels
R
e
c
o
n
s
t
r
u
c
t
i
o
n

l
e
v
e
l
s
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
3.2. The optimal (MSE) quantizer (the Lloyd-Max quantizer)



}
+
= =
1 L
1
t
t
u
2 2
(u)du h ) u' (u ] ) u' E[(u e

}
=
+
=
L
i
t
t
u i
i
i
du u h r u
1
2
1
) ( ) ( c

( )
L k du u h r u
r
t h r t r t
t
k
k
t
t
u k
k
k u k k k k
k
s s = =
= =
}
+

1 0 ) ( ) ( 2
0 ) ( ) ( ) (
1
2 2
1
c
cc
c
cc
t
r r
k
k k
=
+
1
2
| |
k
t
t
u
t
t
u
k
u | u E
(u)du h
(u)du uh
r
1 k
k
1 k
k
0 e = =
}
}
+
+
p u p t t t t t u t
u u j j j j j j
( ) (

),

( ), ~ = + s <
+ +
1
2
1 1
Digital image processing Chapter 3. Image sampling and quantization
1
3 / 1
3 / 1
1
1
1
1
1
)] ( [
)] ( [
t
du u h
du u h A
t
L
k
t
t
u
t z
t
u
k
+ ~
}
}
+

+
t
j+1
p
u
(u)
u
t
2 t
L+1
t
j
t
1
(Gaussian) , or (Laplacian)


( variance , - mean)

|
|
.
|

\
|

=
2
2
2
2
) (
exp
2
1
) (
o

to
u
u h
u
( ) o
o
= u u h
u
exp
2
) (
o
o
2
2
=
3
3 / 1
2
1
1
)] ( [
12
1

=
}
+ L
t
t
u
du u h
L
c
Digital image processing Chapter 3. Image sampling and quantization
Examples of optimal quantization and the quantization error:
B=1 => L=2
Non-quantized image Quantized image
The quantization error;
MSE=19.5
The non-quantized image histogram
t1=0 t2=89 t3=256
r1=24
r2=153
Functia de transfer a cuantizorului optimal
Nivelele de decizie
N
i
v
e
l
e
l
e

d
e

r
e
c
o
n
s
t
r
u
c
t
i
e
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
The evolution of MSE
in the optimization, starting
from the uniform quantizer
1 2 3 4 5 6 7 8
18
20
22
24
26
28
30
32
34
36
38
Digital image processing Chapter 3. Image sampling and quantization
B=2 => L=4
The quantization error;
MSE=9.6
t1=0 t2=68 t3=136 t4=169 t5=256
r1=20
r2=115
r3=156
r4=181
Functia de transfer a cuantizorului optimal
Nivelele de decizie
N
i
v
e
l
e
l
e

d
e

r
e
c
o
n
s
t
r
u
c
t
i
e
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
1 2 3 4 5 6 7 8 9 10
9
10
11
12
13
14
15
Examples of optimal quantization and the quantization error:
Non-quantized image Quantized image
The non-quantized image histogram
The evolution of MSE
in the optimization, starting
from the uniform quantizer
Digital image processing Chapter 3. Image sampling and quantization
B=3 => L=8
The quantization error;
MSE=5
t1=0 t2=34 t3=78 t4=113 t5=136 t6=156t7=173 t8=203 t9=256
r1=14
r2=54
r3=101
r4=125
r5=147
r6=165
r7=181
r8=224
Functia de transfer a cuantizorului optimal
Nivelele de decizie
N
i
v
e
l
e
l
e

d
e

r
e
c
o
n
s
t
r
u
c
t
i
e
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
0 2 4 6 8 10 12 14
4.5
5
5.5
6
6.5
7
7.5
Digital image processing Chapter 3. Image sampling and quantization
Examples of optimal quantization and the quantization error:
Non-quantized image Quantized image
The non-quantized image histogram
The evolution of MSE
in the optimization, starting
from the uniform quantizer
3.3. The uniform quantizer = the optimal quantizer for the uniform grey level
distribution:

s s
=
+
+
otherwise
t u t
t t u h
L
L u
0
,
1
) (
1 1
1 1
r
t t
t t
t t
k
k k
k k
k k
=

=
+
+
+
+
( )
( )
1
2 2
1
1
2 2
t
t t
k
k k
=
+
+ 1 1
2
t t t t q
k k k k
= = =
+ 1 1
constant
q
t t
L
t t q r t
q
L
k k k k
=

= + = +
+

1 1
1
2
, ,
c = =

}
1
12
2
2
2
2
q
u du
q
q
q
/
/
dB B 6 2 10log SNR , 2
2B
10
2B
2
u
therefore = = =

o
c
Digital image processing Chapter 3. Image sampling and quantization
3.4. Visual quantization methods


In general if B<6 (uniform quantization) or B<5 (optimal quantization) => the "contouring"
effect (i.e. false contours) appears in the quantized image.
The false contours (contouring) = groups of neighbor pixels quantized to the same value <=>
regions of constant gray levels; the boundaries of these regions are the false contours.
The false contours do not contribute significantly to the MSE, but are very disturbing for the
human eye => it is important to reduce the visibility of the quantization error, not only the MSQE.
Solutions: visual quantization schemes, to hold quantization error below the level of visibility.
Two main schemes: (a) contrast quantization; (b) pseudo-random noise quantization

Digital image processing Chapter 3. Image sampling and quantization
Uniform quantization, B=4
Uniform quantization, B=6 Optimal quantization, B=4
3.4. Visual quantization methods


a. Contrast quantization

The visual perception of the luminance is non-linear, but the visual perception of contrast is linear
uniform quantization of the contrast is better than uniform quantization of the brightness
contrast = ratio between the lightest and the darkest brightness in the spatial region
just noticeable changes in contrast: 2% => 50 quantization levels needed 6 bits needed with a
uniform quantizer (or 4-5 bits needed with an optimal quantizer)





















f
-1
(-)
contrast -
brightness
u c
u
c
Brightness
f(-)
brightness-
contrast

MMSE
quantizer
3 / 1 ; 1 typ. ;
or
) 1 ln( / , 18 ... 6 typ. ; 1 0 ), 1 ln(
= | = o
|
o =
| + | = o = o s s | + o =
u c
u u c
Digital image processing Chapter 3. Image sampling and quantization
Examples of contrast quantization:

For c=u
1/3
:




















Digital image processing Chapter 3. Image sampling and quantization
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
t1=0 t2=3.9844 t3=31.875 t4=107.5781 t5=255
0
50
100
150
200
250
The transfer function of the contrast quantizer
Decision levels
R
e
c
o
n
s
t r u
c
t i o
n
l e
v
e
l s
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000
Examples of contrast quantization:

For the log transform:




















Digital image processing Chapter 3. Image sampling and quantization
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
t1=0 t2=46.0273 t3=102.2733 t4=171.0068 t5=255
0
50
100
150
200
250
The transfer function of the contrast quantizer
Decision levels
R
e
c
o
n
s
t
r
u
c
t
i
o
n

l
e
v
e
l
s
0 50 100 150 200 250
0
100
200
300
400
500
600
700
800
900
1000

b. Pseudorandom noise quantization (dither)


K bits
quantizer

Uniformly distributed
pseudorandom noise,
[-A,A]
E E
-
+
+
+
u(m,n)
u(m,n) v(m,n) v(m,n)
q(m,n)
Digital image processing Chapter 3. Image sampling and quantization
Uniform quantization, B=4
Large dither amplitude
Small dither amplitude Prior to dither subtraction

Fig. 13
a. 3 bits quantizer =>visible false contours;
b. 8 bits image, with pseudo-random noise added in the range [-16,16];
c. the image from Figure b) quantized with a 3 bits quantizer
d. the result of subtracting the pseudo-random noise from the image in
Figure c)


a b
c d

Digital image processing Chapter 3. Image sampling and quantization
Halftone images generation











Fig.14 Digital generation of halftone images



Pseudorandom matrix
0sq(m,n)sA
0su(m,n)sA
Halftone
display
A
+
+
+
v(m,n)
Thresholding
v
v(m,n) Luminance
H
1
40 60 150 90 10
80 170 240 200 110
140 210 250 220 130
120 190 230 180 70
20 100 160 50 30
=

(
(
(
(
(
(

H
2
52 44 36 124 132 140 148 156
60 4 28 116 200 228 236 164
68 12 20 108 212 252 244 172
76 84 92 100 204 196 188 180
132 140 148 156 52 44 36 124
200 228 236 164 60 4 28 116
212 252 244 172 68 12 20 108
204 196 188 180 76 84 92 100
=

(
(
(
(
(
(
(
(
(
(
(
Fig.15 Halftone matrices

Digital image processing Chapter 3. Image sampling and quantization
Demo: http://markschulze.net/halftone/index.html





Fig.3.16
Digital image processing Chapter 3. Image sampling and quantization



Color images quantization



















Fig.17 Color images quantization




Quantizer


Quantizer

Quantizer




Color space
inverse
transformation




Color space
transformation
T
1

T
1

T
2
T
2

T
3

B
N

G
N

R
N

B
N

G
N

R
N

T
3

Digital image processing Chapter 3. Image sampling and quantization

Anda mungkin juga menyukai