Problems taking into account an old value

Hi.

I hope someone can help me solving the below described problem I’m working on for days already …

I constructed a patch able of detecting objects on a live video grabbed by a webcam. The logic for detecting the object(s) outputs a value representing a number of currently detected objects.
I’m also able to capture a webcam picture whenever the number of detected objects changes (e.g. from 0 -> 1; from 1 -> 2; from 1 -> 0; etc.).

Now I would like to construct such a capture logic (trigger signal) to meet following requirements:

  1. A picture should be took (signal should be triggered) when the number of detected objects changes upwards (so it increases), but should meet also below requirements

  2. After an image is took (e.g. 0 -> 1) a timer start running. Until the timer reach a predefined value (e.g. 10 seconds) all object detection changes involving less or equal object number should be ignored (e.g. 1 -> 0 and back 0 -> 1 should be ignored).

  3. In case more objects are detected during the timer runs (before it reach 10 seconds), a new image is taken and the process is repeated from point 1. (so current number of objects is recorded and the timer is reset to 0).

  4. After the timer elapses, all positive changes (so every change involving increase of current number of objects) should trigger an image save - so restart from point 1.

I tried realizing the mentioned logic using S-H nodes; however, it doesn’t work for me as the S-H node doesn’t allow creating a returning loop (e.g. S-H.out -> gt.x1; gt.x2 = current no. of objects – gt.out -> AND.x1; AND.x2 = input from change node connected to no. of detected objects – AND.out – this doesn’t work -> S-H.set)!

Thanks,
Damir

just flew over your text
but i think the Automata node is the missing part in your patch.

finite state machines for the win!
but still, one or more flipflop, or, and and framedelay are necessary.

and remember: automata seems crazy but keeps you sane.