1 For every two consecutive frames I1,I2 do
2 A=I1-I2
3 For each pixel p in A do
4 Take 3x3 matrix around p
5 Compute the variance Mp of the matrix.
6 M(p)=Mp \\ M being the variance mask. It provides the variance of each pixel w.r.t. its surrounding environment. The variance is likely to be higher for regions containing fight scene, i:e: local motion.
7 EndFor
8 \\ M has larger intensity in areas of local motion while very less intensity for areas with global motion.
9 IM=M⊗A \\It enhances local motion and suppresses global motion.
10 EndFor