Video motion detection triggers video over video (blend)

Omar Estrada's icon

Hi all!

I am working in a video/audio installation that is not as straightforward as I thought it would be. This is what I need to do:

I will have a three minute looped video projection which plays the entire time.

In the space there will be a ip security camera which will work as a motion detector.

When someone enters the room, the camera detects the motion and triggers randomly a twenty second clip (from a set of ten) on top of the looped video as an "Overlay" or "Darken" blend mode. Once the twenty second clip has finished, the next twenty second clip won´t be triggered until someone else enters the space.

I´m totally lost. Any suggestions for a possible solution?

steve_j's icon

You have your three minute loop playing?
You have your camera setup and are recieving the frames in max?
You have your tracking system set up?
You have a random generator with your values of 0 - 9?
You have your mixer set up?

Where exactly are you strugling?

Omar Estrada's icon

Hi Steve J! Thanks a lot for answering.

Yes I have everything set up but my main challenge was mixing (still a newbie here). However, searching with the right keyword combination I found references to Zach Poff "Video Trigger" and HC Gilje "Video Projection Tool" and these two seem to offer everything I need.

Playing with configurations at the moment.
Thanks!

0711liziyin Li's icon

Hi, just saw your question. I have a really similar idea for my senior project, and have work foe a while. Did you figure anything out? I am very curious. The hardest part for me is the connection between video and motion detection. I know how to make effects through web cam, and also explore Video Trigger Video, also (VPT). However, I am still not able to find out. It will be great if you can share some ideas with me.

Thank you!

Herr Markant's icon

I would do this with a simple frame difference detection (absdiff), then into a hard b/w scale (smoothstep) and then detect the alpha with jit.m3.

maybe there is a better solution, but this is what just came in my mind.

Max Patch
Copy patch and select New From Clipboard in Max.

2K's icon

Herr Markant solution is good but I would stay on the cpu and use jit.pix instead of gl.pix. Going from a gl.pix to a jit.matrix is a total bottleneck.

Max Patch
Copy patch and select New From Clipboard in Max.

0711liziyin Li's icon

Thank y'all for replying me. I am still in the progress.
What I really want to do is to detect motion as toggle(video trigger video:https://www.zachpoff.com/software/video-triggers-video/) .
Whenever the "zone" detect objects, it will trigger effects on a film that I made earlier. What I have so for is that when the webcam detect an object(within the "zone"), film starts playing right away; when the object moves out of frame, video stops.
However, I want to trigger more advanced effects. For example, multiple "zones" can trigger different effects(delay, color effects, fasten.etc) of my video.
Let me know if my words confuse you guys, and I am trying to learn more with MAX7. Thank you!

2K's icon

You should use openCV and blob tracking then. Check the cv.jit Package.

Herr Markant's icon

or just use jit.scissors for different "zones"