Escolar Documentos
Profissional Documentos
Cultura Documentos
Techniques
Methods
1. Spatial Domain
direct manipulation of pixels of the image
2. Frequency Domain
modifying the Fourier Transform of an image
(x,y)
Image f
s=T(r)
Output intensity
L-1
0 L-1 r
Input intensity
L-1
0 L-1 r
Input intensity
Arial image
Result of a transformation
for c=1 and γ=3
(r2,s2)
3L/4
L/2 T(r)
L/4
(r1,s1)
0
0 L/4 L/2 3L/4 L-1
Input intensity level, r
L-1 L-1
output intensity level, s
L/4 L/4
(r1,s1) (r1,=s1)
0 0
0 L/4 L/2 3L/4 L-1 0 L/4 L/2 3L/4 L-1
Input intensity level, r Input intensity level, r
Image Processing By Dr. Jagadish Nayak ,BITS Pilani, Dubai Campus
Piecewise Linear
transformation functions
Contrast stretching
Suppose r1=r2 and s1=0 and s2=L-1
L-1 (r2)
L-1
output intensity level, s
L/4 L/4
(r1,s1)
0 0 (r1)
0 L/4 L/2 3L/4 L-1 0 L/4 L/2 3L/4 L-1
Input intensity level, r Input intensity level, r
Image Processing By Dr. Jagadish Nayak ,BITS Pilani, Dubai Campus
Piecewise Linear
transformation functions
Contrast stretching
Intermediate values of (r1,s1) and (r2,s2) produces various degree of spread in
the intensity
L-1
output intensity level, s
(r2,s2)
3L/4
T(r)
L/2
L/4
(r1,s1)
0
0 L/4 L/2 3L/4 L-1
Input intensity level, r
Image Processing By Dr. Jagadish Nayak ,BITS Pilani, Dubai Campus
Piecewise Linear
transformation functions
Contrast stretching (Example)
(r1,s1)=(rmin, 0) and (r2,s2)=(rmax,L-1)
L-1
output intensity level, s
3L/4 rmax,L-1
L/2 T(r)
L/4 rmin, 0
0
0 L/4 L/2 3L/4 L-1
Input intensity level, r
K=im2bw(im,0.42);
figure,imshow(K)
s T(r)
0 r
L-1
s T(r)
0 r
L-1
Contribution of bit
plane 8
Let the intensity level in the image be in the range from [0 L-1]
Histogram is a discrete function h(rk)=nk, where rk is the kth intensity value
and nk is the number of pixels in the image with pixel level rk.
clear all ;
clc;
[filename, pathname] = uigetfile('*.tif');
im = imread([pathname filename]);
imshow(im);
figure, imhist(im);
6000
5000
4000
3000
2000
1000
7000
6000
5000
4000
3000
2000
1000
7000
6000
5000
4000
3000
2000
1000
4000
3500
3000
2500
2000
1500
1000
500
Suppose we use the inverse operation as r=T-1(s) , then the condition should
be strictly monotonically increasing.
If pr(r) and T(r) is known, where T(r) is continuous and differentiable
over the PDF range , then
dr
ps ( s ) pr ( r )
ds Cumulative
The transformation function is of the form Distribution
r
Function (CDF) of
s T (r ) ( L 1) pr ( w)dw random variable r
0
2r
for 0 r ( L 1)
pr ( r ) ( L 1) 2
0 otherwise
r r
2 r2
s T (r ) ( L 1) pr ( w)dw wdw
0
( L 1) 0 ( L 1)
Suppose L=9 and pixel at location say (x,y) has the value r=3, then
s=T(r)= r2/9=1
1
dr 2r ds
ps ( s ) pr ( r )
ds ( L 1) 2 dr
2 1
2r d r
( L 1) 2 dr L 1
Assume r is positive and
L>1
2r ( L 1) 1
Result is uniform PDF
( L 1) 2 2r L 1
k
sk T (rk ) ( L 1) pr ( r j )
j 0
k
( L 1)
nj k 0,1,2,........L 1
MN j 0
1
s1 T (r1 ) 7 pr (rj ) 7 pr (r0 ) 7 pr (r1 ) 3.08
j 0
k
( L 1)
nj k 0,1,2,........L 1
MN j 0
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Histogram matching
(Specification)
Let pz(z) is the specified PDF, which is going to be the PDF of the output
image. So we have
q
G ( z q ) ( L 1) p z ( zi ) sk
j 0
0
G ( z1 ) 7 p z ( z j ) 7[ p( z0 ) p( z1 )]
j 0
For example s0=1, and G(z3)=1, which is a perfect match for this case,
here s0 -> z3 ,i. e every pixel whose value is 1 in the histogram
equalized image is mapped to pixel valued 3 in the histogram
specified image. Continuing this we get,
sk zq
1 3
3 4
5 5
6 6
7 7
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956