averaging many images for every pixel - recursively.

4 次查看(过去 30 天)
I have a set of 30 images. I want to be able to consider each pixel, and take an average of that pixel over the 30 images, and do this for all pixels (So to calculate the fixed pattern noise). So my end result is a matrix of average values on a pixel level. Rather than read in each image and store it, I have read I can use recursion. Im not really sure where to start for any of this.
any pointers would be greatly appreciated.
Thanks Jason

采纳的回答

Walter Roberson
Walter Roberson 2016-5-31
No, you will need to read in each of the images. You will not need to store them all: instead you could keep a running total for each pixel location, and then at the end divide by the number of images. For example,
tot = 0;
for imnumber = 1 : 20
this_file = sprintf('frame_%02d.tif', imnumber);
this_image = imread(this_file);
tot = tot + double(this_image);
end
avg = tot ./ 20;

更多回答(1 个)

Ahmed Rashid
Ahmed Rashid 2016-5-31
编辑:Ahmed Rashid 2016-5-31
X = imread('peppers.png');
nrOfImages = 30;
% assuming that you have the images in a cell array
images = cell(nrOfImages);
for i = 1:nrOfImages
images{i} = X;
end
% main code
XX = zeros([size(X), nrOfImages]);
for i = 1:30
XX(:, :, :, i) = double(images{i});
end
averageX = sum(XX, 4) / nrOfImages;
imshow(uint8(averageX))
I assumed that you have the images in a cell array.

Community Treasure Hunt

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

Start Hunting!

Translated by