I want to take some portrait shots and then replace the background. I don't have a green screen or anything I can use for chroma keying, so I had this idea that I could take a picture of a background, and then take another picture with people in front of it, and then separate the people from the background by doing a "difference" on the two pictures to create the mask.

Both pictures were taken from exactly the same position (using a tripod and a remote shutter release), so that isn't a problem. The problem is that despite having identical exposures, the lighting of the background is slightly different, so when I take the difference there is a lot of values in the range of 0-15 (on a 0-255 scale) making it impossible for Threshold to determine the mask.

Is there another technique I can use, or am I barking up the wrong tree here?

  • What sort of quality are you hoping to achieve? – JohnB Dec 23 '12 at 13:20
  • Good enough to make decent sized prints, e.g. 8x10 – Michael Dec 23 '12 at 21:16

The obvious suggestion would be to reshoot with a better background. Back when I had to do something like that, I found a plain green bed sheet to work just fine.

However, if you have to work with the shots you've got, one thing you could try would be taking the difference of the two shots (preferably using the "grain extract" layer mode) and using the magic wand tool to select the background. Then add the selection as a layer mask on the original image and, if necessary, hand-edit the mask until it looks good enough.

Also, it may help to apply selective gaussian blur to the two shots before merging them in order to get rid of noise but still retain sharp edges. Remember to use the same blur parameters for both images.

  • Thanks, I'll try that. I have just been shooting test sets, so I can definitely reshoot as much as needed. At some point I may see if I can pick up a green sheet. – Michael Dec 23 '12 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.