Documentation Index
Fetch the complete documentation index at: https://docs.cyberwave.com/llms.txt
Use this file to discover all available pages before exploring further.
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_frametrigger +call_modelchain 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.
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
| Field | Type | Description |
|---|---|---|
detections | array | Detection results from an upstream call_model (or anonymize / annotate — the implicit-wiring contract carries the detection array through unchanged). Required. |
polygon | array | [[x, y], ...] in normalized [0..1] coordinates. ≥ 3 vertices. |
point_mode | string | Which part of each detection’s bounding box must fall inside the polygon to count as “in”. bbox_bottom_center (default) for floor-anchored subjects, centroid for mid-air things, any_overlap if any pixel of the bbox touching the polygon should count. |
frame | string | image (only mode supported in v1; floor-plan zones are deferred). |
classes | array | Optional class allow-list applied before the polygon test. null / empty means every detection class is tested. |
Outputs
| Field | Type | Description |
|---|---|---|
detections | array | Subset of input detections that passed the polygon test. |
count | number | Length of the filtered detection array — handy for downstream conditional gates. |
polygon | array | Echo of the configured polygon (normalized coordinates) so downstream snapshot rendering and the live frontend overlay can draw the ROI without re-fetching the node config. |
Authoring zones
Zones are authored in the workflow editor inspector for thespatial_filter node:
- Add a
Spatial Filternode from the Decision & Control group. - Wire a
camera_frametrigger upstream (typically through acall_modelthat runs detection). - In the inspector, click on the polygon canvas to add vertices, drag to move them, double-click to remove (≥ 3 vertices required).
- Optional: click Capture frame to fetch the latest still from the upstream camera trigger and trace the polygon over the actual scene.
- Pick the Reference Point that matches your subjects:
bbox_bottom_centerfor people standing on the floor,centroidfor mid-air objects,any_overlapwhen even a finger crossing the line should count.
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 ofspatial_filterto publish privacy-safe video while still alerting on zone violations.