Update app.py
Browse files
app.py
CHANGED
@@ -35,6 +35,9 @@ class Button:
|
|
35 |
self.pos = pos
|
36 |
self.size = size
|
37 |
self.text = text
|
|
|
|
|
|
|
38 |
|
39 |
class Detection(NamedTuple):
|
40 |
label: str
|
@@ -74,12 +77,6 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
74 |
# Add special buttons for Backspace and Space
|
75 |
buttonList.append(Button([90 + 10 * 100, 30], 'BS', size=[125, 100]))
|
76 |
buttonList.append(Button([300, 370], 'SPACE', size=[500, 100]))
|
77 |
-
for button in buttonList:
|
78 |
-
x, y = button.pos
|
79 |
-
w, h = button.size
|
80 |
-
#if x < x8 < x + w and y < y8 < y + h:
|
81 |
-
cv2.rectangle(img, button.pos, (x + w, y + h), (0, 255, 160), -1)
|
82 |
-
cv2.putText(img, button.text, (x + 20, y + 70), cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 3)
|
83 |
|
84 |
detections = []
|
85 |
if result.multi_hand_landmarks:
|
|
|
35 |
self.pos = pos
|
36 |
self.size = size
|
37 |
self.text = text
|
38 |
+
# Draw button text on the keyboard canvas
|
39 |
+
cv2.putText(img, self.text, (self.pos[0]+20, self.pos[1]+70),
|
40 |
+
cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 3)
|
41 |
|
42 |
class Detection(NamedTuple):
|
43 |
label: str
|
|
|
77 |
# Add special buttons for Backspace and Space
|
78 |
buttonList.append(Button([90 + 10 * 100, 30], 'BS', size=[125, 100]))
|
79 |
buttonList.append(Button([300, 370], 'SPACE', size=[500, 100]))
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
detections = []
|
82 |
if result.multi_hand_landmarks:
|