Aim:- Homomorphic Filtering
MSc Computer Science Image Processing Practical No. 15
Index of all Practicals ~ Click Here
Code:- Homo_Filter.m
Output:-
MSc Computer Science Image Processing Practical No. 15
Index of all Practicals ~ Click Here
Code:- Homo_Filter.m
% **** HOMOMORPHIC FILTERING ****
a=imread('Ranch house.jpg');
r1=double(a);
[row col]=size(r1);
b=r1;
D0=input('enter cut off : ');
Yh=input('enter the value of Yh :');
Yl=input('enter the value of Yl :');
C=input('enter the value of c :');
for x=1:1:row
for y=1:1:col
if r1(x,y)==0
b(x,y)=1;
end
end
end
for u=1:1:row
for v= 1:1:col
D=((u-row/2)^2+(v-col/2)^2)^0.5;
H(u,v)=(Yh-Yl)*(1-exp(-C*(D*D/D0*D0)))+Yl;
end
end
m=log(b);
x=fft2(m);
v=fftshift(x);
v1=v.*H;
g1=(abs(ifft2(v1)));
g=exp(g1);
figure(1);
imshow(uint8(g));
figure(2);
imshow(uint8(r1));
a=imread('Ranch house.jpg');
r1=double(a);
[row col]=size(r1);
b=r1;
D0=input('enter cut off : ');
Yh=input('enter the value of Yh :');
Yl=input('enter the value of Yl :');
C=input('enter the value of c :');
for x=1:1:row
for y=1:1:col
if r1(x,y)==0
b(x,y)=1;
end
end
end
for u=1:1:row
for v= 1:1:col
D=((u-row/2)^2+(v-col/2)^2)^0.5;
H(u,v)=(Yh-Yl)*(1-exp(-C*(D*D/D0*D0)))+Yl;
end
end
m=log(b);
x=fft2(m);
v=fftshift(x);
v1=v.*H;
g1=(abs(ifft2(v1)));
g=exp(g1);
figure(1);
imshow(uint8(g));
figure(2);
imshow(uint8(r1));
Output:-
Good post!
ReplyDeleteI have a question: what the meaning of D0, Yh, Yl and C?