-
Notifications
You must be signed in to change notification settings - Fork 0
/
SignTraductor.py
27 lines (27 loc) · 1.04 KB
/
SignTraductor.py
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 mediapipe as mp
mp_drawing = mp.solutions.drawing_utils
mp_hands = mp.solutions.hands
cap = cv2.VideoCapture(0)
with mp_hands.Hands(
static_image_mode=False,
max_num_hands=2,
min_detection_confidence=0.5) as hands:
while cap.isOpened():
ret, frame = cap.read()
if ret == False:
break
height, width, _ = frame.shape
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
results = hands.process(frame_rgb)
if results.multi_hand_landmarks is not None:
for hand_landmarks in results.multi_hand_landmarks:
mp_drawing.draw_landmarks(
frame, hand_landmarks, mp_hands.HAND_CONNECTIONS,
mp_drawing.DrawingSpec(color=(0,255,0), thickness=3, circle_radius=7),
mp_drawing.DrawingSpec(color=(255,0,0), thickness=3, circle_radius=7))
cv2.imshow('Detector de manos - S3k0nDz', cv2.flip(frame, 1))
if (cv2.waitKey(1) == ord('s')):
break
cap.release()
cv2.destroyAllWindows()