When jit.faces doesn't detect a face, show a previous frame?

mtev's icon

Hey guys, I'm new to Max but really like it so far (though it does have a bit of a steep learning curve..at least for me).

I'm using cv.jit.faces to detect my face on a webcam with cv.jit.grab, which is working fine so far.
However when no face is detected, I would like to show a previous frame/picture of my face until a face is detected again.

I *think* I need to export the current matrix each time I do get a face detection and then store it somehow for when I don't get one?
Could you please send me in the right direction?

Thanks a lot!

mtev's icon

I hate to sound impatient, but the deadline for this project is tomorrow ;)
Any help would be greatly appreciated!

MIB's icon

If you post a patch it might be easier for people to help...

mtev's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Right, sorry, this is the basic setup:

So maybe I could add an if-statement, checking to see if the ouput coordinates
However, I don't know what do from there: how to store the current frame if there is a face and how to show that frame when there is no face.

mtev's icon

Ok, made a little progress by using a gate and send/load bang to switch between the stream and previous frame.
Now all that's left is getting that previous frame.

mtev's icon

Solved by using a trigger.

MIB's icon
Max Patch
Copy patch and select New From Clipboard in Max.

how about this? no previous frame here, but it only outputs a frame if a valid face has been found.