When Dummy is the new Smart

oZoneDev
oZone Security
Published in
3 min readDec 24, 2016

We just added a provider called DummyInput function to oZone. No, its not a stub code for testing. It does something really interesting with the new InputFallback processor.

Let’s discuss a real-life use-case and describe its usefulness. Last week, I really wanted to post an example of how one can iteratively improve detection with oZone using chaining. The use case was this:

I want to detect motion, but only want to be alarmed if its a human shape. In other words, we need to chain two detectors — motion and shape. The idea was to first track motion, then connect the output of motion to the input of shape. With ozone, it’s trivial to do this:

This is great. The problem, however, is ShapeDetect will only receive frames after motionDetect detects frames. This is perfect for backend processing, but imagine if we were viewing the output of ShapeDetect and motionDetect on a browser (oZone makes it super simple to view any feed by simply attaching The HttpController class to streams like so):

The code above translates the output of the live feed and the shape detect feed into browser renderable image streams.

The problem here is if the shape “detect” stream is only receiving frames after being filtered by the “motion” detection, then whilst viewing in the browser, you will either see broken images when there are no frames, or, still images till a new frame arrives. That’s terrible!

DummyInput and FallbackInput to the rescue.

We re-structured the HTTP feed this way:

Essentially what we did was let the backend be as-is, but for the front-end view, we created a Dummy Input (lines 2–7) that generated blank frames the same size as the original camera, then instantiated a InputFallback class that basically registers both the motion and the dummy components together with the condition that “supply frames from dummyInput” if “motion” does not produce frames in 2 seconds. Finally, we connected this to the HTTPController class (lines 16–20) so that while viewing the feeds, you won’t see broken images when there is nothing to show.

Of course, you can implement this for any consumer or processor. Remember the time when your camera goes down for a bit every once in a while? Use a DummyInput to keep the stream running on the browser!

Here is how this looks: the live Feed is a real camera feed. “Detect without Fallback” is the output of motion triggering shape detection. And the “Detect with fallback” is the same, but with dummy frame generation when there are no frames. Note how the second feed keeps disappearing as motion stops. Plus, if it comes up again, we need to refresh the browser because the browser already time out. Ugly. Not the “Detect with fallback frame” -> it switches to a calm grey with local time (which you can obviously customize to any other text, or none at all)

--

--

oZoneDev
oZone Security

A breath of fresh air for security and surveillance software