Tải bản đầy đủ (.pdf) (18 trang)

Tài liệu Xử lý hình ảnh kỹ thuật số P6 pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (308.26 KB, 18 trang )

141
6

IMAGE QUANTIZATION
Any analog quantity that is to be processed by a digital computer or digital system
must be converted to an integer number proportional to its amplitude. The conver-
sion process between analog samples and discrete-valued samples is called quanti-
zation. The following section includes an analytic treatment of the quantization
process, which is applicable not only for images but for a wide class of signals
encountered in image processing systems. Section 6.2 considers the processing of
quantized variables. The last section discusses the subjective effects of quantizing
monochrome and color images.
6.1. SCALAR QUANTIZATION
Figure 6.1-1 illustrates a typical example of the quantization of a scalar signal. In the
quantization process, the amplitude of an analog signal sample is compared to a set
of decision levels. If the sample amplitude falls between two decision levels, it is
quantized to a fixed reconstruction level lying in the quantization band. In a digital
system, each quantized sample is assigned a binary code. An equal-length binary
code is indicated in the example.
For the development of quantitative scalar signal quantization techniques, let f
and represent the amplitude of a real, scalar signal sample and its quantized value,
respectively. It is assumed that f is a sample of a random process with known proba-
bility density . Furthermore, it is assumed that f is constrained to lie in the range
(6.1-1)
f
ˆ
p f()
a
L
fa
U


≤≤
Digital Image Processing: PIKS Inside, Third Edition. William K. Pratt
Copyright © 2001 John Wiley & Sons, Inc.
ISBNs: 0-471-37407-5 (Hardback); 0-471-22132-5 (Electronic)
142
IMAGE QUANTIZATION
where and represent upper and lower limits.
Quantization entails specification of a set of decision levels and a set of recon-
struction levels such that if
(6.1-2)
the sample is quantized to a reconstruction value . Figure 6.1-2a illustrates the
placement of decision and reconstruction levels along a line for J quantization lev-
els. The staircase representation of Figure 6.1-2b is another common form of
description.
Decision and reconstruction levels are chosen to minimize some desired quanti-
zation error measure between f and . The quantization error measure usually
employed is the mean-square error because this measure is tractable, and it usually
correlates reasonably well with subjective criteria. For J quantization levels, the
mean-square quantization error is
(6.1-3)
FIGURE 6.1-1. Sample quantization.
256
11111111
11111110
00100000
00000010
00000001
00000000
ORIGINAL
SAMPLE

DECISION
LEVELS
BINARY
CODE
QUANTIZED
SAMPLE
RECONSTRUCTION
LEVELS
00011111
00011110
255
254
33
32
31
30
3
2
1
0
a
U
a
L
d
j
r
j
d
j

fd
j 1
+
<≤
r
j
f
ˆ
E Ef
f
ˆ
–()
2
{} f
f
ˆ
–()
2
pf() fdfr
j
–()
2
pf()fd
j 0
=
J 1


=
a

L
a
U

==
SCALAR QUANTIZATION
143
For a large number of quantization levels J, the probability density may be repre-
sented as a constant value over each quantization band. Hence
(6.1-4)
which evaluates to
(6.1-5)
The optimum placing of the reconstruction level within the range to can
be determined by minimization of with respect to . Setting
(6.1-6)
yields
(6.1-7)
FIGURE 6.1-2. Quantization decision and reconstruction levels.
pr
j
()
E pr
j
() fr
j
–()
2
fd
d
j

d
j 1
+

j 0
=
J 1


=
E
1
3
--- pr
j
()d
j 1
+
r
j
–()
3
d
j
r
j
–()
3
–[]
j 0

=
J 1


=
r
j
d
j 1

d
j
E r
j
Ed
r
j
d
------ 0=
r
j
d
j 1
+
d
j
+
2
----------------------=
144

