save clips for tracked objects

This commit is contained in:
Blake Blackshear
2020-07-09 06:57:16 -05:00
parent 53ccc903da
commit 7383db60b0
6 changed files with 223 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ class ObjectTracker():
def register(self, index, obj):
id = f"{obj['frame_time']}-{index}"
obj['id'] = id
obj['start_time'] = obj['frame_time']
obj['top_score'] = obj['score']
self.add_history(obj)
self.tracked_objects[id] = obj
@@ -45,6 +46,9 @@ class ObjectTracker():
}
if 'history' in obj:
obj['history'].append(entry)
# only maintain the last 20 in history
if len(obj['history']) > 20:
obj['history'] = obj['history'][-20:]
else:
obj['history'] = [entry]