how to average 5 RGB images ?
Show older comments
a,b,c,d,e --------------- 5 rgb image matrix.
sum = a+b+c+d+e;
average = sum./5;
average image has same dimension as a,b,c,d,e.
2 Comments
Laurent
on 21 Aug 2013
Hi, what is exactly the problem? If you average 5 images, it is to be expected that the resulting average image has the same dimensions as your original images.
One more thing, using sum as variable name can be confusing, since it is also a Matlab function.
mahendra
on 21 Aug 2013
Answers (1)
Image Analyst
on 21 Aug 2013
You must cast them to single or double before adding so you don't clip at 255. Then divide by 5;
meanRGB = (double(image1) + double(image2) + double(image3) + double(image4) + double(image5)) / 5;
Cast back to uint8 if you want to display it or save it.
Categories
Find more on Watermarking in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!