MATLAB Answers

0

Getting image dimensions into a table

Asked by Venus Dandan on 16 Jul 2019
Latest activity Commented on by Venus Dandan on 16 Jul 2019
Accepted Answer by KSSV
I have a code here:
%% Get the dimensions of the image
Namelist = cell(length(filelist), 1);
for i = 1:length(filelist)
imagename = filelist(i).name;
Namelist{i, 1} = filelist(i).name;
I = imread ([newimagepath, '/', imagename]);
[y x z] = size(I);
T = table(x, y, z)
end
I have let's say 100 images (I), how can I have the (x, y, z) for each image be put into the table? Currently, when I run the code, the table ends up being 1 row, with the x, y, z values for the last image in the loop.
Thank you in advance!!

  0 Comments

Sign in to comment.

1 Answer

Answer by KSSV
on 16 Jul 2019
 Accepted Answer

%% Get the dimensions of the image
Namelist = cell(length(filelist), 1);
N = length(filelist) ;
S = zeros(N,3) ;
for i = 1:N
imagename = filelist(i).name;
Namelist{i, 1} = filelist(i).name;
I = imread ([newimagepath, '/', imagename]);
S(i,:) = size(I) ;
end
x = S(:,1) ; y = S(:,2) ; z = S(:,3) ;
T = table(x,y,z)

  1 Comment

Thank you so much!!!

Sign in to comment.