Zones¶
BrainFrame allows you to specify areas of interest within a video stream and gain specific insights about that area. Every stream comes with a default zone called “Screen” which encompasses the full area of the stream. See the Zones section in the User Manual for more details.
API Methods¶
-
BrainFrameAPI.
get_zone
(zone_id, timeout=30) → brainframe.api.bf_codecs.zone_codecs.Zone¶ Get a specific zone.
- Parameters
zone_id – The ID of the zone to get
timeout – The timeout to use for this request
-
BrainFrameAPI.
get_zones
(stream_id=None, timeout=30) → List[brainframe.api.bf_codecs.zone_codecs.Zone]¶ Gets all zones.
- Parameters
stream_id – If set, only zones in the stream with this ID are returned
timeout – The timeout to use for this request
- Returns
Zones
-
BrainFrameAPI.
set_zone
(zone: brainframe.api.bf_codecs.zone_codecs.Zone, timeout=30)¶ Update or create a zone. If the Zone doesn’t exist, the zone.id must be None. An initialized Zone with an ID will be returned.
- Parameters
zone – A Zone object
timeout – The timeout to use for this request
- Returns
Zone, initialized with an ID
-
BrainFrameAPI.
delete_zone
(zone_id: int, timeout=30)¶ Deletes a zone with the given ID.
- Parameters
zone_id – The ID of the zone to delete
timeout – The timeout to use for this request
Data Structures¶
-
class
Zone
(name: str, stream_id: int, coords: List[List[int]], alarms: List[brainframe.api.bf_codecs.alarm_codecs.ZoneAlarm] = <factory>, id: Optional[int] = None)¶ The definition for a zone. It is a non-convex polygon or a line.
-
FULL_FRAME_ZONE_NAME
: ClassVar[str] = 'Screen'¶ The name of the default full-frame zone that exists on every stream
-
alarms
: List[ZoneAlarm]¶ All alarms that are attached to the zone
-
coords
: List[List[int]]¶ Coordinates that define the region the zone occupies. It is a list of lists which are two elements in size. The coordinates are in pixels where the top left of the frame is [0, 0].
Example: [[0, 0], [10, 10], [100, 500], [0, 500]]
-
get_alarm
(alarm_id) → Optional[brainframe.api.bf_codecs.alarm_codecs.ZoneAlarm]¶ - Parameters
alarm_id – The ID of the alarm to search in the alarm list for
- Returns
The alarm with the given ID, or None if no alarm with that ID exists in this zone
-
id
: Optional[int] = None¶ A unique identifier
-
name
: str¶ A friendly name for the zone
-
stream_id
: int¶ The ID of the stream this zone is in
-