Specifying different colour for each block
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Image Analyst
2012년 12월 6일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Red에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!