mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-01-07 00:06:57 +01:00
allow specific objects to be listed for a zone (fixes #1123)
This commit is contained in:
parent
da2492413f
commit
f4aa02cc19
@ -93,6 +93,9 @@ zones:
|
||||
# Required: List of x,y coordinates to define the polygon of the zone.
|
||||
# NOTE: Coordinates can be generated at https://www.image-map.net/
|
||||
coordinates: 545,1077,747,939,788,805
|
||||
# Optional: List of objects that can trigger this zone (default: all tracked objects)
|
||||
objects:
|
||||
- person
|
||||
# Optional: Zone level object filters.
|
||||
# NOTE: The global and camera filters are applied upstream.
|
||||
filters:
|
||||
@ -312,6 +315,9 @@ cameras:
|
||||
# Required: List of x,y coordinates to define the polygon of the zone.
|
||||
# NOTE: Coordinates can be generated at https://www.image-map.net/
|
||||
coordinates: 545,1077,747,939,788,805
|
||||
# Optional: List of objects that can trigger this zone (default: all tracked objects)
|
||||
objects:
|
||||
- person
|
||||
# Optional: Zone level object filters.
|
||||
# NOTE: The global and camera filters are applied upstream.
|
||||
filters:
|
||||
|
@ -185,6 +185,10 @@ class ZoneConfig(BaseModel):
|
||||
coordinates: Union[str, List[str]] = Field(
|
||||
title="Coordinates polygon for the defined zone."
|
||||
)
|
||||
objects: List[str] = Field(
|
||||
default_factory=list,
|
||||
title="List of objects that can trigger the zone.",
|
||||
)
|
||||
_color: Optional[Tuple[int, int, int]] = PrivateAttr()
|
||||
_contour: np.ndarray = PrivateAttr()
|
||||
|
||||
|
@ -143,6 +143,9 @@ class TrackedObject:
|
||||
bottom_center = (self.obj_data["centroid"][0], self.obj_data["box"][3])
|
||||
# check each zone
|
||||
for name, zone in self.camera_config.zones.items():
|
||||
# if the zone is not for this object type, skip
|
||||
if len(zone.objects) > 0 and not self.obj_data["label"] in zone.objects:
|
||||
continue
|
||||
contour = zone.contour
|
||||
# check if the object is in the zone
|
||||
if cv2.pointPolygonTest(contour, bottom_center, False) >= 0:
|
||||
|
Loading…
Reference in New Issue
Block a user