I need some help with RGB capture in a image. I am using impixel to manualy get RGB from a picture, but i would like to create a grid of let\'s say 20x20 px boxes where it will
Depending on your exact needs I see two solutions:
Downscale the image using impyramid(img, 'reduce'
). This gives you a smaller image consisting of average values of the original image. Then do what you did before to access single pixels. Repeat as often as necessary to get 2x2, 4x4, 8x8 or larger "boxes".
Or you could use define a box (or arbitrary shape) as a matrix of ones and zeros and use the regionprops
function in order to get information about the images content depending on the fields containing ones:
roi = zeros(size(img))
roi(1:10,1:10) = 1;
r = regionprops(roi, img, 'MeanIntensity')
average = r.MeanIntensity