MATLAB Answers

0

Average of 10 images

Soum 님이 질문을 제출함. 14 Jul 2013
최근 활동 lateef oparemi 님이 답변함. 6 Jun 2019
Hi;
I read a series of images and I want to calculate their average I've written
this code :
I=zeros(size(Io))
for i=1:10
image{i}=im2double(imread(['0.1s_',num2str(i),'.tif']));
I=I+image{i}
end;
I=I./10;
am I right ? knowing that it gives a result

  댓글 수: 0

로그인 to comment.

답변 수: 2

Answer by 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);
end;
meanImage = sumImage / 10;

  댓글 수: 4

표시 이전 댓글 수: 1
Image Analyst
on 13 Sep 2017
The images must be in slightly different positions, despite you thinking they aren't. The way around it is to call imregister() to align the images before summing.
CS
on 21 Nov 2018
and how can we do that? put imregister() before the imread?
By the way i was trying to find moving object so i thought of finding the background and then subtract, do you know a better way to do that?
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 .

로그인 to comment.


Answer by lateef oparemi on 6 Jun 2019

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);
end;
meanImage = sumImage / 10;

  댓글 수: 0

로그인 to comment.



Translated by