Asked by Raman
on 9 May 2013

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..

*No products are associated with this question.*

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 4 Comments

## Matt J (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75178#comment_148095

Please show (copy/paste) the error. Please also trap it with DBSTOP.

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75178#comment_148097

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 (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75178#comment_148120

sir can u tell me by writing some piece of code of 4 direction plz?

so that i can understand

## Raman (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75178#comment_148122

Subscripted assignment dimension mismatch.

Error in overlapLexicoFeatureMatrix (line 130)