-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandLandmarkPinpointing.py
More file actions
47 lines (37 loc) · 1.04 KB
/
HandLandmarkPinpointing.py
File metadata and controls
47 lines (37 loc) · 1.04 KB
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
import cv2
import mediapipe as mp
import time
import HandTrackingModule as htm
import ASLHandDecoder as asl
cap = cv2.VideoCapture(0)
prevTime = 0
currTime = 0
detector = htm.HandDectector()
reader = asl.ASLDecoder()
word = ''
count = 1000
while True:
# running webcam
success, img = cap.read()
img = detector.findHands(img)
lmList = detector.findPosition(img)
letter = reader.getSign(lmList)
# --- displaying characters ---
#if letter != -1 and letter != '' and letter != word:
# word = letter
#print(word)
# --- Gathering info ---
print(letter)
cv2.putText(img, str(word), (600, 120), cv2.FONT_HERSHEY_DUPLEX, 3, (255, 0, 255), 4)
# display fps
# display fps
currTime = time.time()
fps = 1 / (currTime - prevTime)
prevTime = currTime
cv2.putText(img, str(int(fps)), (10, 80), cv2.FONT_HERSHEY_DUPLEX, 3, (0, 255, 255), 4)
# display image
cv2.imshow("Image", img)
if cv2.waitKey(1) & 0xFF == 27: # Esc to exit the loop
break
cap.release()
cv2.destroyAllWindows()