A computer-implemented method of determining whether pixel positions in an image frame of a video sequence belong to a background or a foreground of a captured scene, the method comprising, for each pixel position in the image frame: receiving a class into which the pixel position has been classified, the class representing a category of content in the captured scene at the pixel position, associating the pixel position with a level of dynamics of its corresponding class, wherein the level of dynamics of a class reflects a probability that pixel values at pixel positions belonging to the class will change values between frames of the video sequence, determining if the pixel position in the image frame belongs to the background or the foreground of the captured scene by comparing the pixel value of the pixel position in the image frame to a background model and a threshold value for the pixel position, the background model including one or more values representing the pixel value of the pixel position, wherein the pixel position is determined to belong to the background if a difference between the pixel value and a first predetermined number of values among the one or more values in the background model is less than the threshold value for the pixel position, if the pixel position in the image frame is determined to belong to the background: increasing the threshold value specific to the pixel position by an increment if the pixel value at the pixel position in the image frame has changed by more than a second value since a previous frame, wherein the increment is set to depend on the level of dynamics of the pixel position such that a higher level of dynamics results in a higher increment. receiving a class into which the pixel position has been classified, the class representing a category of content in the captured scene at the pixel position, associating the pixel position with a level of dynamics of its corresponding class, wherein the level of dynamics of a class reflects a probability that pixel values at pixel positions belonging to the class will change values between frames of the video sequence, determining if the pixel position in the image frame belongs to the background or the foreground of the captured scene by comparing the pixel value of the pixel position in the image frame to a background model and a threshold value for the pixel position, the background model including one or more values representing the pixel value of the pixel position, wherein the pixel position is determined to belong to the background if a difference between the pixel value and a first predetermined number of values among the one or more values in the background model is less than the threshold value for the pixel position, if the pixel position in the image frame is determined to belong to the background: increasing the threshold value specific to the pixel position by an increment if the pixel value at the pixel position in the image frame has changed by more than a second value since a previous frame, wherein the increment is set to depend on the level of dynamics of the pixel position such that a higher level of dynamics results in a higher increment.