1. A method for determining a background image for a sequence of image frames, the method comprising: performing the following on a computer: receiving a sequence of input image-frames, wherein an input image-frame associates pixels with pixel-attributes; computing a labeling, wherein the labeling associates pixels in the background image with input image-frames in the sequence of input image-frames, and wherein said computing comprises formulating a labeling problem and determining a solution for the labeling problem, wherein the labeling problem comprises a cost function; and determining the background image using the sequence of input image-frames and the labeling.