Reading an Image after using load command

1 visualización (últimos 30 días)
kash
kash el 1 de Oct. de 2012
i have a code of 10 images,
pathname ='D:\Imagebrain\' ;
dirlist = dir( [pathname '*.jpg'] );
pickind='jpg';
X=zeros(256,256,10)
for x = 1:length(dirlist)
i = imread([pathname, dirlist(x).name]);
A=i;
X(:,:,x)=A;
save X
end
load X
now after load command please tell hoe to read images one by one
  2 comentarios
Image Analyst
Image Analyst el 1 de Oct. de 2012
No need to overwrite the imaginary variable i. Just use A directly:
A = imread([pathname, dirlist(x).name]);
Also no need for save() (at least not inside the loop) and load(). Why are you making a 3D image anyway, rather than just processing them one 2D image at a time?
kash
kash el 3 de Oct. de 2012
Thanks Image Analyst

Iniciar sesión para comentar.

Respuesta aceptada

Matt Tearle
Matt Tearle el 1 de Oct. de 2012
The same way you saved them:
for k = 1:10
A = X(:,:,k);
% do something with A
end
(Also, move the save command out of the loop -- it's just wasting time to save the data on every iteration.)

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by