code troubling me
hi
i m a final year BE student working on image processing
i need help on the same
i have acquired 512 x 512 image from a database and divided it into 64 blocks.Our algorithm requires us to genetrate
co occurence histograms for eight angles.
we have extracted features from one block.
we need to extend it for other blocks also and store it in a database.
the following is the code for one amgle(0 degree)
X1=imread(strcat(y,t{i},'.bmp'));
imshow(X1)
end
I2=X1(:,:,1);
g=cell(size(64));
for i=1:512
for j=1:512
C(i,j)=I2(i,j);
end
end
g=mat2cell(C,64*ones(8,1),64*ones(1,8));
F=g{3,8};
for i=0:255
gray(i+1)=i;
end
% decomposing an image using haar wavelet transform
[cA1,cH1,cV1,cD1] = dwt2(F,'db1');
A1 = upcoef2('a',cA1,'db1',1);
H1 = upcoef2('h',cH1,'db1',1);
V1 = upcoef2('v',cV1,'db1',1);
D1 = upcoef2('d',cD1,'db1',1);
%decomposing complement of an image using haar wavelet transform
FC=imcomplement(F);
[cA2,cH2,cV2,cD2] = dwt2(FC,'db1');
A2 = upcoef2('a',cA2,'db1',1);
H2 = upcoef2('h',cH2,'db1',1);
V2 = upcoef2('v',cV2,'db1',1);
D2 = upcoef2('d',cD2,'db1',1);
%histogram for A1 and D11 (d=1,angle=0)
a11=wcodemat(A1,192);
d11=wcodemat(H1,192);
for i=1:64
for j=1:64
s1=a11(i,j);
if(j+1<=64)
s2=a11(i,j+1);
else
s2=0;
end
v1=d11(i,j);
if(j+1<=64)
v2=d11(i,j+1);
else
v2=0;
end
min1=min(s1,v2);
min2=min(s2,v1);
alpha=max(min1,min2);
if(alpha==min1)
His1(i,j)=s1;
else
His1(i,j)=0;
end
if(alpha==min2)
His2(i,j)=s1;
else
His2(i,j)=0;
end
end
end
%histogram1
min_intensity=min(min(His1));
max_intensity=max(max(His1));
[r1 c1]=size(His1);
[r2 c2]=size(His2);
init=0;
sum=0;
for a=0:255
count=0;
for i=1:1:r1
for j=1:1:c1
if(His1(i,j)==a)
count=count+1;
end
end
end
prob(a+1)=count/4096;
cum(a+1)=prob(a+1)+init;
init=cum(a+1);
sum=sum+init;
mean1=sum/256;
end
mean1
std=0;
for a=0:255
temp=abs(cum(a+1)-mean1);
std=std+temp;
end
std1=std/256
figure,
stem(gray,cum),title('A1 and D11 d=1,angle=0');
help me please.........:sad: