Reputation: 19
I have a set of images and I want to calculate mean of these images in Matlab and then subtract the mean from all images.Then, plot the distribution of images through hist function in Matlab.
Thanks
Upvotes: 0
Views: 4386
Reputation: 2333
I suppose images are in the same size, if you have for example 3 images the following code would do what you what:
images = image1 + image + image3;
meanOfImages = images ./ 3;
image1 = image1 - meanOfImages;
image2 = image2 - meanOfImages;
image3 = image3 - meanOfImages;
The idea is to sum all the images then divide the resulting matrix element-wise by number of images and that would be the mean of them, then subtract this matrix from each image matrix.
Upvotes: 1