Automatic RGB grid capture

3 次查看(过去 30 天)
asd
asd 2012-9-5
Hi all,
I have a question i have made this code that captures rgb from a image, you can click more or less to get a RGB value :
pixel=impixel(picture);
column = num2cell(pixel,1);
zcolumn = cellfun(@sum,column);
zrow = size(pixel,1);
res = bsxfun(@rdivide,zcolumn,zrow);
tres=round(res);
close all;
I need to put this in a table but every time i need to go thro all of the code to get one RGB value(tres).
I am interested is there a way to create a grid(10X10px boxes) over an image ( allways white background and lets say orange in the middle) and automatically get RGB values for each of that box. That it does not take in a count of any boxes that have, lets say more then 20% white space in a box.

回答(1 个)

Image Analyst
Image Analyst 2012-9-5
编辑:Image Analyst 2012-9-5
Perhaps you want im2html:
or this:
row = 123; % or wherever you want to start.
col = 321; % or wherever you want to start.
% Extract a 10 by 10 box there.
rgbValuesInTheBox = rgbImage(row:row+9, col:col+9, :);

Community Treasure Hunt

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

Start Hunting!

Translated by