setting the colors for blocks

i've a grayscale image and i've divided into non-overlapping blocks.
i want to color/mark the blocks having same mean value.
can anyone tell me how to do so.. as i m novice to matlab...
if required tell me as soon as possible i can provide you my code.

 Réponse acceptée

Walter Roberson
Walter Roberson le 8 Mar 2013

0 votes

Take the matrix of mean values, and imagesc() it.

6 commentaires

sir i've sorted the mean values in the array and when m applying the imagesc() it shows the same image as x n y axis...
like i've an image having block size 8x8...all the blocks have different or same mean value right. now i want to color/mark only those blocks which have same mean values in order to recognize it..
can u help me sir..
i have used the subplot function
subplot(8,8,oneBlock);
where oneBlock is an 8x8 block...
also oneblock=(row1:row2,col1:col2);
subplot() is to create axes, not to plot anything.
If your unsorted array of mean values is (say) "meanvalues" then
imagesc(meanvalues)
angel
angel le 9 Mar 2013
Modifié(e) : Walter Roberson le 9 Mar 2013
imagesc(meanValues) shows blocks in bar form..i do not want this..
i want those block having same mean values to color the pixel some color for example block 2 and block 5 have mean value 50.6 i want color the pixel of both the block with RED
also if block 5 and block 16 have mean value 34.5 then color the pixel of these block with let say GREEN
can u tell me how to do?
imagesc(meanValues) does not show the blocks in bar form -- not unless you have meanValues as a vector instead of an array.
Follow this example:
fun = @(block_struct) ...
std2(block_struct.data) * ones(size(block_struct.data));
I2 = blockproc('moon.tif',[32 32],fun);
imagesc(I2);
colormap(flag);
angel
angel le 9 Mar 2013
meanValue is array in my code...
u mean i've to convert it into vector form first right?
then apply imagesc(meanValue);
is it this u r saying??
Walter Roberson
Walter Roberson le 9 Mar 2013
No, it needs to be an array.
I suggest you upload an image of the result of imagesc(meanValues)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by