Image averaging code needed
Mostra commenti meno recenti
I am trying to find the average of 2000 .bmp files(all greyscale). Kindly assist me in figuring out the right code. I have used the following code but it returned a pitch dark image and am unable to figure out the issue:
clear all
im = imread('V_cont_1.bmp');
for i = 200:2000
im = imadd(im,imread(sprintf('V_cont_%d.bmp',i)));
end
im = im/2000;
imshow(im,[]);
%imwrite(im,'V_cont_avg.bmp');
Thank you.
Risposte (1)
Adam
il 14 Set 2016
0 voti
From the help page for imadd (doc imadd):
'If X and Y are integer arrays, elements in the output that exceed the range of the integer type are truncated, and fractional values are rounded.'
You can't just keep adding together uint8 values (assuming they are unit8, but if not any integer) as they will just max out. You need to convert to single or double if you want to do that.
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!