1. A method of image processing, comprising: receiving at least one video frame of a video sequence, the at least one video frame comprising at least one foreground subject and a background; and processing the at least one video frame so as to separate the at least one foreground subject from the background, wherein the processing comprises: obtaining a reference image comprising the background, the reference image being captured without the at least one foreground subject; comparing the at least one video frame to the reference image; generating a first pixel mask as a result of the comparison, the pixel mask indicating whether a pixel of the at least one video frame belongs to the foreground subject or to the background; determining edges in the at least one video frame to generate a first edge mask; determining edges in the reference image to generate a second edge mask; comparing the first edge mask with the second edge mask to generate an edge-difference mask indicating differences between the first edge mask and the second edge mask; generating a second pixel mask by adding the edge-difference mask to the first pixel mask; modifying the second pixel mask based on the edge-difference mask; and forming a contour of the foreground object based on the modified second pixel mask and the edge-difference mask.