2006
Quantification
University of the Philippines August 2006
Diane Lingrand
University of Nice – Sophia Antipolis, France
lingrand@polytech.unice.fr
http://www.polytech.unice.fr/~lingrand
2006
Quantification
• Only discrete values are available
• Usually:
– grey levels: integers from 0 to 255
– color components: integers from 0 to 255
= 256 different values
2006
Information coding
• 1 bit values can be 0 or 1 : 2 different values (=21)
• 2 bits: 00, 01, 10, 11: 4 different values (=22)
• 3 bits: 000, 001, 010, 011, 100, 101, 110, 111:
8 different values (=23)
• ....
• 1 byte = 8 bits: 256 = 28 different values
– to store integers from 0 to 255, we need 1 byte
• ...
• n bits: 2n different values
2006
Reducing the number of bits used ...
• ... will reduce the number of colors.
• How to choose the colors ?
255 255
0 f
g
2006 5
Principle
• decision level : di
• reconstruction level : rj
d0 d1 d2
…
dn1 dnmin(f)=m r0 r1 rn1 max(f)=M
di di+1 ri
f g
ri
if f(x,y) ∈ [di ; di+1[ then g(x,y)=ri
2006 6
Quantification error
• we want to minimize error between f and g
• values of g : samples of a random process with probability density p(f)
• hypothesis : probability density of each quantification level is constant : p(r
i)
H
2006
Consequences of hypothesis
• Then :
H
and finally :
2006 8
How to decide the reconstruction levels ?
• we want to minimize error E with respect to ri – determination of ri
then :
2006 9
How to decide the reconstruction levels ?
with
[Panter et Dite]
2006 10
Uniform probability density :
• constant length quantification intervals
• centered quantification levels
0 255
255
k*
256/2n
2006 11
General case
• Hypothesis is not verified
• Recursive formulae
• Tables for uniform probability densities, gaussian, ...
H
2006 12
Grey levels quantification
• number of quantification levels: 2n where n is the number of bits
• 8 bits : 256 grey levels
• human visual capacity : 10 to 15 absolute grey levels. Many more in relative.
2 bits
1 bit 3 bits
2006 13
Colors quantification
• considering the components separately – number of bits may differ
• RGB seems to be the more appropriate
• ex: SVGA :
– (R, G, B) = (5 bits, 5 bits, 5 bits)
• on your computer ?
2006 14
8 bits , 256 grey levels
16 777 216 colors
2006 15
7 bits : 128 grey levels
2 097 142 colors
2006 16
6 bits : 64 grey levels
262 144 colors
2006 17
5 bits : 32 grey levels
37 768 colors
2006 18
4 bits : 16 grey levels
4 096 colors
2006 19
3 bits : 8 grey levels
512 colors
2006 20
2 bits : 4 grey levels
64 colors
2006 21
1 bit : 2 grey levels
8 colors
2006 22
4 bits. logarithmic quantification
example :
255 * log(x/10+1)/log(26.5)
2006
Bibliography
•“Digital Image Processing" par W. K. Pratt, John Wiley & Sons, inc., Third Edition, 2001
•"Digital Image Processing" par Gonzalez et Woods, Prentice Hall, Second Edition, 2002
•http://www.dai.ed.ac.uk/HIPR2/
•Books available on the web
http://homepages.inf.ed.ac.uk/rbf/CVonline/books.htm
•Computer Vision Online
http://www.dai.ed.ac.uk/CVonline/transf.htm
•Vetterli's talks (wavelets, ..)
http://lcavwww.epfl.ch/~vetterli/talks/index.html