background subtract

Most likely a much easier way to do this, but this more or less works :stuck_out_tongue:
with grateful use of the evil slider!
jl_bgSubtract.tox (3.35 KB)

1 Like

It’s not working for me and I’m not sure what it’s supposed to do, and what kind of thing to hook up to it. sorry.

ah woops, my bad
its for those situations when you’re trying to key something out with nothing good to key so you need to do a background subtract

you take a snapshot image of the background with no one in it and feed that into image in to backgroundIn
and then you put your live feed into imageIn and it’ll subtract out the background leaving the subject.
There is always noise and other variables in the signal which prevent it working properly so threshold and softness will help get a better key
Defringing helps smooth out outlines
I’m certain this is better implemented in a single GLSL, but I haven’t been able to get my head around that.

Course if the scene you are trying to key is highly variable this isn’t worth a rusty nickle.
jl_bgSubtract.tox (4.04 KB)
bgSubtract.toe (5 KB)

1 Like

I don’t think that’s true. You can do all the math operations you need for this with TOPs and CHOPs. I would use a GLSL only if I really wanted to optimize it, which is usually not necessary.

Anyway, attached is a mod that does these things diferently:

It is a .tox that doesn’t need any inputs attached - by default there is a Video In TOP inside, so your laptop webcam can act as your video signal. But if you attached another video/movie source, it will use that.

The second input is your video source with your subject removed, but it has a default too. If you press “Sample Video” it will sample (with a Cache TOP) the video camera or any signal you have connected to the first input.

The third input is any image you want to act as your new background.

Inside the network it is a bit different. After the Difference I convert to Mono, then after your luminance key, I high-contrast it further with a Level TOP. Then I use a Matte TOP to combine all three images (keyed foreground, new background, matte).

I’m not sure what your Trail etc in the buttons do, I left as-is.

BONUS EFFECT: If you press Sample Video with your head in the camera view, you will disappear until you move your head away - the Come-From-Nowhere effect as it’s known in the biz.
gh_bgSubtract.9.tox (4.22 KB)

1 Like

BONUS EFFECT: If you press Sample Video with your head in the camera view, you will disappear until you move your head away - the Come-From-Nowhere effect as it’s known in the biz.

Ho dear Greg, all these ninjas are going to get you for revealing their secret now!

rod.

Hey there, This is a very interesting shared .tox, and even though its from ancient history i find it very useful. I handshake sir @elburz on this post as perhaps to take a look and in the new year 23 :wink: suggest an updated way to implement this technique. As a Mac user (no nvidia board) for background subtraction) i am doing transparency - superimposition kinda analogue style onto geometries in a room environment, (no Kinect) thx much