-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoculus_v1.py
More file actions
33 lines (23 loc) · 860 Bytes
/
Copy pathoculus_v1.py
File metadata and controls
33 lines (23 loc) · 860 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
28
29
30
31
32
33
import cv2
import mediapipe as mp
flag=True
mp_hands = mp.solutions.hands
mp_draw = mp.solutions.drawing_utils
cap = cv2.VideoCapture(0)
with mp_hands.Hands(max_num_hands=2, min_detection_confidence=0.5) as hands:
while (flag==True):
success, img = cap.read()
if not success:
print("Camera not detected!")
break
img=cv2.flip(img,1)
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
results = hands.process(img_rgb)
if results.multi_hand_landmarks:
for handLms in results.multi_hand_landmarks:
mp_draw.draw_landmarks(img, handLms, mp_hands.HAND_CONNECTIONS)
cv2.imshow("Alex's Oculus Model 2", img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()