In this paper, we propose a level set based energy functional, the minimization of which results in simultaneous background modeling, foreground segmentation, and contour smoothing. The simultaneous dealing of background modeling and foreground segmentation has the effect that the two processes constrain each other positively, such that a good estimate of the background can be obtained with a small number of frames, and a temporal change in the scene is reflected quickly in the construction of the background image. Furthermore, the simultaneous level set based contour smoothing eliminates spurious regions, and smooths the contour that encompasses the object, so that a good representation for the boundary of the object is obtained. The level set based approach makes it possible to derive a level set based Euler-Lagrangian equation, which can be directly implemented and works in real-time.