# How the reference image is updated in Differencing

The Differencing method uses a Gaussian distribution of all pixels in a frame. EthoVision XT keeps a running average of the mean m and the variance s2 of the gray value of each pixel to detect unlikely pixels. These pixels are considered to be the subject.

The mean of the gray values is summed up according to the same formula as for Dynamic subtraction.

The variance of the gray values is summed up according to the following formula:

Variancei,n = (1-a) * Variancei,n-1 + a * (Currenti,n. Referencei,n)2

for each pixel i, where:

▪Variancei,n = Variance of gray scale value of pixel i in the reference image of sample n.

▪Currenti,n = Mean gray scale value of pixel i in sample n where a square area around the subject previously detected has been removed.

▪Referencei,n-1 = Mean gray scale value of pixel i in the reference image of sample n–1.

▪a = Frame weight, which depends on the Background changes option. The higher the value set (from Very slow to Very fast), the higher a.

The Frame weight determines the relative weight of the two components of the new reference image (see the example in How the reference image is updated in Dynamic subtraction).