processing several images blocks

1 view (last 30 days)
Rusmaya Luthfina
Rusmaya Luthfina on 26 Oct 2011
hi all,
i have 10 jpg image with same size 320x320, i've divided each image into 4x4 block. i need to access each block but it's failed. here's the codes
folder = 'F:\Maya\pengenalan pola\tugas image retrieve\image';
fileList = dir(fullfile(folder,'*.jpg'));
for i = 1:length(fileList)
I{i} = imread(fullfile(folder,fileList(i).name));
out{i} = mat2cell(I{i},ones(320/80,1)*80,ones(320/80,1)*80,3);
end
imshow(out{1, 1, 1})
it returns error ??? Error using ==> iptcheckinput Function IMAGEDISPLAYVALIDATEPARAMS expected its first input, I, to be one of these types:
double, single, uint8, uint16, uint32, int8, int16, int32, logical
Instead its type was cell.
Error in ==> imageDisplayValidateParams at 12 iptcheckinput(common_args.CData, {'numeric','logical'},...
Error in ==> imageDisplayParseInputs at 79 common_args = imageDisplayValidateParams(common_args);
Error in ==> imshow at 199 [common_args,specific_args] = ...
but when i load only a single file like this
j = imread('Milk.jpg');
out = mat2cell(j,ones(320/80,1)*80,ones(320/80,1)*80,3);
imshow(out{1, 1})
it's just run correctly like what i need, returns image block(1,1)
really need you helps
thank you,
Maya

Answers (2)

Walter Roberson
Walter Roberson on 26 Oct 2011
Note that out{1,1,1} is the same as out{1}, which is not the same as out{1}{1,1}
  1 Comment
Rusmaya Luthfina
Rusmaya Luthfina on 26 Oct 2011
i got it Mr. Roberson, thx u.. i change it to imshow(out{1}{n}), where n is the block, and it works,
my i ask u a question??
is sit possible to perform RGB histogram to each blocks of each picture?
how do we do that?
thanks,
maya

Sign in to comment.


Rusmaya Luthfina
Rusmaya Luthfina on 26 Oct 2011
my images are RGB, can we perform RGB histogram to each block of each image?

Community Treasure Hunt

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

Start Hunting!