-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomplex.py
More file actions
27 lines (23 loc) · 977 Bytes
/
Copy pathcomplex.py
File metadata and controls
27 lines (23 loc) · 977 Bytes
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
import cv2
import time
from detector import Detector
import config
class Complex:
def __init__(self):
self.detector = Detector()
def proceed(self, frame, landmarks):
current_time = time.time()
symbol = self.detector.detect_symbol(landmarks)
print(f"Detected Symbol: {symbol}")
text = "Complex Calculation\n(Coming Soon)"
(text_width, text_height), _ = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, 1, 2)
x_pos = 50
y_pos = 50
cv2.putText(frame, text, (x_pos, y_pos), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2, cv2.LINE_AA)
# Back menu
text = "0. Exit"
cv2.putText(frame, text, (50, 100), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2)
if isinstance(symbol, int) and symbol == 0:
if current_time - config.last_detected_time >= config.debounce_interval:
config.mode = None
config.last_detected_time = current_time