Image Is NOT Perfect Sometimes: EE465: Introduction To Digital Image Processing 1
Image Is NOT Perfect Sometimes: EE465: Introduction To Digital Image Processing 1
http://www.eri.harvard.edu/faculty/peli/proje
cts/enhancement.html
EE465: Introduction to Digital Image
Processing 2
Image Enhancement
Introduction
Spatial domain techniques
Point operations
Histogram equalization and matching
Applications of histogram-based
enhancement
Frequency domain techniques
Unsharp masking
Homomorphic filtering*
x
L
L=255: for grayscale images
yx
y
L
x
L
No influence on visual quality at all
y Lx
0 L x
x 0 xa
yb
y ( x a ) ya a xb
( x b) y ya
b b xL x
0 a b L
0 0 xa
y ( x a) a x b
(b a) b x L
a b x
0 L
a 50, b 150, 2
EE465: Introduction to Digital Image
Processing 9
Range Compression
y c log 10 (1 x)
0 L x
c=100
EE465: Introduction to Digital Image
Processing 10
Summary of Point Operation
2500
2000
1500
1000
500
0
0 50 100 150 200
3.5
2.5
1.5
0.5
7000
6000
5000
4000
3000
2000
1000
Over-exposed image
Histogram equalization
Basic idea: find a map f(x) such that the histogram
of the modified (equalized) image is flat (uniform).
Key motivation: cumulative probability function
(cdf) of a random variable approximates a uniform
distribution
x
Suppose h(t) is the histogram (pdf) s( x) h(t )
t 0
x
0 L
http://en.wikipedia.org/wiki/Inverse_transform_sampling
16
EE465: Introduction to Digital Image
Processing
MATLAB Implementation
function y=hist_eq(x)
y=x;s=sum(h);
for i=1:256
I=find(x= =i-1); Perform histogram
equalization
y(I)=sum(h(1:i))/s*255;
end
before after
2500 2500
2000 2000
1500 1500
1000
1000
500
500
0
0 50 100 150 200 0
0 50 100 150 200 250 300
http://en.wikipedia.org/wiki/Adaptive_histogram_equalization
histogram1 histogram2
S-1*T
T S
?
EE565 Advanced Image Processing
Copyright Xin Li 2008 21
Application (I): Digital Photography
before after
before after
Histogram-equalized
LDR video
Adaptive histogram
-equalized1
1EricP. Bennett and Leonard McMillan. “Video enhancement
using per-pixel virtual exposures,” In ACM SIGGRAPH 2005
Introduction
Spatial domain techniques
Point operations
Histogram equalization and matching
Applications of histogram-based
enhancement
Frequency domain techniques
Unsharp masking
Homomorphic filtering*
1
g (m, n) x(m, n) [ x(m 1, n) x(m 1, n)
4
x(m, n 1) x(m, n 1)]
function y=unsharp_masking(x,lambda)
% Laplacian operation
h=[0 -1 0;-1 4 -1;0 -1 0]/4;
dx=filter2(h,x);
y=x+lambda*dx;
200
200
150
150
100
100
50 50
0 0
0 50 100 150 200 250 0 50 100 150 200 250
x(n) xlp(n)
220
8
200
6
4 180
2 160
0
140
-2
120
-4
100
-6
80
-8 0 50 100 150 200 250 300
0 50 100 150 200 250 300
g(n)=x(n)-xlp(n) y ( n ) x ( n ) g ( n )
Illumination reflectance
(low freq.) (high freq.)
ln f ( x, y ) ln i ( x, y ) ln r ( x, y )
before after