Beruflich Dokumente
Kultur Dokumente
= 3.0
= 4.0 = 5.0
Contrast Stretching
If r<r1 then
s = r*s1/r1
If r1<= r<=r2 then
s = (r-r1)*(s2-s1)/(r2-r1)+s1
If r>r2 then
s = (r-r2)*(255-s2)/(255-r2)+s2
If r1=r2 and s1=0,s2=255, the
transform is called “Threshold Functio
n”.
Examples of Contrast
Stretching
Contrast Stretching in Medical Image
Window Width/Level(Center)
s1=0,s2=255
width (w)=r2-r1, level (c)=(r1+r2)/2
Histogram & PDF
h(r)= nr
where nr is the number of pixels whose
intensity is r.
The Probability Density
h ( r ) Function (PDF)
p( r) =
M �N
Cumulative Distribution Function
(CDF)
PDF CDF
Transfer Function
r
r
CDF ( r ) = �p ( r �
) dr �
0
Example of Histogram and Cumulative
Distribution Function (CDF)
Low Contrast Image
High Low
Concentra Concentra
te te
The image is highly concentrated on
low intensity values.
The low contrast image is the image
which is highly concentrated on a
narrow histogram.
Histogram Equalization
pr ( r ) = The PDF of r
ps ( s ) = The PDF of s
Transformation Function of
Histogram Equalization
r
s = T ( r ) = 255� pr ( r �
) dr �
0
The PDF of s
ds dT ( r )
=
dr dr
d �r �
= 255 � p ( r )
� dr �
dr � �
r
0
= 255 pr ( r )
dr
p s ( s ) = pr ( r )
ds
1
=
255
Histogram Equalization Example
Intensity # pixels CDF of Pr
0 20 20/100 = 0.2
1 5 (20+5)/100 = 0.25
2 25 (20+5+25)/100 = 0.5
3 10 (20+5+25+10)/100 = 0.6
4 15 (20+5+25+10+15)/100 = 0.75
5 5 (20+5+25+10+15+5)/100 = 0.8
6 10 (20+5+25+10+15+5+10)/100 = 0.9
7 10 (20+5+25+10+15+5+10+10)/100 = 1.0
Total 100 1.0
Histogram Equalization Example
(cont.)
Intensity No. of Pixels Acc Sum Output value Quantized
(r) (nj) of Pr Output (s)
0 20 0.2 0.2x7 = 1.4 1
1 5 0.25 0.25*7 = 1.75 2
2 25 0.5 0.5*7 = 3.5 3
3 10 0.6 0.6*7 = 4.2 4
4 15 0.75 0.75*7 = 5.25 5
5 5 0.8 0.8*7 = 5.6 6
6 10 0.9 0.9*7 = 6.3 6
7 10 1.0 1.0x7 = 7 7
Total 100
Histogram Matching
How to transform the variable r
whose pPDF r ( r ) is to the variable t w
pt ( t ) PDF is
hose .
r
s = T ( r ) = 255�pr ( r �
) dr �
0
t
G ( t ) = 255�pt ( t �
) dt �= s
0
t = G -1 ( t )
r T( ) s G-1( ) t