The video surveillance systems are widely used today, but it is essential to implement systems that automatically analyze the information captured, with the objective of identifying regular events that may occur in the scene. This work focuses on the estimation of the background and foreground segmentation in a surveillance video. The main contribution is the median filter applied recursively on a temporary popup window, which provides more robustness against noise caused by illumination changes and vibrations in the camera, this without increasing the computational cost.