how to change mean and variance values in image.
Show older comments
I got the value of mean and variance as 111 and 46 for an image, I need to do mean=0, variance=0.005, how to do tat in matlab please provide me an ans for this, thanks.
1 Comment
Tamir Suliman
on 2 Dec 2016
you will have to post your code and the image if possible and explain what you trying to do
If you want to subtract a scalar (that is, a 1x1 matrix) from an array, the result is the same size as the array.
mean = sum(x)/length(x)
variance = sum((x - mean(x)).^2)/(length(x) - 1);
For example, if you generate noise from a standard normal distribution with randn(N,1), you will get N samples, and if you calculate the mean and variance, you will get approximately 0 and 1. So there as well, your variance may well be larger than the mean.
Both have a totally different meaning: the mean gives you an idea where your pixels are (i.e. are they white, black, 50% gray, ...). The mean will give you an idea of what pixel color to choose to summarize the color of the complete image. The variance gives you an idea how the pixel values are spread: e.g. if your mean pixel value is 50% gray, are most of the other pixels also 50% gray (small variance) or do you have 50 black pixels and 50 white pixels (large variance)? So you could also view it as a way to get an idea how well the mean summarizes the image (i.e. with zero variance, most of the information is captured by the mean).
image - mean(image(:))
you will have something the size of the original image. You must be subtracting one scalar from another if what you end up with is a scalar.
Accepted Answer
More Answers (0)
Categories
Find more on Detect, Extract, and Match Features in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!