I've got a set of pictures of a group of people that were taken on a tripod. Some of the people moved between pictures, and I want to extract a common background so I can combine the backgrounds to reduce noise, and clone people between pictures so that each person's best shot is shown in a common picture. However, I'm having some trouble figuring out how to do this.
My first thought was to compare pairs of images and subtract them from each other, then find a threshold value to create a black/white mask I can multiply each image against. However, for people who didn't move very much, there is just enough similarity that they wind up partially in the mask. There is also the problem that noise and exposure variations between images result in there being a difference between backgrounds which sometimes exceeds any reasonable threshold.
Is there some approach I am missing to extract a background when I have a set of pictures with the same background but differences in foreground objects, i.e. people? I have tagged this question as background removal, but what I really want to do is the opposite.