i've 16x16 blocks of the input image and an array of mean values. i want to extract a particular block having same mean value

조회 수: 1 (최근 30일)
how can i extract the particular blocks having same mean values from all 256 blocks...
the code i wrote is:
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(16,16, blockNumber);
imshow(oneBlock);
Mean(blockNumber) = mean2(oneBlock);
caption=sprintf('\n\nThe mean for block #%d = %f', blockNumber, Mean(blockNumber));
disp(caption);
blockNumber = blockNumber + 1;
end
end
disp('sorted mean values are:');
[S,blockNumber]=sort(Mean);
fprintf('\nBlock #%d = %f\n', [blockNumber(:), S(:)].' );
i want to make a condition so that only those blocks are shown whose Mean value is same.like block 3 and block 34 have mean value 34.56 then only these blocks are shown. rest other blocks are not shown...
plz modify my above code as per my requirement...
reply as soon as ....
  댓글 수: 4
angel
angel 2013년 3월 11일
편집: Walter Roberson 2013년 3월 11일
i m working on gray scale image sir
1) this is my original image:
2) image is divided into 16x16 blocks
3) i want that those blocks like u said if block 3 and 34 match, 10 and 19 match, and 13 and 42 match, i want that color the pixels of block 3 and 34 with let say red color
color the pixel of block 10 and 19 with different color(baby pink) than red color
color the pixel of block 13 and 42 with different color than baby pink and red and so on...
like in the following image all the blocks are colored with winter color
i want in the image of 16x16 blocks where there is a blocks of same mean value like block 3 and 34 color it with one color(red),block 10 and 19 with different color and so on...rest of the blocks which dont have same mean values remain the same.....
if coloring of blocks is not possible than suggest me some other way to do so..
in my project i want to these blocks visually that the blocks with matching color are duplicated blocks ...
plz reply soon as i've tries alot but unable to do...
also u can run my code with the given original image

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 3월 12일
It is not possible. There are no solutions to your requirements.
  댓글 수: 3

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by