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
댓글 수: 0
채택된 답변
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;
댓글 수: 0
추가 답변 (1개)
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!