Limit continous Data Stream

Let’s say I have a video feed coming into Grasshopper and my script will do some sampling with it:
it then has only 33 milliseconds to do that with the current frame.
But even without generating any geometry, reading the color of each pixel alone will take more time than that.
So what’s the best method for “slicing” up those and serving it grasshopper bite-sized (no pun intended)?

The timer is not helpful here – what I personally see as a bug – since its target will always update when their input has changed, even tho the timer should block that (at least I would wish it would work in this logic way).

I think Data Dam component might be what you looking for over timer. This component only send the data downstream either when pressed or after a set amount of time.

While running on a multi-tasking operating system you cannot guarantee that some operation will complete in a given amount of time. You can make it likely, but not 100%

Basically the problem is how to make it as fast as possible. Parsing video or audio streams is difficult in real time. Grasshopper is almost certainly not the platform to do it in due to the large overhead involved with each iteration. Grasshopper for example always repaints the Rhino viewports after every new solution. This can take much longer than the solution itself. It may certainly take up most or all of the 33ms you budgeted to begin with.

Is there any way one can disable Viewport updates?

// Rolf

@mattgaydon, Data Dam is as useless (you have to click it to activate it).
This one slipped through my eyes and fingers. You can set it to an interval and does seem to work :​)
@DavidRutten: Don’t get me wrong, what I want is something that will discard the input except for a fixed intervall. Like “reduce framerate to 3 fps” and you’ll know what I mean.
See, the problem is, that the timer is not helpful if the input changes, because the timer should essentially block input for the given time, but it is not doing this. The timer blocked component should ignore input changes and just do its thing when its time has come.
I hope the subject became clearer to you all.

As @mattgaydon said, DataDam can be set to a delay. No need to click it to activate it.

If you keep track of “last read of input” you can just skip reading inputs before that interval ends.

// Rolf

1 Like

@runxel, Sorry forgot to say using Data Dam by default you have to click the play button, but if you right-click the play button it gives you the option to set a time delay, though these are set times also not custom.

Maybe there is something in Firefly Plug-in as it dealt with Video as well as Arduino etc. I have not used it for video, but just install the plug-in on this machine running Rhino V6 and it seems to work. Just remember to right click the downloaded file go to properties and click unblock the same as you would do with other GHA files.

Yeah I somehow overlooked this feature. Mea culpa! Was too fast with winnowing that.
Data Dam with the possibility to set the interval to custom could now be the next dream. :upside_down_face:

Not in GH1. It just logs a paint request after every solution completes. That request may or may not be handled promptly (that’s up to the scheduler), but it tends to be.