averaging many images for every pixel - recursively.

4 visualizaciones (últimos 30 días)
Jason
Jason el 31 de Mayo de 2016
Respondida: Walter Roberson el 31 de Mayo de 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

Respuesta aceptada

Walter Roberson
Walter Roberson el 31 de Mayo de 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;

Más respuestas (1)

Ahmed Rashid
Ahmed Rashid el 31 de Mayo de 2016
Editada: Ahmed Rashid el 31 de Mayo de 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.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by