Automatic RGB grid capture
Show older comments
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.
Answers (1)
Image Analyst
on 5 Sep 2012
Edited: Image Analyst
on 5 Sep 2012
Perhaps you want im2html:
http://blogs.mathworks.com/steve/2012/06/02/making-an-html-table-of-pixel-values-with-colored-cells/
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, :);
Categories
Find more on Color Segmentation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!