Photobooth-style background subtraction / difference matte
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.
|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…
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.
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!
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.
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1787.3oc6ZszaiaCD9ryuhAFKPaA75JR8tGJRuUzS8dwh.YIZYtQRTkR1IaW r+2KeHaqjH6PKaI6Vr4frnLkyvuYlu4A4WuaxzErmIUSgeA9KXxjud2jIpGI evjlwSllG8bbVTkZZSWlwJVmOcl9qp4zp3nLh7qrlG17TZhZprEe9insybIq ntHJWMyo+NIaColFGs8aYqqyH00eojnkE4+ln5oyfoKhJRmBepYdkQ0wqnEo OvIw05o5E5O2ZFf7PxOrcUCDW28NqVjFyxXb8zsje+9KnVS7UyKvS7m+rNuq 8qspl7b8KeSeK2ffYcdW62ThIUz+QslCERi9oB3kVHPCEdi1+PMFodJV9vuc 2cxKyLTwkSpphRI6zbBgV8bdTMA9vN8TKcGtm5NiTWAX4GNpqH6SCTvcBJnK InPhR5.QrGDDwyqEhfCttHxI5e6L7921+Oy+Vn1n4BHVAotCqSeMKMMizgkr 6A0Lzh5iqOrraoOPuUeXvRoOFlEjmDB9a7TyI0bFf6XI50SSy22hrAABTHfi yaPfQ0g8.3xmo0y+6544rMTBXis.riUGfjeOAIwO+C4QB5gmkNwl.WXr1fwp W30kyk3H3UTV4pnEYjht39CFdjxQ6Mg8Tw.7BubFV8AnjHR4SzhD1Sc.GgGN X26uLUl.3PU.OgsoZjiUqEZBord0h0KWRTjtWOShxn3Gg6E+9OHU4P7pHdFs KBUj03YefzILXi5iAhyX.a5EzwfKzH.W15bobT7OAAWWdmXVdNQDa80vU8JZ EjGU8HDyVmk.KH.Muj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