A python code of background subtraction using GMM which is described in "Adaptive background mixture models for real-time tracking" by C. Stauffer and W.E.L. Grimson.
The code is really slow. For a real world application, one should use BackgroundSubtractor class (MOG or MOG2 function) which is a part of OpenCV library.
For useful references of the method, one can check at:
https://en.wikipedia.org/wiki/Background_subtraction
http://www.cse.psu.edu/~rtc12/CSE586Spring2010/papers/emBGsubtractAboutSandG.pdf
The result pictures are just me shaking my head in front the camera.