Starting with vvvv for a Kinect2 project - need some advice

Thanks,

I’ll try to collect that infos and send a ZIP file! Stay tuned.

Kinect2 Static Background Removal.zip (1.2 MB)

I have now recorded 2 frames, one is a stairway without a person, one with a person. Its kind of a good example, as it has a lot of depth. I want to strip out the “empty stairway background” from the image with the person walking, so I get the silhouette of the person only (as an example).

The math would be as I explained 2 message upwards. I was unable to do what you explained with the texture thing, I don’t know how to clone the tfx template. Where do I find that and how do I clone it?

The patch shows also another problem I am facing.

On the lower right you see a noise field moving upwards. I want to simulate some kind of fire style effect, by displacing an image (such as the silhouette) using that animated noise field. However, I can’t apply that transform to the silhouette, I can only use it without the vertical motion, as you can see in the lower left.

How can I manage to apply the transform exactly as its adjusted and then apply it to the noise field and use that to displace that silhouette image in the middle renderer?

I think I still didn’t understand exactly how DX11 works.

Sorry for the newbie questions ;-)
I hope you can show me how to get “there”.

try study some stuff overt here… shaders are you friends:
https://www.youtube.com/channel/UCa8Vqigdbq5Gam_6dcGdNBw

what i get is an empty renderers lol

well i hacked some quick test
Kinect2 Bgr remover.zip (1.3 MB)

1 Like

Hi Antokhio,

thanks for looking into it.

I just tried your patch it and replaced the stairways image with person with the recorded walk through the kinect2 player.

While it cuts out the silhouette pretty much as expected (which the Kinect2 itself could’t), BUT you copy the data in from the BACKGROUND to the output. I need the FOREGROUND (the actual “person”) as depth fill in the resulting filled silhouette. In which tool is that, its probably just done by swapping the inputs?
I tried swapping the images at root, but that didn’t do the job.

Beside that I am still having that darn issue with the animated noise not working for me. And how do I mirror the image from left to right (to remove the “automatic” Kinect2 mirror effect…?

I tried to change that code in the BlendBasic:

float4 pSUB(float4 PosWVP:SV_POSITION,float2 x:TEXCOORD0):SV_TARGET{float4 c0,c1;readtex(x,c0,c1);
float4 c=lerp(c1,c0-c1,Input);
return c;
}

but without success.

I need to copy the “fill” (unchanged) from the right image with the person (or the live Kinect2 depth output) into those pixels, where the silhouette is (so where the two images differ most), while setting all the other depth pixels to “far away maximum” instead.

Is there a way to use a single color component of c0 and c1 instead the full RGBD vector?
Such as red component only?
Can we use “IF” within a shader formula?
Otherwise I could work something out with a formula using e.g. ABS, MIX, MAX as helpers. But that seems not possible with color RGBD vectors.

I thought of something like this:
If (c0.red - c1.red)<(tolerance/2) then
“background”
c=1
else
“forground”
c=c1;

but it doesn’t work this way, as I can’t access the color component (I simply don’t know how).

If I can’t use IF statements then I might make a formula similar to this:
help = abs(c0.red-c1.red)<(tolerance/2)
c=help*c0 + (1-help)*c1

Just an idea…

just type “Template” (TextureFX), then ctrl click the item in the list, call it something like Substract.
then you can add another texture there like :
Texture2D texB;
then in the pixel shader do:
float4 c1 = texB.Sample(sampler, input.uv);

there you go i did you shader to experiment
Kinect2 Bgr remover.zip (1.3 MB)

1 Like

Hey, super, that helps a lot.

Simpler than I thought. I wonder what I did wrong before, I was almost there myself. I wonder why you can set c=1 as its a vector. But from there I can hopefully finetune.

Can you explain how I can use the vertical moving noise as displacement shader in my sample?
Right now I can only apply without the vertical motion like in the lower left.

i think the problem there is that displacement uses special color, check the help patch for DisplacementMap (press F1 on node) it says you need texture with R.G is direction you kinda need some sort of processing to get it right…
there is also other types of displacement shaders you can check

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.