Photobooth-style background subtraction / difference matte

May 1, 2009 at 12:13am

Photobooth-style background subtraction / difference matte

Hi all,

I’ve been pouring over the forums for answers to get the kind of background subtraction I’m talking about, but to no avail. Photobooth does a pretty great job of subtracting the background from your video once taking a clean sample, and I’d like to replicate that same functionality in Max.

I’m building a live installation that’ll comp people that are in front of a green screen into historical footage at a party. Now, of course chromakey seems like the best choice here, but it’s not going to be a perfect green screen, so a difference matte seemed like a good compromise in imperfect conditions. It will be shadowless and the lighting will be controlled, and the camera firmly mounted, but I’m sure it won’t be a perfect clean green. Any ideas? The jit.op @op absdiff thing doesn’t really do what I want, because it’s still sort of compositing over the background rather than just replacing it with an alpha channel.

Thanks all,
Charlie

#43610
May 1, 2009 at 3:11am
mrquint15 wrote on Thu, 30 April 2009 19:13
I’m building a live installation that’ll comp people that are in front of a green screen into historical footage at a party. Now, of course chromakey seems like the best choice here, but it’s not going to be a perfect green screen, so a difference matte seemed like a good compromise in imperfect conditions. It will be shadowless and the lighting will be controlled, and the camera firmly mounted, but I’m sure it won’t be a perfect clean green.

I don’t know about the background subtraction, that does work pretty well with Photo Booth, and I’m sure it could be done in Jitter somehow. I think the green screen should be totally adequate with chromakey though, I used blue light from a projector with some videos and while it wasn’t perfect, it was surprisingly good. Your setup sounds cleaner than that, so I’d just try it out and see how it works, play with the tol $1 etc. params. There are undoubtedly some edge filtering techniques you could use on the figures to smooth things too, as that’s where the effect is most noticeable. Sorry I don’t have specific hints, but someone on here probably will…

#156483
May 1, 2009 at 11:32am

use absdif or – with a matrixset containing one still image of the background that should be taken when the patch starts up, make sure everyone is out of the view of camera. then get a threshold of anything that is brighter then a certain ammount, and then filter that white to smooth it out and use it as a luma matte on the original input, this will take anything that is different from the image that was taken of the enpty backtround and allow only that to be seen. U can use jit.pack to pack in the alpha.

IF you have a green screen, I think its gonna be much better to just chromakey though. This mentioned solution is im pretty sure what apple did with photobooth but I hav enever been impressed with the quality of what comes out of photobooth keys, they always seem to have at least a bit of garble.

#156484
May 4, 2009 at 12:47am

Thanks for your responses,

I’ve gotten pretty good results in the initial tests here. Once I get a difference key that I’m happy with, I’ll post the results up here. If I can get something looking good with just a chromakey, certainly I’ll do that first!

Thanks again,
Charlie

#156485
Apr 4, 2010 at 4:32am

Axion-Crux’s answer seems to be what I needed. Is there any sample patch? I am really new to MAX and I am not a programer. Thanks a lot.

#156486
Apr 5, 2010 at 4:59pm

This patch might help. It’s something that JKC cooked up awhile back, that does a crude sort of background subtraction. If you haven’t already, you should check out the article here: http://cycling74.com/2009/10/26/making-connections-camera-data/
That gives some different techniques for creating a mask using differencing. A proper greenscreen setup will be MUCH more successful than any background-subtraction technique. Remember that the key to keying is proper lighting. Hot lights on the foreground, cold lights in the background.

– Pasted Max Patch, click to expand. –
#156487

You must be logged in to reply to this topic.