mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-05-12 01:16:02 +02:00
selectively increment position changes
This commit is contained in:
parent
4deb365758
commit
adbc54bcfe
@ -57,7 +57,7 @@ Message published for each changed event. The first message is published when th
|
|||||||
"has_snapshot": false,
|
"has_snapshot": false,
|
||||||
"has_clip": false,
|
"has_clip": false,
|
||||||
"motionless_count": 0, // number of frames the object has been motionless
|
"motionless_count": 0, // number of frames the object has been motionless
|
||||||
"position_changes": 2 // number of times the object has changed position
|
"position_changes": 2 // number of times the object has moved from a stationary position
|
||||||
},
|
},
|
||||||
"after": {
|
"after": {
|
||||||
"id": "1607123955.475377-mxklsc",
|
"id": "1607123955.475377-mxklsc",
|
||||||
|
@ -99,8 +99,16 @@ class ObjectTracker:
|
|||||||
if self.update_position(id, new_obj["box"]):
|
if self.update_position(id, new_obj["box"]):
|
||||||
self.tracked_objects[id]["motionless_count"] += 1
|
self.tracked_objects[id]["motionless_count"] += 1
|
||||||
else:
|
else:
|
||||||
|
# register the first position change and then only increment if
|
||||||
|
# the object was previously stationary
|
||||||
|
if (
|
||||||
|
self.tracked_objects[id]["position_changes"] == 0
|
||||||
|
or self.tracked_objects[id]["motionless_count"]
|
||||||
|
>= self.detect_config.stationary_threshold
|
||||||
|
):
|
||||||
|
self.tracked_objects[id]["position_changes"] += 1
|
||||||
self.tracked_objects[id]["motionless_count"] = 0
|
self.tracked_objects[id]["motionless_count"] = 0
|
||||||
self.tracked_objects[id]["position_changes"] += 1
|
|
||||||
self.tracked_objects[id].update(new_obj)
|
self.tracked_objects[id].update(new_obj)
|
||||||
|
|
||||||
def update_frame_times(self, frame_time):
|
def update_frame_times(self, frame_time):
|
||||||
|
Loading…
Reference in New Issue
Block a user