OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::Motion

Watches a temperature band for movement.

A zone reports what it sees -- how many moving blobs, how much area, how fast -- as signals, so an alarm on motion is an ordinary Rule and gets hysteresis, debounce delays, latching, a warning band, inhibit sources and the action model like any other:

MotionZone zone;
zone.temp_min_c = 30.0F;      // only things in this band count
zone.temp_max_c = 90.0F;
imager->Motion().SetZone(1, zone);

Rule intruder;
intruder.name = "movement in the hot band";
intruder.input = SignalId::Motion(1, SignalField::kMotionBlobCount);
intruder.condition.compare = Compare::kAbove;
intruder.condition.alarm.high = 0.0F;    // any blob at all
intruder.condition.on_delay =
    std::chrono::milliseconds(100);      // ignore a brief flicker
intruder.actions.push_back({ActionTrigger::kOnActivate, RecordingAction{}});
imager->Alarms().Add(std::move(intruder));

Available fields: kMotionBlobCount, kMotionArea, kMotionVelocity.

Zones are part of the saved configuration and are restored before the rules that watch them, so a saved motion alarm comes back working rather than as a rule waiting on a signal nobody publishes.

A handle, not an owner. Reached through Imager::Motion().

Public types

EventCallback

std::function< void(const MotionEvent &)> EventCallback

Every observation, on the frame thread, rather than the transitions a Rule reports. Prefer a Rule unless you genuinely want the raw per-frame stream: a rule runs its actions off the frame thread and will not fire on every qualifying frame.

Public functions

Motion

Motion(ClientBridge *bridge)

Wraps the imager's shared state. Constructed by the SDK; get one from Imager::Motion() rather than building it yourself.

SetZone

void SetZone(uint32_t id, const MotionZone &zone)

Add or replace the zone with this id.

RemoveZone

void RemoveZone(uint32_t id)

Drop the zone with this id. Unknown ids are ignored.

Its signals stop being published, so a Rule watching SignalId::Motion(id, ...) stops being updated and holds whatever it last saw -- including a latched alarm, which nothing will now clear. Remove or disable those rules too.

ClearZones

void ClearZones()

Drop every zone at once.

Not just RemoveZone() in a loop: this also discards the frame pair motion is measured from. Movement is a difference between consecutive frames, so a zone added after this has no previous frame to compare against and reports nothing on the first frame it sees, which is the right answer rather than a whole-scene change caused by the gap.

SetCallback

void SetCallback(EventCallback callback)

Install that callback. One at a time -- this replaces any previous one rather than adding to a list, and an empty std::function removes it.

It fires once per zone per frame, and only for a zone that saw at least one blob on that frame: a quiet zone is silent, so absence of a call is the "no movement" signal and there is no event with blob_count == 0. Use a Rule if you need to know when movement stops.

Called synchronously on the frame thread, so time spent in it is time the next frame is not being processed. It must not throw.