Average of 10 images

136 views (last 30 days)
Soum on 14 Jul 2013
Commented: Walter Roberson on 21 Nov 2018
I read a series of images and I want to calculate their average I've written
this code :
for i=1:10
am I right ? knowing that it gives a result

Answers (1)

Image Analyst
Image Analyst on 14 Jul 2013
No, it's not. For one thing, don't use image as the name of a variable since it's the name of a built-in function. And no reason to store them all and use a cell array.
I0 = imread('0.1s_1.tif')
sumImage = double(I0); % Inialize to first image.
for i=2:10 % Read in remaining images.
rgbImage = imread(['0.1s_',num2str(i),'.tif']));
sumImage = sumImage + double(rgbImage);
meanImage = sumImage / 10;
Walter Roberson
Walter Roberson on 21 Nov 2018
You need a base image such aas the first in the series . Then after every imread you would register the new image against the base image and add in the aligned version of the new image .

Sign in to comment.


Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!