mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
make stationary_threshold configurable
This commit is contained in:
parent
ae3e96d313
commit
83ef8209ca
@ -199,6 +199,11 @@ class DetectConfig(FrigateBaseModel):
|
|||||||
default_factory=StationaryConfig,
|
default_factory=StationaryConfig,
|
||||||
title="Stationary objects config.",
|
title="Stationary objects config.",
|
||||||
)
|
)
|
||||||
|
stationary_threshold: Optional[int] = Field(
|
||||||
|
default=10,
|
||||||
|
title="Number of frames without a position change for an object to be considered stationary",
|
||||||
|
ge=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FilterConfig(FrigateBaseModel):
|
class FilterConfig(FrigateBaseModel):
|
||||||
|
|||||||
@ -78,9 +78,9 @@ class ObjectTracker:
|
|||||||
}
|
}
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# if there are less than 10 entries for the position, add the bounding box
|
# if there are less than stationary_threshold entries for the position, add the bounding box
|
||||||
# and recompute the position box
|
# and recompute the position box
|
||||||
if len(position["xmins"]) < 10:
|
if len(position["xmins"]) < self.detect_config.stationary_threshold:
|
||||||
position["xmins"].append(xmin)
|
position["xmins"].append(xmin)
|
||||||
position["ymins"].append(ymin)
|
position["ymins"].append(ymin)
|
||||||
position["xmaxs"].append(xmax)
|
position["xmaxs"].append(xmax)
|
||||||
|
|||||||
@ -507,8 +507,8 @@ def process_frames(
|
|||||||
stationary_object_ids = [
|
stationary_object_ids = [
|
||||||
obj["id"]
|
obj["id"]
|
||||||
for obj in object_tracker.tracked_objects.values()
|
for obj in object_tracker.tracked_objects.values()
|
||||||
# if there hasn't been motion for 10 frames
|
# if there hasn't been motion for N frames
|
||||||
if obj["motionless_count"] >= 10
|
if obj["motionless_count"] >= detect_config.stationary_threshold
|
||||||
# and it isn't due for a periodic check
|
# and it isn't due for a periodic check
|
||||||
and (
|
and (
|
||||||
detect_config.stationary.interval == 0
|
detect_config.stationary.interval == 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user