From e818744d81c989ffe7f0bf70aef1731a9cf35017 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 8 Dec 2019 08:55:19 -0600 Subject: [PATCH] print the frame time on the image --- README.md | 2 ++ frigate/objects.py | 4 ++++ frigate/video.py | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index ec14e1eaa..6008448a0 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ docker run --rm \ --privileged \ -v /dev/bus/usb:/dev/bus/usb \ -v :/config:ro \ +-v /etc/localtime:/etc/localtime:ro \ -p 5000:5000 \ -e FRIGATE_RTSP_PASSWORD='password' \ frigate:latest @@ -46,6 +47,7 @@ Example docker-compose: image: frigate:latest volumes: - /dev/bus/usb:/dev/bus/usb + - /etc/localtime:/etc/localtime:ro - :/config ports: - "5000:5000" diff --git a/frigate/objects.py b/frigate/objects.py index 5109713b6..aa9ef4b69 100644 --- a/frigate/objects.py +++ b/frigate/objects.py @@ -85,4 +85,8 @@ class BestPersonFrame(threading.Thread): draw_box_with_label(best_frame, self.best_person['xmin'], self.best_person['ymin'], self.best_person['xmax'], self.best_person['ymax'], label) + # print a timestamp + time_to_show = datetime.datetime.fromtimestamp(self.best_person['frame_time']).strftime("%m/%d/%Y %H:%M:%S") + cv2.putText(best_frame, time_to_show, (10, 10), cv2.FONT_HERSHEY_SIMPLEX, fontScale=1, color=(255, 255, 255), thickness=4) + self.best_frame = cv2.cvtColor(best_frame, cv2.COLOR_RGB2BGR) diff --git a/frigate/video.py b/frigate/video.py index f53851ed0..5dfb3faf1 100644 --- a/frigate/video.py +++ b/frigate/video.py @@ -315,6 +315,7 @@ class Camera: # lock and make a copy of the current frame with self.frame_lock: frame = self.current_frame.copy() + frame_time = self.frame_time.value # draw the bounding boxes on the screen for obj in detected_objects: @@ -326,6 +327,10 @@ class Camera: cv2.rectangle(frame, (region['x_offset'], region['y_offset']), (region['x_offset']+region['size'], region['y_offset']+region['size']), color, 2) + + # print a timestamp + time_to_show = datetime.datetime.fromtimestamp(frame_time).strftime("%m/%d/%Y %H:%M:%S") + cv2.putText(frame, time_to_show, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, fontScale=.8, color=(255, 255, 255), thickness=2) # convert to BGR frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)