# Image statistics from a pixel perspective?

Sometimes algorithms talk about the mean or variance of a region of an image. But what do they mean? To obtain a better perspective, it’s best to actually explore some images. Consider the following image in Fig.1.

Fig 1: The original image

We have extracted four 200×200 regions from the image, shown in Fig.2.

Fig.2: Different image regions

Statistics are given at the end of the post. Region B represents a part of the background sky. Region A is the same region processed using a median filter to smooth out discontinuities. In comparing region A and B, they both have similar means: 214.3 and 212.37 respectively. Yet their appearance is different – one is uniform, and the other seems to contain some variance, something we might attribute to noise in some circumstances. The variance of A is 2.65, versus 70.57 for B. Variance is a poor descriptive statistic, because it is hard to visualize, so many times it is converted to standard deviation (SD), which is just the square root of variance. For A and B, this is 1.63 and 8.4 respectively.

As shown in region C and D, more complex scenes introduce an increased variance, and SD. The variances can be associated with the distribution of the histograms shown below.

Fig 3: Comparison of histograms

When comparing two regions, a lower variance (or in reality a lower SD) usually implies a more uniform region of pixels. Generally, mean and variance are not good estimators for image because two totally different images can have same mean, and variance.

Image A

Mean = 214.3
Variance = 2.65
SD = 1.63

Image B
Mean = 212.37
Variance = 70.57
SD = 8.4

Image C
Mean = 87.22
Variance = 4463.11
SD = 66.81

Image D
Mean = 56.33
Variance = 2115.24
SD = 46.0