I hoping to make a plugin to run in vdmx to detect the amount of motion in a video stream, using a difference blend of the last two frames and then sampling the brightness of the resulting image. But im having issues with inconsistent results.
In the hope of getting to the bottom of this issue - i have rebuilt the plugin as a stand alone vuo patch that plots the output value, which is attached. It rotates a square as a substitute input image - as this is at a constant speed i would expect a constant output value. But this value fluctuates between an expected reading and almost zero.
My guess is that my timing is off and the progression of the two comparison frames is out of sync - but being new to vuo i'm unsure about this.
Also there is another glitch that gives higher than expected results - this is caused by actions is other apps. Minimizing a browser for example. I guess this is causing vuo to skip a beat and results in the comparison of frames with a greater difference in time.
I'm hoping this is a noob error - as i purchased vuo for this purpose and hope its capable of the task. cheers Howie
Comments
I get a nice curve using the
I get a nice curve using the difference of 2 squares (see joined MotionDetect_deBug 1), but using video frames I see what you mean about skipping frames when the computer does other things (joined MotionDetect_deBug 2).
I guess resizing the movie down, to reduce hardware load is a way to go, but here I'm testing it with a small macOS movie so it's already small.
You can also right-click on time node's output ports, and choose event throttling "Drop Events" or "Enqueue Events" and check the best results.
But I'm letting the team answer more deeply about this, too technical for me ;)
EDIT : Added MotionDetect_deBug 3 with a
Smooth
over the resulting value.MotionDetect_deBug 1.vuo
MotionDetect_deBug 2.vuo
MotionDetect_deBug 3.vuo
Capture d’écran 2019-08-07 à 01.41.41.png
Brilliant the throttling on
Brilliant the throttling on the display refresh fixes the zeros in the debug patch. I hadn't tried this as the final plugin dosn't render anything - but if I drive the smooth node with a throttled display refresh it does keep the output value in sync. Still the issue of dropped frames from external influences - but i'm not sure that this can be fixed inside the patch. Many Thanks.
Still the issue of dropped
howie, are you still running into this problem with the latest version of your composition? (Based on your recent posts, I'm guessing it's evolved since the conversation here.) If so, could you post that version?
Hi Jaymie _ thanks for asking
Hi Jaymie _ thanks for asking about this. The issue is still present but we have learned to live with it. The vuo patch is attached along with a VDMX project - which sends the syphon and osc controls. If its useful to look into this from a Vuo view then it would be great to hear your thoughts but its not a pressing issue. Let me know if things need more explanation. cheers_ Howie
MoMo-example.zip
Hello all,
Hello all, I'm trying to trigger a movie recording using this motion detection patch and can't figure out the event blocking process that is required... How do I block the events coming from the camera input from reaching the Save Images to Movie node until it receives the trigger from the detected movement? This is what I've been trying...
Screenshot 2021-02-13 at 11.56.38.png
See this thread, might be
See this thread, might be useful. As far as I can tell, you're doing it the same way I am. https://vuo.org/node/2815
Your approach should be working afaict, but perhaps you might share a .vuo file (or show more of the upstream?)
As for dropped frames, you might consider just holding the last value if the frame difference is practically 0. I've done a bunch of experiments in this space, happy to help where I can.
As a sidenote, I think this
As a sidenote, I think this is an example of where Save Images to Movie would be more intuitive to use with a 'Record' and 'Stop'. I know team Vuo has a philosophy on this, but this feels like a special kind of patch. 😀
I'd also love to hear what
I'd also love to hear what the output (difference) is used for in your plugin? Are plugins popular/in demand? I've done some research, but don't have finger on the pulse, so to speak.
I did find the problem
I did find the problem upstream. When the camera first sends a frame the difference calculation throws out a 1 and that was triggering a recording. I added a couple of seconds delay when the composition starts up before it can start recording using a Measure Time and an All True so that it ignores the first trigger.
I'm not sure what howie is using this for but I am just making a very simple 'security camera' type app for myself as I wanted to identify a nocturnal animal which has burrowed next to my home.
Looking forward to some video
Looking forward to some video, then!
My Motion Triggered Video
My Motion Triggered Video Recorder composition is attached. Not sure it's all using the best methods but it's working, mostly as I want. It saves movies to the desktop at 25fps when motion is being detected and wait's 4 seconds to stop recording after the motion stops. Also sequentially names the .movs
EDIT: trying it out now with a miniDV camera as input rather than isight/facetime camera. By having a look at the number coming out of the RGB addition I was able to set the sensitivity quite accurately.
No video of the suspected rat yet as the weather has been too cold and wet.
MotionDetect_Camera 2.vuo
Hello again,
Hello again, Attached a revised and improved composition. Added a couple of UI elements to choose camera input and adjust sensitivity. The composition saves movs to whatever folder the comp is within but when I try the same with an exported app it fails to save the movies anywhere. What is the correct shortcut URL for saving files to within the enclosing folder for use within an exported app?
Also, meet my neighbour:
Screenshot 2021-02-19 at 13.15.30.png
Motion Detection Video Recorder.vuo
Very cool! I haven't looked
Very cool! I haven't looked at the composition yet, but I believe the normal path to the enclosing (parent) folder is '../myFile' (without the quotes)
However, running some tests on a sample app here shows that path doesn't seem to work, instead only 'myFile' is working, which writes to the Desktop folder, regardless of how deeply nested my test app is. You can always write in the whole path, with ~ being the user directory. for example '~/Desktop/mySubFolder/myOtherFolder/'
Found the relevant bit abou
Found the relevant bit about relative file paths in the manual: 'If the file’s location doesn’t start with file:// or /, then it’s treated as a relative path. This is the option you’d typically want when sharing the composition with others. If running the composition on a different computer than it was created on, the file needs to exist in the same location relative to the composition (.vuo) file. If running an application exported from the composition, the file needs to exist in the Contents/Resources folder inside the application package'
So I should probably add a text/URL field/ save path....
Your composition posted about
Your composition posted about is using a path relative to the user though…so it should be good, right? #puzzled
You're on the right track
You're on the right track with relative paths. Use some double-dots to elevate it up out of the app bundle. Details here.
I tried every configuration
I tried every configuration of dots and dashes I could think of to no avail and opted for a drag folder option.
Could the problem be because
Could the problem be because the path is relative to the resources folder (which is two levels deeper than the .app file itself)? ie.,
../../../MyImage
In case anyone lands here
In case anyone lands here with the same question, see this more thorough answer.