processing several images blocks
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
Walter Roberson
2011-10-26
Note that out{1,1,1} is the same as out{1}, which is not the same as out{1}{1,1}
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!