averaging many images for every pixel - recursively.

4 Ansichten (letzte 30 Tage)
Jason
Jason am 31 Mai 2016
Beantwortet: Walter Roberson am 31 Mai 2016
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 31 Mai 2016
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;

Weitere Antworten (1)

Ahmed Rashid
Ahmed Rashid am 31 Mai 2016
Bearbeitet: Ahmed Rashid am 31 Mai 2016
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.

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by