i do spatial domain filtering but it takes too long time and output is blurred
Info
This question is closed. Reopen it to edit or answer.
Show older comments
clc;
clear all;
close all;
I1=imread('C:/indu/103_.tif');
I2=im2double(I1);
I=imresize(I2,[480 640]);
[r c numberOfColorBands] = size(I);
m=mean(mean(I));
v=var(var(I));
m1=128;
v1=128*128;
for i=1:480
for j=1:640
if(I(i,j)>m)
G(i,j)=m1+(sqrt((v1*((I(i,j)-m).*(I(i,j)-m))))/(v));
else
G(i,j)=m1-(sqrt((v1*((I(i,j)-m).*(I(i,j)-m))))/(v));
end
end
end
l=1;
w=2;
hy = -fspecial('sobel')
hx = transpose(hy);
gx1 = imfilter(I,hx,'symmetric','same');
gy1 = imfilter(I,hy,'symmetric','same');
gx = wextend(2,'zpd',gx1,l);
gy=wextend(2,'zpd',gy1,l);
for r=2:481
for c=2:641
Vx(r,c)=0;
Vy(r,c)=0;
for u=r-(w/2):r+(w/2)
for v=c-(w/2):c+(w/2)
r1=r-1;
c1=c-1;
Vx(r1,c1)=Vx(r1,c1)+(2*(gx(u,v))*(gy(u,v)));
Vy(r1,c1)=Vy(r1,c1)+((gx(u,v)*gx(u,v))-((gy(u,v)*gy(u,v))));
end
end
if (Vx(r1,c1)==0)
O(r1,c1)=90;
else
O(r1,c1)=(0.5*(tan(Vy(r1,c1)/Vx(r1,c1))));
end
end
end
A=[1 1 1 1 1 1 1 1 1; 100 100 100 100 100 100 100 100 100; 1 1 1 1 1 1 1 1 1];
w1=3;
h1=9;
a=10;
b=1;
for i1=1:480
for j1=1:640
B=0;
for u2=-(w1-1)/2:(w1-1)/2
for v2=-(h1-1)/2:(h1-1)/2
i2=abs(ceil(i1+u2*cos(O(i1,j1))+v2*sin(O(i1,j1))));
j2=abs(ceil(j1-u2*sin(O(i1,j1))+v2*cos(O(i1,j1))));
if(i2==0)
i2=i2+1;
end
if(j2==0)
j2=j2+1;
end
if(i2>480)
i2=480;
end
if(j2>640)
j2=640;
end
G1=imfilter(G(i2,j2),A,'symmetric','same');
end
end
den=(((w1-1)*b+a)*h1);
lt(i1,j1)=G1/den;
end
end
imshow(lt);
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!