Specifying different colour for each block
1 view (last 30 days)
Show older comments
I got the below coding from demo in one site where the image is divided into blocks..
clc;
close all;
rgbImage = imread('im9.bmp')
rgbImage=imresize(rgbImage,[256 256]);
imshow(rgbImage);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
drawnow;
[rows columns numberOfColorBands] = size(rgbImage)
blockSizeR = 64;
blockSizeC = 64;
wholeBlockRows = floor(rows / blockSizeR);
blockVectorR = [blockSizeR * ones(1, wholeBlockRows), rem(rows, blockSizeR)];
wholeBlockCols = floor(columns / blockSizeC);
blockVectorC = [blockSizeC * ones(1, wholeBlockCols), rem(columns, blockSizeC)];
if numberOfColorBands > 1
ca = mat2cell(rgbImage, blockVectorR, blockVectorC, numberOfColorBands);
else
ca = mat2cell(rgbImage, blockVectorR, blockVectorC);
end
plotIndex = 1;
numPlotsR = size(ca, 1);
numPlotsC = size(ca, 2);
for r = 1 : numPlotsR
for c = 1 : numPlotsC
subplot(numPlotsR, numPlotsC, plotIndex);
rgbBlock = ca{r,c};
imshow(rgbBlock);
[rowsB columnsB numberOfColorBandsB] = size(rgbBlock);
plotIndex = plotIndex + 1;
end
end
I have 16 blocks as shown in link
http://imgur.com/xmT3Q
now in this some blocks may have same mean value,i have to give same colours for blocks having same mean value,and other colours for other blocks,please help
0 Comments
Answers (1)
Image Analyst
on 6 Dec 2012
I don't know what mean value i means in regard to a color image. Please explain. Also, you should know by now how to format your question into code and non-code parts, and to make links to web sites.
See Also
Categories
Find more on Red 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!