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
Show older comments
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 Comments
Image Analyst
on 10 Mar 2013
Edited: Image Analyst
on 10 Mar 2013
What if there are 15 pairs of matrices that have matching means? Like blocks 3 and 34 match, 10 and 19 match, and 13 and 42 match, all in the same image. Actually it's somewhat unlikely that any blocks will have exactly the same mean, unless you allow some tolerance in defining a "match".
Walter Roberson
on 10 Mar 2013
You want the blocks to be shown as individual plots? Or you want the image as a whole shown but with the other blocks empty?
angel
on 11 Mar 2013
Edited: Walter Roberson
on 11 Mar 2013
angel
on 12 Mar 2013
Answers (1)
Walter Roberson
on 12 Mar 2013
0 votes
It is not possible. There are no solutions to your requirements.
Categories
Find more on Neighborhood and Block Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!