names={'ima11.jpg','ima12.jpg','ima21.jpg','ima22.jpg','ima31.jpg','ima32.jpg','ima41.jpg','ima42.jpg','ima51.jpg','ima52.jpg','ima61.jpg','ima62.jpg'};
%find no of images
imageno=numel(names);

%read first image to initialise imstack and imdat
imdat=double(imread('ima11.jpg'));
imstack=cat(3,imdat);

%add all the remaining images to the stack
for x=2:imageno
   imdat=double(imread(char(names(x))));
   imstack=cat(3,imstack,imdat);
end

avg= mean(imstack,3);

figure;
imshow(avg,[]);
