I was trying to go through this tutorial på OpenCV.org:
http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html#backgroun
Accordingly to the previous answer the background subtractor can be also defined as:
BackgroundSubtractorMOG MOG;
instead of:
Ptr pMOG;
pMOG= new BackgroundSubtractorMOG(); //MOG approach
that would also require to delete pMOG when it is not used anymore, furthermore functor can be used to update foreground mask in a bit smarter way:
MOG(newFrame, foregroundMask);
insted of:
pMOG->operator()(frame, fgMaskMOG);
The default assumption of openCV is that the background is quite constant and does not need any update, so, after the learning initial phase the Mixture of Gaussians is not changed any more. A detailed and clear description can be also be found here:
http://hal.archives-ouvertes.fr/docs/00/33/82/06/PDF/RPCS_2008.pdf