-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.py
57 lines (51 loc) · 1.07 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import cv2
def draw_fps(frame, fps):
"""Draw fps to demonstrate performance"""
cv2.putText(
frame,
f"{int(fps)} fps",
(20, 20),
cv2.FONT_HERSHEY_SIMPLEX,
fontScale=0.8,
color=(0, 165, 255),
thickness=2,
)
def draw_frame_id(frame, frame_id):
"""Draw fps to demonstrate performance"""
cv2.putText(
frame,
f"Frame {frame_id}",
(frame.shape[1] - 150, frame.shape[0] - 20),
cv2.FONT_HERSHEY_SIMPLEX,
fontScale=0.8,
color=(0, 165, 255),
thickness=2,
)
COLORS = [
(0, 0, 128),
(0, 0, 255),
(0, 128, 0),
(0, 128, 128),
(0, 128, 255),
(0, 255, 0),
(0, 255, 128),
(0, 255, 255),
(128, 0, 0),
(128, 0, 128),
(128, 0, 255),
(128, 128, 0),
(128, 128, 128),
(128, 128, 255),
(128, 255, 0),
(128, 255, 128),
(128, 255, 255),
(255, 0, 0),
(255, 0, 128),
(255, 0, 255),
(255, 128, 0),
(255, 128, 128),
(255, 128, 255),
(255, 255, 0),
(255, 255, 128),
(255, 255, 255),
]