MATLAB: Adding multiple images together from a for loop

image processing

I am trying to adding multiple images together into one in a for loop, but seem to only display the last image. This is what I've tried. Someone please assist me.
E = [];
for i = 1:4
str = int2str(i);
str = strcat('\',str,'.jpg');
str = strcat('C:\Users\ASUSA55V\Documents\MATLAB\images\ur3', str);
im = imread(str);
im = imresize(im,[64 70]);
E = im;
E = E+E(i);
end
imshow(E);
Thanks

Best Answer

Try this out:
E = [];
for i = 1:4
str = int2str(i);
str = strcat('\',str,'.jpg');
str = strcat('C:\Users\ASUSA55V\Documents\MATLAB\images\ur3', str);
im = imread(str);
im = imresize(im,[64 70]);
E = E + im;
end
imshow(E);
Related Question