Image Processing Assignment II (Appu) PDF

You might also like

You are on page 1of 7

By

M.Apuroop
110113044
1|Page

Homomorphic Filtering
Homomorphic filtering is a generalized technique for signal and image processing,
involving a nonlinear mapping to a different domain in which linear filter
techniques are applied, followed by mapping back to the original domain. This
concept was developed in the 1960s by Thomas Stockham, Alan V. Oppenheim,
and Ronald W. Schafer at MIT.
An image can be characterized by two components,
(1) the amount of source illumination incident and
(2) amount of illumination reflected by the object.
A simple image model
f(x,y): the intensity is called the gray level for monochrome image
f(x, y) = i(x, y).r(x, y)
0 < i(x, y) < inf, the illumination
0< r(x, y) < 1, the reflectance
The Process :-

f (x, y ) = i (x, y ) r (x, y )


z (x, y ) = ln f (x, y ) = ln i(x, y )+ ln r (x, y )
F {z (x, y )}= F {ln i (x, y )}+ F {ln r (x, y )}
Z (u , v) = Fi (u , v) + Fr (u, v)
S (u , v ) = H (u , v )Fi (u , v )+ H (u, v )Fr (u , v )
s(x, y ) = i(x, y )+ r (x, y )
g (x, y ) = exp[s(x, y )]= exp[i(x, y )]exp[r (x, y )]

2|Page

Explanation:
An image as a function can be expressed as the product of illumination and
reflectance components as follows:
F(x,y) = I(x,y) * R(x,y)

(1)

The illumination component


Slow spatial variations
Low frequency
The reflectance component
Vary abruptly, particularly at the junctions of dissimilar objects
High frequency
Equation (1) cannot be used directly to operate separately on the frequency
components of illumination and reflectance because the Fourier transform of the
product of two functions is not separable. Instead the function can be represented as
a logarithmic function wherein the product of the Fourier transform can be
represented as the sum of the illumination and reflectance components as shown
below:

ln(x,y) = ln(I(x,y)) + ln(R(x,y))


The Fourier transform of equation (2) is
Z(u,v) = Fi(u,v) + Fr(u,v)

(2)

(3)

The fourier transformed signal is processed by means of a filter function H(u,v) and
the resulting function is inverse fourier transformed. Finally, inverse exponential
operation yields an enhanced image. This enhancement approach is termed as
homomorphic filtering.

3|Page

The whole operation is expressed as a block diagram below:

4|Page

Program :
I = imread('willowtree.jpg');
figure, imshow(I);

% the image might be a color image, so we convert it to greyscale


I = rgb2gray(I);

% convert the image to floating-point type from uint8(which is default)


I = im2double(I);
figure, imshow(I);

% take the image into the log domain


I = log(1 + I);
figure, imshow(I);

% Now lets construct the gaussian filter here k = size(I,1) = size(I,2)


M = 2*size(I,1) + 1;
N = 2*size(I,2) + 1;

% standard deviation of the equivalent spatial domain gaussian filter


sigma = 10;

Contd.
5|Page

% X and Y are k*k size matrices with


% X has column i with all i's (this is true for i = 1,....k
% Y has row i with all i's (this is true for i = 1,....k
[X, Y] = meshgrid(1:N,1:M);
centerX = ceil(N/2);
centerY = ceil(M/2);

gaussianNumerator = (X - centerX).^2 + (Y - centerY).^2;


H = exp(-gaussianNumerator./(2*sigma.^2));
H = 1 - H;

imshow(H,'InitialMagnification',25)

H = fftshift(H);
If = fft2(I, M, N);

Iout = real(ifft2(H.*If));
Iout = Iout(1:size(I,1),1:size(I,2));

Ihmf = exp(Iout) - 1;

imshowpair(I, Ihmf, 'montage')

6|Page

Output :
Original Image

Homomorphic Filtered Image :

7|Page

You might also like