Detecting moving objects, ghosts, and shadows in video streams