i've divide the image into non-overlapping blocks. and after that i've calculated the GLCM MEAN... i want to color only those blocks whose GLCM MEAN are the same

1 回表示 (過去 30 日間)
i've divided the image into non-overlapping blocks
the code for the above is as follows
blockSizeR = 16;% Rows in block.
blockSizeC = 16; % Columns in block.
% Figure out the size of each block.
wholeBlockRows = floor(rows / blockSizeR);
wholeBlockCols = floor(columns / blockSizeC);
blockNumber = 1;
glcmL=[];
glcmR=[];
S=[];
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);
% Extract out the block into a single subimage.
oneBlock = grayImage(row1:row2, col1:col2);
subplot(12,16,blockNumber);
imshow(oneBlock);
glcml=0;
glcmr=0;
glcm=0;
glcm=graycomatrix(oneBlock,'NumLevels',16);
for x=1:wholeBlockRows
for y=1:wholeBlockCols
glcml=glcml+x*glcm(x,y);
glcmr=glcmr+y*glcm(x,y);
end
end
glcmL(blockNumber)=glcml;
glcmR(blockNumber)=glcmr;
caption2 = sprintf('Block #%d\n of %d', blockNumber,blocks);
title(caption2, 'FontSize', fontSize);
blockNumber = blockNumber + 1;
end
end
fprintf('\nsorted GLCM Mean values along left hand side are:\n');
[S,blockNumber]=sort(glcmL);
fprintf('\nBlock #%d = %d\n', [blockNumber(:), S(:)].' );
fprintf('\nsorted GLCM Mean values along right hand side are:\n');
[S,blockNumber]=sort(glcmR);
fprintf('\nBlock #%d = %d\n', [blockNumber(:), S(:)].' );
In the above code there are blocks having the same or nearly same GLCM MEAN values like
block 54 and block 69=1241, block 69 = 1242
block 64 and block 143 = 1193, block 96 = 1192
there are other blocks like
block 71 = 1381, block 105 = 1383, block 90 = 1387
and so on...
i want to color these type of blocks.
plz guide me to do so..

採用された回答

Walter Roberson
Walter Roberson 2013 年 3 月 8 日
If one block as GMCM mean of (say) 50, and another is 54, then because they differ by 4, you want them colored the same. Now if a third block is 58, then because it is different by only 4 from the 54, it needs to be colored the same as the 54. Which is colored the same as the 50. So now you have the 50 through 58 range all colored the same.
By induction, we can establish that all values must be colored the same, so there is nothing to do.
  16 件のコメント
Walter Roberson
Walter Roberson 2013 年 3 月 13 日
What you want to do cannot be done.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by