IMAGE QUANTIZATION
Therefore, the optimum placement of reconstruction levels is at the midpoint
between each pair of decision levels. Substitution for this choice of reconstruction
levels into the expression for the quantization error yields
(6.1-8)
The optimum choice for decision levels may be found by minimization of in Eq.
6.1-8 by the method of Lagrange multipliers. Following this procedure, Panter and
Dite (1) found that the decision levels may be computed to a good approximation
from the integral equation
(6.1-9a)
where
(6.1-9b)
for j = 0, 1,..., J. If the probability density of the sample is uniform, the decision lev-
els will be uniformly spaced. For nonuniform probability densities, the spacing of
decision levels is narrow in large-amplitude regions of the probability density func-
tion and widens in low-amplitude portions of the density. Equation 6.1-9 does not
reduce to closed form for most probability density functions commonly encountered
in image processing systems models, and hence the decision levels must be obtained
by numerical integration.
If the number of quantization levels is not large, the approximation of Eq. 6.1-4
becomes inaccurate, and exact solutions must be explored. From Eq. 6.1-3, setting
the partial derivatives of the error expression with respect to the decision and recon-
struction levels equal to zero yields
(6.1-10a)
(6.1-10b)
E
1
12
------ pr
j

()d
j 1
+
d
j
–()
3
j 0
=
J 1


=
E
d
j
a
U
a
L
–()pf()[]
13⁄

fd
a
L
a
j

pf()[]

13⁄

fd
a
L
a
U

----------------------------------------------------------------=
a
j
ja
U
a
L
–()
J
------------------------- a
L
+=
E∂
d
j

------- d
j
r
j
–()
2

pd
j
() d
j
r
j 1

–()
2
pd
j
()– 0==
E∂
r
j

------ 2 fr
j
–()pf()fd
d
j
d
j 1
+

0==
SCALAR QUANTIZATION
145
Upon simplification, the set of equations
(6.1-11a)

(6.1-11b)
is obtained. Recursive solution of these equations for a given probability distribution
provides optimum values for the decision and reconstruction levels. Max (2)
has developed a solution for optimum decision and reconstruction levels for a Gaus-
sian density and has computed tables of optimum levels as a function of the number
of quantization steps. Table 6.1-1 lists placements of decision and quantization lev-
els for uniform, Gaussian, Laplacian, and Rayleigh densities for the Max quantizer.
If the decision and reconstruction levels are selected to satisfy Eq. 6.1-11, it can
easily be shown that the mean-square quantization error becomes
(6.1-12)
In the special case of a uniform probability density, the minimum mean-square
quantization error becomes
(6.1-13)
Quantization errors for most other densities must be determined by computation.
It is possible to perform nonlinear quantization by a companding operation, as
shown in Figure 6.1-3, in which the sample is transformed nonlinearly, linear quanti-
zation is performed, and the inverse nonlinear transformation is taken (3). In the com-
panding system of quantization, the probability density of the transformed samples is
forced to be uniform. Thus, from Figure 6.1-3, the transformed sample value is
(6.1-14)
where the nonlinear transformation is chosen such that the probability density
of g is uniform. Thus,
FIGURE 6.1-3. Companding quantizer.
r
j
2d
j
r
j 1


–=
r
j
fp f()fd
d
j
d
j 1
+

pf()fd
d
j
d
j 1
+

-------------------------------=
pf()
E
min
f
2
pf() fdr
j
2
pf()fd
d
j
d

j 1
+


d
j
d
j 1
+

j 0
=
J 1


=
E
min
1
12J
2
------------=
gTf{}=
T
·
{}
146
IMAGE QUANTIZATION
TABLE 6.1-1. Placement of Decision and Reconstruction Levels for Max Quantizer
Uniform Gaussian Laplacian Rayleigh

Bits d
i
r
i
d
i
r
i
d
i
r
i
d
i
r
i
1 –1.0000 –0.5000 – –0.7979 – –0.7071 0.0000 1.2657
0.0000 0.5000 0.0000 0.7979 0.0000 0.7071 2.0985 2.9313
1.0000 –
2–1.0000 –0.7500 – –1.5104 –1.8340 0.0000 0.8079
–0.5000 –0.2500 –0.9816 –0.4528 –1.1269 –0.4198 1.2545 1.7010
–0.0000 0.2500 0.0000 0.4528 0.0000 0.4198 2.1667 2.6325
0.5000 0.7500 0.9816 1.5104 1.1269 1.8340 3.2465 3.8604
1.0000
3 –1.0000 –0.8750 – –2.1519 – –3.0867 0.0000 0.5016
–0.7500 –0.6250 –1.7479 –1.3439 –2.3796 –1.6725 0.7619 1.0222
–0.5000 –0.3750 –1.0500 –0.7560 –1.2527 –0.8330 1.2594 1.4966
–0.2500 –0.1250 –0.5005 –0.2451 –0.5332 –0.2334 1.7327 1.9688
0.0000 0.1250 0.0000 0.2451 0.0000 0.2334 2.2182 2.4675
0.2500 0.3750 0.5005 0.7560 0.5332 0.8330 2.7476 3.0277

