Documente Academic
Documente Profesional
Documente Cultură
Dr. S.K.Singh
Asso.Prof.,CED,SENSE,VITU,
Vellore,T.N. 632014[India]
Generating a Digital Image
Sampling&Quantization
Imagesampling:referstodiscretizationoftospatialcoordinates(x, y)
Graylevelquantization:referstodiscretizationtheamplitude.
Spatialresolution/imageresolution:pixelsizeornumberofpixels
How to choose the spatial resolution: Nyquist Rate
Originalimage
Sampledimage
1mm
2mm
Nodetailislost!
Minimum NyquistRate:
Spatialresolution
Period Spatial resolution must be less or equal
(samplingrate)
half of the minimum period of the image
or sampling frequency must be greater or
=Samplinglocations
Equal twice of the maximum frequency.
Storage
Ifb =no.ofbitsrequiredtostoreadigitalimage
then,
b N M k
2
no. of bits/pixel
No.ofintensity/gray levels=
i.e. L 2k
IfM = N then, b N 2 k M 2 k
256256
6464
3232
1616
Exampleofquantization
Falsecontouring:affectintensity
8 bits/pixel
4 bits/pixel
2bits/pixel 1bit/pixel
TwoDimensionalSamplingTheory
BandLimitedImages:
Fig.:FTofaBandlimitedFunctionandit'sRoS
y
x
y
x
Comb/Shahfunction:
comb x, y; x, y x mx, y ny
m n
Original image Original image spectrum 3D Original image spectrum 2D
f s x, y f x, y comb x, y; x, y
f mx, ny x mx, y my
m n
TheFTofCombfunction,
COMB u, v comb x, y; x, y
u xs v ys u ku
k l
xs , v lv ys
1 1
u xs v ys comb u , v; ,
x y
1 1
where, u xs , v ys
x y
Now,FTofthesampledimage,
Fs u , v F u, v COMB u , v
u xs v ys F u, v u ku
k l
xs , v lv ys
u xs v ys F u ku
k l
xs , v lv ys
i.e.,FTofthesampledimageiswithinascalefactor,aperiodic
ReplicationoftheFTofthei/pimageonagridwhosespacingis
uxs , vys .
Reconstruction:
u xs 2u x0 , v ys 2v y0 ; Nyquist rates
i.e.,samplingfrequenciesaregreaterthan,twicethebandwidth.
Or,equivalently,
1 1
x , y ; Nyquist intervals
2u x0 2v y0
1
u ,v ; u, v
H u , v xs ys
0 ; otherwise
where,isanyregionwhoseboundaryiscontainedwithin
1 2
theannularringbetweentherectanglesand.
F u, v H u, v Fs u, v
F u, v
i.e.,originalcontinuoussignalcanbeexactlyrecoveredbylowpass
filteringthesampledimage.
F 1 u, v f x, y
AliasingandFoldoverFrequencies:
If u xs 2u x0 , v ys 2v y0
or,
1 1
x , y
2u x0 2v y0
Aliasing
u xs v ys
If u , v
2 2
Foldover Freqs.
AliasingandFoldoverFrequencies:
TheMoire effect
Jaggedboundaries
TheMoire Pattern
StatementofSamplingTheorem:
Any bandlimited image , whose RoS is bounded and
sampled uniformly on a rectangular grid with spacing , ,
can be recovered without error from its samples ,
provided the sampling rate is greater than the Nyquist rate,
that is,
1 1
u xs 2u x0 , v ys 2v y0
x y
1 2
2
u
1
-1/2 1/2 1 2 2
-1 0 1 1 2 3 m -2 -1 0 1 2 m
-1/2
Interlacedsampling
v v
1
x x
-1 0 1 u
x x u
, 25 3 5 , 4 5 3 5 , 4 5
Let,theLPFhavearectangularRoS withcutofffrequenciesathalfthe
samplingfrequencies,thatis,
125 , 2.5 2.5, 2.5 2.5
,
0, otherwise
Now,theFTofthereconstructedimageis,
, , , 2, 1 2, 1
whichgivesthereconstructedimageas,
, 2 2 2
Thisshowsthatanyfrequencycomponentintheinputimagethatis
above 2 , 2 by , isreproduced(aliased)asa
frequencycomponentat 2 , 2 .
ImageQuantization
f x, y u m, n u m, n Digital
Sampler Quantizer
Input Image Computer
Fig.:Digitization
Digital u m, n D to A u m, n
Display
Computer Converter
Fig.:Display
Quantizer transfer function
u
Quantizer
rL Output
u Quantizer u
rk
u
t1 t2 tk tL 1
Quantizer
r2 Error
r1
Uniform Quantizer transfer function
u
I/p brightnessrange: u lmin ; Lmax
ReconstructionLevels
ReconstructionLevels: Lb rL
b
where,no.ofbitsofthequantiser
rk
tk tk 1 tk 1 tk constant q r1
u
t1 tk tL 1
t L 1 t1 L l
q , t k t k 1 q q max min DecisionLevels
L L
tk tk 1 t t q r r rk tk
q
ReconstructionLevels: rk k 1 k 1
2
k k
2
MSQE:GivenimageofsizeMN pixels,u nonquantized,and u quantized
M 1 N 1
1
u m, n u m, n
2
MN m0 n 0
MSQE
220k 55
tk , k 0,1, 2,3, 4; rk tk , k 0,1, 2,3
4 2
u B = 2 => L = 4
r3 192.5
ReconstructionLevels
r2 137.5
r1 82.5
r0 27.5
u
t0 0 t1 55 t2 110 t3 165 t4 220
DecisionLevels
Example:
If the output of an image sensor take values between 0 to 10. If the
samples are quantised uniformly to 256 levels, then estimate the
transition and reconstruction levels.
Solution: 10 k 1
tk , k 1, 2,..., 257;
256
5
rk tk , k 1, 2,..., 256
256
Examplesofuniformquantizationandtheresultingerrors:
u
B = 1 => L = 2
Non-quantized image Quantized image
ReconstructionLevels
r2 192
r1 64
u
t1 0 t2 128 t3 256
DecisionLevels
Quantization error; MSE=36.2
1000
900
800
700
600
500
400
300
200
100
r3 160
r2 96
r1 32
u Quantization error; MSE=15
t1 0 t2 64 tk 128 t4 192 t5 256
DecisionLevels
1000
900
800
700
600
500
400
300
200
100
0
The histogram of the
0 50 100 150 200 250
non-quantized image
Examplesofuniformquantizationandtheresultingerrors:
B=3 => L=8; falsecontourspresent
Uniform quantizer transfer function
r8=240
Non-quantized image Quantized image
r7=208
r6=176
Reconstruction levels
r5=144
r4=112
r3=80
r2=48
r1=16
700
600
500
400
300
200
100
e E[(u u ) 2 ]
t1
(u u ) 2 pu (u ) du
L ti 1
(u ri ) 2 pu (u ) du
i 1 ti
(tk rk 1 ) 2 (tk rk ) 2 pu (tk ) 0
t k
t
k 1
2 (u rk ) pu (u ) du 0 ; 1 k L
rk tk
t k 1
rk rk 1 up u (u ) du
tk , rk E u | u t k , t k 1
tk
t k 1
2
tk
pu (u ) du
1
pu (u ) p u (tj ), tj ( t j t j 1 ), t j u t j 1
2
z k t1
t1
[ p u (u )]1/3 d u L
ThequantizerMeanSquareDistortion,
3
1 t L1
[ pu (u )] du
1/3
12 L2 t1
p u(u )
u
t1 t2 tj t j+ 1 tL + 1
(u ) 2
exp u
1
pu (u ) exp Gaussian) , or pu (u ) (Laplacian)
2
2
2 2
2
2
2 (variance, - mean)
PropertiesofoptimumMeansquarequantizers
Thequantizer outputisanunbiasedestimateofinputi.e. E u E u
E u u u 0
quantization error and reconstruction is decorrelated.
2 1 f B u2
u
r2=153
r1=24
700 36
600 34
500 32
400 30
300 28
200 26
100 24
22
0
20
0 50 100 150 200 250
18
1 2 3 4 5 6 7 8
r4=181
Nivelele de reconstructie
r3=156
r2=115
r1=20
600
14
500
13
400
300
12
200
11
100
0 10
r8=224
r7=181
Nivelele de reconstructie
r6=165
r5=147
r4=125
r3=101
r2=54
r1=14
400
6.5
300
6
200
100 5.5
0
5
1
, t1 u t L 1
pu (u ) t L 1 t1
0
otherwise
( t k21 t k2 ) t t
rk k 1 k
2( t k 1 t k ) 2
t k 1 t k 1
tk tk tk 1 tk 1 tk constant q
2
tL1 t1 q
q , tk tk 1 q, rk tk
L 2
MSEofUniformOptimalQuantizer,
q/2 2
1 q
du
2
u
q q/2
12
SNRofUniformOptimalQuantizer,
2 B
2 , SNR 10 log 2 2B
6 B dB
u2 10
Compandor
u w y u
f(.) Uniform g(.)
compressor quantizer expander
CompressorExpander
Uniformquantizer proceededandsucceededbynonlinear
transformations
nonlinearfunctionamplifiesorsuppressesparticularranges
Whyusecompandor?
Inputsofsmallervaluessufferhigher%ofdistortionunderuniform
quantization.
Nonlinearityinperceivedluminance:
Smalldifferenceinlowluminanceismorevisible
E.g.visualquantization useluminancetocontrastfunctionascompressor
Overallcompanding systemmayapproximateLloydMaxquantizer
Bytakingp.d.f.intoaccounttodesignthecomressor andexpander
Nonlineartransformationfunctions
TomakeoverallsystemapproximateLloydMaxquantizer
Withoutiterativeprocesstodetermineparameters
Colorimagesquantization
RN T1 T1 RN
Quantizer
GN T2 T2 Color space GN
Color space Quantizer inverse
transformation transformation
T3 T3 BN
BN
Quantizer