Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,20 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
60 |
# Process frame using MediaPipe
|
61 |
result = hands.process(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
62 |
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
for button in buttonList:
|
65 |
x, y = button.pos
|
66 |
w, h = button.size
|
|
|
60 |
# Process frame using MediaPipe
|
61 |
result = hands.process(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
62 |
|
63 |
+
# Create a blank canvas for drawing the keyboard
|
64 |
+
keyboard_canvas = np.zeros_like(img)
|
65 |
+
buttonList = []
|
66 |
+
# Define buttons in each row of the virtual keyboard
|
67 |
+
for key in keys[0]:
|
68 |
+
buttonList.append(Button([30 + keys[0].index(key) * 105, 30], key))
|
69 |
+
for key in keys[1]:
|
70 |
+
buttonList.append(Button([30 + keys[1].index(key) * 105, 150], key))
|
71 |
+
for key in keys[2]:
|
72 |
+
buttonList.append(Button([30 + keys[2].index(key) * 105, 260], key))
|
73 |
+
|
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
|