A mixture of the Gaussians method will not solve all your problems. A common problem is sensitivity to lighting conditions, for example. attaching a shadow to the selected foreground object. If the image scenario (background) is approximately the same, you can refine the results with some image processing.
If the background looks like the one in the attached image, try building a color histogram in the HSI space, create an image of the extracted foreground object (not a mask, the actual color image) and remove pixels that are similar to the floor (a color known from skin detection methods). This way you can remove some shadows attached to the person / objects.
In addition, if real-time processing is not critical in your application, you can use more sophisticated background / foreground detection, such as SubSENSE .
source share