% **** 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);
0 comments:
Confused? Feel free to ask
Post a Comment