Paper:

Z. Yin and R. Collins, "Shape Constrained Figure-Ground Segmentation and Tracking," IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2009 [PDF]

Demo videos (click images for videos):

Human gait shape learning:

Human body segmentation:

       

Video editing by replacing foreground: