I am dividing images into blocks using mat2cell then i want to convert each block from cell array to a numeric array to make histogram for every block.
I need to make it in a for loop.
so what do you think?
here is my code:
nb(1) = ceil(256/ b(1)); % number of blocks in each dimension
nb(2) = ceil(384/ b(2)); % number of blocks in each dimension C=mat2cell(images,ones(256/ b(1),1)*b(1),ones(384/ b(2),1)*b(2),3);% dividing the Image into blocks.
%C1=mat2cell(images,repmat(b(1),1,nb(1)), repmat(b(2),1,nb(2)),3);
m=1; while (m < ((nb(1)*nb(2))+1)) for i=1:nb(1)%256
for j=1:nb(2)%384
[counts(i,j), x(i,j)] = imhist(C{i,j});%error
end end end endend
it gave me these errors:
??? Error using ==> iptcheckinput Function IMHIST expected its first input, I or X, to be two-dimensional.
Error in ==> imhist>parse_inputs at 281 iptcheckinput(a, {'double','uint8','int8','logical','uint16','int16','single','uint32', 'int32'}, …
Error in ==> imhist at 59 [a, n, isScaled, top, map] = parse_inputs(varargin{:});
Error in ==> fll1 at 26 [counts(i,j), x(i,j)] = imhist(C{i,j});
Best Answer