how to sort CORRELATION property of graycoprops?
조회 수: 1 (최근 30일)
이전 댓글 표시
sorting of correlation values is done. it works well with 2x2 but not working with 16x16 or 8x8.. 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 2x2. i m caculating the glcm of each and every block and after that m caculating the correlation of each block..
댓글 수: 0
채택된 답변
Image Analyst
2013년 3월 7일
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.
댓글 수: 3
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!