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

2 views (last 30 days)
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
Raman
Raman on 9 May 2013
@ Matt J
Subscripted assignment dimension mismatch.
Error in overlapLexicoFeatureMatrix (line 130)
newB(index1,3)=entropyMean1;

Sign in to comment.

Answers (1)

Matt J
Matt J on 10 May 2013
The variable entrpoyMean1 is not a scalar, as DBSTOP will show you, and therefore
newB(index1,3)=entropyMean1;
does not make sense. Possibly, you meant to have
newB(index1,3)=entropyMean1(index1);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!