0.5000 0.6250 1.0500 1.3439 1.2527 1.6725 3.3707 3.7137
0.7500 0.8750 1.7479 2.1519 2.3796 3.0867 4.2124 4.7111
1.0000
4 –1.0000 –0.9375 – –2.7326 – –4.4311 0.0000 0.3057
–0.8750 –0.8125 –2.4008 –2.0690 –3.7240 –3.0169 0.4606 0.6156
–0.7500 –0.6875 –1.8435 –1.6180 –2.5971 –2.1773 0.7509 0.8863
–0.6250 –0.5625 –1.4371 –1.2562 –1.8776 –1.5778 1.0130 1.1397
–0.5000 –0.4375 –1.0993 –0.9423 –1.3444 –1.1110 1.2624 1.3850
–0.3750 –0.3125 –0.7995 –0.6568 –0.9198 –0.7287 1.5064 1.6277
–0.2500 –0.1875 –0.5224 –0.3880 –0.5667 –0.4048 1.7499 1.8721
–0.1250 –0.0625 –0.2582 –0.1284 –0.2664 –0.1240 1.9970 2.1220
0.0000 0.0625 0.0000 0.1284 0.0000 0.1240 2.2517 2.3814
0.1250 0.1875 0.2582 0.3880 0.2644 0.4048 2.5182 2.6550
0.2500 0.3125 0.5224 0.6568 0.5667 0.7287 2.8021 2.9492
0.3750 0.4375 0.7995 0.9423 0.9198 1.1110 3.1110 3.2729
0.5000 0.5625 1.0993 1.2562 1.3444 1.5778 3.4566 3.6403
0.6250 0.6875 1.4371 1.6180 1.8776 2.1773 3.8588 4.0772
0.7500 0.8125 1.8435 2.0690 2.5971 3.0169 4.3579 4.6385
0.8750 0.9375 2.4008 2.7326 3.7240 4.4311 5.0649 5.4913
1.0000
∞∞
∞∞∞
∞∞
∞∞∞
∞∞
∞∞∞
∞∞
∞∞∞
PROCESSING QUANTIZED VARIABLES
147

(6.1-15)
for . If f is a zero mean random variable, the proper transformation func-
tion is (4)
(6.1-16)
That is, the nonlinear transformation function is equivalent to the cumulative proba-
bility distribution of f. Table 6.1-2 contains the companding transformations and
inverses for the Gaussian, Rayleigh, and Laplacian probability densities. It should
be noted that nonlinear quantization by the companding technique is an approxima-
tion to optimum quantization, as specified by the Max solution. The accuracy of the
approximation improves as the number of quantization levels increases.
6.2. PROCESSING QUANTIZED VARIABLES
Numbers within a digital computer that represent image variables, such as lumi-
nance or tristimulus values, normally are input as the integer codes corresponding to
the quantization reconstruction levels of the variables, as illustrated in Figure 6.1-1.
If the quantization is linear, the jth integer value is given by
(6.2-1)
where J is the maximum integer value, f is the unquantized pixel value over a
lower-to-upper range of to , and denotes the nearest integer value of the
argument. The corresponding reconstruction value is
(6.2-2)
Hence, is linearly proportional to j. If the computer processing operation is itself
linear, the integer code j can be numerically processed rather than the real number .
However, if nonlinear processing is to be performed, for example, taking the loga-
rithm of a pixel, it is necessary to process as a real variable rather than the integer j
because the operation is scale dependent. If the quantization is nonlinear, all process-
ing must be performed in the real variable domain.
In a digital computer, there are two major forms of numeric representation: real
and integer. Real numbers are stored in floating-point form, and typically have a
large dynamic range with fine precision. Integer numbers can be strictly positive or
bipolar (negative or positive). The two's complement number system is commonly

pg() 1=
1
2
---
– g
1
2
---
≤≤
Tf{} pz() z
1
2
---–d


f

=
jJ1–()
fa
L

a
U
a
L

------------------
N
=

a
L
a
U
·
[]
N
r
j
a
U
a
L

J
------------------ j
a
U
a
L

2J
------------------ a
L
++=
r
j
r
j
r

j

×