Professional Documents
Culture Documents
Lecture 02
Image Enhancement
Image is NOT Perfect Sometimes
L x
y
L
x
L
No influence on visual quality at all
Digital Negative
L
x
0 L
Digital Negative
L
x
0 L
Contrast Stretching
Pout=[(Pin-a)/(b-a)]*255
a=min(I)
B=max(I)
Pin=f(x, y)
Pout=g(x, y)
Contrast Stretching: More General Formula
yb
ya
0 a b L x
Clipping
a b x
0 L
Range Compression
x
0 L
c=100
Summary of Point Operation
Over-exposed image
How to Adjust the 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
Intensity Count
0 1
1 7
2 4
3 2
4 1
5 1
▪ Total pixels: 16
▪ Max value: 5
Intensity Count
Histogram Equalization 0 1
▪ Steps: 1 7
2 4
• Compute the histogram of the image
• Calculate the normalized sum of histogram 3 2
• Transform the input image to an output image 4 1
5 1
[M,N]=size(x);
Calculate the histogram
for i=1:256 of the input image
h(i)=sum(sum(x= =i-1));
End
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
Image Example
before after
Histogram Comparison
32
Application (I): Digital Photography
Application (II): Iris Recognition
before after
34
Application (III): Microarray Techniques
before after
35
Assignment-1
36