MATLAB: How to sort CORRELATION property of graycoprops

glcmgraycopropsImage Processing Toolboxsort

sorting of correlation values is done. it works well with 2×2 but not working with 16×16 or 8×8.. can u tell me why is it so…
can u tell me how to do it?
blockSizeR = 128;% Rows in block.
blockSizeC = 128; % Columns in block.
for row = 1 : blockSizeR : rows
for col = 1 : blockSizeC : columns
row1 = row;
row2 = row1 + blockSizeR - 1;
row2 = min(rows, row2);
col1 = col;
col2 = col1 + blockSizeC - 1;
col2 = min(columns, col2);
oneBlock = grayImage(row1:row2, col1:col2);
subplot(2,2,blockNumber);
imshow(oneBlock);
glcm=0;
glcm=graycomatrix(oneBlock);
stats=graycoprops(glcm,'correlation');
fprintf('\ncorrelation values are\n %d',stats);
caption2 = sprintf('Block #%d\n of %d', blockNumber,blocks);
title(caption2, 'FontSize', fontSize);
blockNumber = blockNumber + 1;
end
end
[sortedStats,blockNumber]=sort([stats.Correlation]);
fprintf('\nblock #%d = %f\n',[blockNumber(:),sortedStats(:)].');
here i m dividing the image into non-overlapping blocks of size 2×2. i m caculating the glcm of each and every block and after that m caculating the correlation of each block..

Best Answer

I think we talked about this before. stats is a structure so you need to fprintf individual structure members. You can't fprintf() the whole structure with a %d.