Skip to main content
spatial_filter is a stateless workflow node that drops detections that lie outside an author-defined polygon zone. It pairs with timed_condition downstream to build zone-based intrusion alerts without per-camera pixel coordinates. Execution context is inferred from the upstream graph:
  • Wired downstream of a camera_frame trigger + call_model chain it is compiled into the edge worker as an inline polygon-membership comprehension.
  • Wired anywhere else it runs in the cloud workflow runner against the detection array of the upstream node.
Typical chain for a zone-scoped intrusion alert:

Coordinate system

Polygons are stored as [[x, y], ...] of floats in normalized [0..1] image coordinates — the same space YOLO bounding boxes already use. A zone authored against a 1080p stream keeps working when you swap the camera for a 4K one without any manual remap. Polygons must have at least 3 vertices.

Inputs

Outputs

Authoring zones

Zones are authored in the workflow editor inspector for the spatial_filter node:
  1. Add a Spatial Filter node from the Decision & Control group.
  2. Wire a camera_frame trigger upstream (typically through a call_model that runs detection).
  3. In the inspector, click on the polygon canvas to add vertices, drag to move them, double-click to remove (≥ 3 vertices required).
  4. Optional: click Capture frame to fetch the latest still from the upstream camera trigger and trace the polygon over the actual scene.
  5. Pick the Reference Point that matches your subjects: bbox_bottom_center for people standing on the floor, centroid for mid-air objects, any_overlap when even a finger crossing the line should count.
Once the workflow is active, the polygon also renders as a read-only overlay on the twin’s WebRTC stream so operators can see which zones are armed.

Edge implementation

The node compiles into a Python comprehension inlined into the generated edge worker (wf_<uuid8>.py) — no extra runtime dependencies, no MQTT round-trip per frame. The polygon-membership helper is generated only once even if multiple zones share a worker. See Edge Workers for the full lifecycle.

Companion nodes

  • timed_condition — fire only when something has been inside the zone for at least N seconds.
  • anonymize — pair upstream of spatial_filter to publish privacy-safe video while still alerting on zone violations.