From 709d917f0c0009e592de6da52cbb6c00dc172a39 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 26 Jul 2020 07:36:30 -0500 Subject: [PATCH] update snapshot with better scores --- frigate/object_processing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index f5bc7911f..4166f91e8 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -139,6 +139,12 @@ class TrackedObjectProcessor(threading.Thread): if obj['score'] > best_objects[obj['label']]['score'] or (now - best_objects[obj['label']]['frame_time']) > 60: obj['frame'] = np.copy(self.camera_data[camera]['current_frame']) best_objects[obj['label']] = obj + # send updated snapshot over mqtt + best_frame = cv2.cvtColor(obj['frame'], cv2.COLOR_RGB2BGR) + ret, jpg = cv2.imencode('.jpg', best_frame) + if ret: + jpg_bytes = jpg.tobytes() + self.client.publish(f"{self.topic_prefix}/{camera}/{obj['label']}/snapshot", jpg_bytes, retain=True) else: obj['frame'] = np.copy(self.camera_data[camera]['current_frame']) best_objects[obj['label']] = obj