Dear as in obove code division is n't correct .. follow this code
let say your image is I of 256 x 256. Make your your grid which is 4 x 4 this time should divide image dimensions.
if size(I,3)>1, I = rgb2gray(I); end
I = imresize(I, [256 256]);
img_blocks = mat2cell(I,size(I,1)/4*ones(1,4), size(I,2)/4*ones(1,4));
Then you get img_blocks of size 4x4. For first block you can get
Best Answer