ECE 484 Digital Image Processing Lec 04 - Point Operations & Quantization Zhu Li Dept of CSEE, UMKC Office: FH560E, Email: [email protected], Ph: x 2346. http://l.web.umkc.edu/lizhu office hour: Tu/Th 2:30-4pm@FH560E Z. Li, ECE484 Digital Image Processing, 2019. p.1
36
Embed
ECE 484 Digital Image Processing Lec 04 - Point Operations ... · manipulating dynamic ranges of images, give it more resolution, improves its quality Gamma correction (display adaptation)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
ECE 484 Digital Image Processing Lec 04 - Point Operations & Quantization
Enhance white or gray detail on dark regions, esp. when black areas are dominant in size
-13-Z. Li, ECE484 Digital Image Processing, 2019.
Basic intensity transform functions
monotonic, reversible compress or stretch certain range of gray-levels
-14-Z. Li, ECE484 Digital Image Processing, 2019.
Freq Domain Log Mapping
Freq domain operations
Z. Li, ECE484 Digital Image Processing, 2019. p.15
lena
FFT(lena) stretch:u 2 [0, .5] v 2 [0, .59]
compress:u 2 [.5, 1] v 2 [.59, 1]im = imread(‘lena.png’)
a = abs(fftshift(fft2(double(im))));c = log(1+double(im)); c = range_normalize(c);b = log(1+a); b=b/max(b(:));
Gamma Correction
Matching Display characteristics
Z. Li, ECE484 Digital Image Processing, 2019. p.16
power-law response functions in practiceCRT Intensity-to-voltage
function has ¼ 1.8~2.5Camera capturing distortion
with c = 1.0-1.7 Similar device curves in
scanners, printers, …
power-law transformations are also useful for general purpose contrast manipulation
Gamma Correction
Make image characteristis match display (voltage-brightness )
Z. Li, ECE484 Digital Image Processing, 2019. p.17
make linear input appear linear on displays method: calibration pattern + interactive adjustment
Effects of Gamma Correction
On images...
Z. Li, ECE484 Digital Image Processing, 2019. p.18
L02.2 L0
1/2.2L0
Histogram Equalization
Why histogram equalization ?
Z. Li, ECE484 Digital Image Processing, 2019. p.19
if pixel values are i.i.d random variables histogram is an estimate of the probability distribution of the r.v.
“unbalanced” histograms do not fully utilize the dynamic range Low contrast image: narrow
luminance range Under-exposed image:
concentrating on the dark side Over-exposed image:
concentrating on the bright side
“balanced” histogram gives more pleasant look and reveals rich details
Contrast Stretching
Map intensity to a larger range
Z. Li, ECE484 Digital Image Processing, 2019. p.20
0 L-1
L-1
Stretch the over-concentrated gray-levelsPiece-wise linear function, where the slope in the stretching region is greater than 1.
Objectives of Histogram Equalization Objectives
Z. Li, ECE484 Digital Image Processing, 2019. p.21
goal: map the each luminance level to a new value such that the output image has approximately uniform distribution of gray levels
two desired properties monotonic (non-decreasing) function: no value reversals [0,1][0.1] : the output range being the same as the input range
pdf
cdf
o
1
1o
1
1
Histogram Equalization
Algorithm
Matlab
Z. Li, ECE484 Digital Image Processing, 2019. p.22
make
show
o
1
1
im = imread(‘lena.png’)[im1,T]=histeq(rbg2gray(im));plot((0:255)/255,T);
T: cdf of lena
Equalization Algorithm
Alogrithm Sketch
Z. Li, ECE484 Digital Image Processing, 2019. p.23
Rounding or Uniform
quantization
u v v’
pu(xi)
compute histogram
equalize
round the output
or
Only depend on the input image histogram
Fast to implement For u in discrete prob.
distribution, the output v will be approximately uniform
Outline
Recap of Lec 03 Point Operations Image Quantization Summary
Z. Li, ECE484 Digital Image Processing, 2019. p.24
Image Quantization
Image quantization transfer function
Z. Li, ECE484 Digital Image Processing, 2019. p.25
Uniform Quantizer The uniform quantizer’s design:
• Denote the input brightness range: • Let B – the number of bits of the quantizer => L=2B reconstruction levels• The expressions of the decision levels:
•quantization step size: q
E.g. B=2 => L=4
Z. Li, ECE484 Digital Image Processing, 2019. p.26
Uniform quantization error
Reconstruction
Reconstruction error in Mean Squred Error (MSE)
If P(x) is uniform: proof: homework
Z. Li, ECE484 Digital Image Processing, 2019. p.27
Uniform quantization and errors
Cameraman example B=1 => L=2
Non-quantized image Quantized image
Quantization error; MSE=36.2
The histogram
Z. Li, ECE484 Digital Image Processing, 2019. p.28
Uniform Quantization Example Finer quantization B=2 => L=4
Non-quantized image Quantized image
Quantization error; MSE=15
histogram
Z. Li, ECE484 Digital Image Processing, 2019. p.29
Z. Li, ECE484 Digital Image Processing, 2019. p.30
Distribution Optimal Quantization
Lloyd-Max Quantization, optimize w.r.t to tk, rk
we have
which means, tk is the mid point between two reconstructions, while rk is the average.
Z. Li, ECE484 Digital Image Processing, 2019. p.31
LMQ error
The MSE from LMQ: assuming piece-wise linear PDF of X
The MSE is estimated as,
Z. Li, ECE484 Digital Image Processing, 2019. p.32
Lloyd-Max Quantization Example
LMQ example: B=1 => L=2Non-quantized image
Quantized image
The quantization error; MSE=19.5
The evolution of MSE in the optimization, startingfrom the uniform quantizer
Z. Li, ECE484 Digital Image Processing, 2019. p.33
LMQ example
LMQ: B=2, L=4
The quantization error; MSE=9.6
Non-quantized image Quantized image
The evolution of MSE in the optimization, startingfrom the uniform quantizer
Z. Li, ECE484 Digital Image Processing, 2019. p.34
LMQ
LMQ: B=3, L=8
The quantization error; MSE=5
Non-quantized image Quantized image
The evolution of MSE in the optimization, startingfrom the uniform quantizer
Z. Li, ECE484 Digital Image Processing, 2019. p.35
Summary
Point operations Operates on the imput intensity value, has no memory of the
neigbhouring pixels manipulating dynamic ranges of images, give it more resolution,
improves its quality Gamma correction (display adaptation) Histogram equalization Quantization - uniform: most widely used these days Lloyd-Max quantiztion: adaptive to distribution
Z. Li, ECE484 Digital Image Processing, 2019. p.36