how to divide the RGB color space into 64 cubic blocks ?
3 次查看(过去 30 天)
显示 更早的评论
Hello
can any one tell me how to to divide the RGB color space into 64 cubic blocks with four equal partitions along each dimension.
2 个评论
John D'Errico
2013-12-27
编辑:John D'Errico
2013-12-27
How? You do it. Whats the problem? All that matters is what you will do with it, and only you know that.
采纳的回答
Image Analyst
2013-12-27
编辑:Image Analyst
2013-12-27
Like John said, it depends on what you will do with it - how you will use it. If you want to make a histogram, you need to find out what block you're in
for col = 1 : cols
for row = 1 : rows
% Get the RGB values of the image.
rValue = rgbImage(row, col, 1);
gValue = rgbImage(row, col, 2);
bValue = rgbImage(row, col, 3);
% Find out which of the 64 blocks they belong to.
% Block numbers range from 1 to 4.
rBlock = ceil(rValue / 64);
gBlock = ceil(gValue / 64);
bBlock = ceil(bValue / 64);
% Increment the histogram.
rgbHist(rBlock, gBlock, bBlock) = rgbHist(rBlock, gBlock, bBlock) + 1;
end
end
Also see attached file.
5 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!