arrays - how to load a stack of images on matlab -


i have 170 png images in folder. want load , store them in matrix/array/cell array, can access , modify them i'm stuck @ beginning. how can it? best structure?

assuming same size, in folder containing images:

list=dir('*.png'); % read .pngs in folder  image1=imread(list(1).name); % read first image calculate dimentions of stack imsize=size(image1)  imagestack=zeros(imsize(1),imsize(2),length(list)); % preallocate stack zeros   ii=1:length(list)      image=imread(list(ii).name     imagestack(:,:,ii)=rgb2gray(image); % copy image in each step of third dimsion of stack  end 

if need color information add dimension imagestack , forget rgb2gray(). hope helps!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -