how to sort CORRELATION property of graycoprops?
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Image Analyst
on 7 Mar 2013
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 Comments
More Answers (0)
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!