i've a matrix B. i've calculated the mean, entropy mean and glcm mean of each row. now i wan t the new matrix having these three as columns and rows are same a B
Show older comments
i've a gray scale image and i've divided it into overlapping blocks.
each block i've stored in the form of vector in a matrix B.
From the matrix B ,i've calculated the MEAN, GLCM MEAN and ENTROPY MEAN of each and every blocks.
i want to create a new matrix having MEAN, GLCM MEAN and Entropy meaqn as three columns and number of rows same as B.
the code i wrote is:
for i=1:length(B)
%Reading First Vector
vector1=B(i,:);
match1=i;
block1=index(match1);
rowstart1=startRow(match1);
colstart1=startCol(match1);
oneBlock1=grayImage(rowstart1:rowstart1+(blockSizeR-1),colstart1:colstart1+(blockSizeC-1));
%Calculating Mean
mean1=floor(mean2(oneBlock1));
%Calculating GLCM Mean
glcml1=0;
glcmr1=0;
glcm1=0;
glcm1=graycomatrix(oneBlock1);
for x=1:overlapR
for y=1:overlapC
glcml1=glcml1+x*glcm1(x,y);
glcmr1=glcmr1+y*glcm1(x,y);
glcmLR1=abs(glcml1-glcmr1);
end
end
glcmLRD1(index1)=glcmLR1;
disp(glcmLRD1);
%Calculating Entropy
entropy1=entropyfilt(oneBlock1);
entropyMean1(index1)=floor(mean2(entropy1));
%Creating new matrix with 3 columns corresponding to Intensity Mean, GLCM Mean and Entropy Mean
newB(index,1)=mean1
newB(index1,1)=glcmLR1
newB(index1,2)=entropyMean1;
index1=index1+1;
New(rowstart1 : rowstart1 + (blockSizeR - 1), colstart1 : colstart1 + (blockSizeC - 1),[1 2 3])=0; %assign black color
end
disp(newB);
here newB is my new matrix having columns mean glcm and entropy
but it shows error that the dimension mismatch..
plz help me in solving my problem..
4 Comments
Image Analyst
on 9 May 2013
Aren't they non-overlapping? Anyway, did you know that graycomatrix doesn't look at all 8 directions? It only looks at one direction. To get all 8, you'd have to look at the 4 directions - top row and right. Only 4 instead of 8 otherwise you'd be double counting (looking below and above will count that pair of pixels twice).
Raman
on 9 May 2013
Raman
on 9 May 2013
Answers (1)
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!