print the frame time on the image

This commit is contained in:
Blake Blackshear 2019-12-08 08:55:19 -06:00
parent ceedfae993
commit e818744d81
3 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,7 @@ docker run --rm \
--privileged \ --privileged \
-v /dev/bus/usb:/dev/bus/usb \ -v /dev/bus/usb:/dev/bus/usb \
-v <path_to_config_dir>:/config:ro \ -v <path_to_config_dir>:/config:ro \
-v /etc/localtime:/etc/localtime:ro \
-p 5000:5000 \ -p 5000:5000 \
-e FRIGATE_RTSP_PASSWORD='password' \ -e FRIGATE_RTSP_PASSWORD='password' \
frigate:latest frigate:latest
@ -46,6 +47,7 @@ Example docker-compose:
image: frigate:latest image: frigate:latest
volumes: volumes:
- /dev/bus/usb:/dev/bus/usb - /dev/bus/usb:/dev/bus/usb
- /etc/localtime:/etc/localtime:ro
- <path_to_config>:/config - <path_to_config>:/config
ports: ports:
- "5000:5000" - "5000:5000"

View File

@ -85,4 +85,8 @@ class BestPersonFrame(threading.Thread):
draw_box_with_label(best_frame, self.best_person['xmin'], self.best_person['ymin'], draw_box_with_label(best_frame, self.best_person['xmin'], self.best_person['ymin'],
self.best_person['xmax'], self.best_person['ymax'], label) 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) self.best_frame = cv2.cvtColor(best_frame, cv2.COLOR_RGB2BGR)

View File

@ -315,6 +315,7 @@ class Camera:
# lock and make a copy of the current frame # lock and make a copy of the current frame
with self.frame_lock: with self.frame_lock:
frame = self.current_frame.copy() frame = self.current_frame.copy()
frame_time = self.frame_time.value
# draw the bounding boxes on the screen # draw the bounding boxes on the screen
for obj in detected_objects: for obj in detected_objects:
@ -326,6 +327,10 @@ class Camera:
cv2.rectangle(frame, (region['x_offset'], region['y_offset']), cv2.rectangle(frame, (region['x_offset'], region['y_offset']),
(region['x_offset']+region['size'], region['y_offset']+region['size']), (region['x_offset']+region['size'], region['y_offset']+region['size']),
color, 2) 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 # convert to BGR
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)