finger detection like mp.solutions.hands

8 次查看(过去 30 天)
I wish MATLAB had a similar function for quick and accurate finger recognition.
I did not find anything.
If anyone knows a method like this, please let me know
import cv2
import mediapipe as mp
cap = cv2.VideoCapture(0)
mediapipeHands = mp.solutions.hands
hands = mediapipeHands.Hands()
Draw = mp.solutions.drawing_utils
blue= (0,0 ,255)
while True:
_, frame = cap.read()
cv2.imshow('webcam', frame)
cv2.waitKey(1)
frameRGB = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
results = hands.process(frameRGB)
if results.multi_hand_landmarks:
for handlandmarks in results.multi_hand_landmarks:
for Id, lm in enumerate(handlandmarks.landmark):
h, w, c = frame.shape
x, y = int(lm.x * w), int(lm.y * h)
if Id == 4:
print(Id, x, y)
cv2.circle(frame, (x, y), 15, (0, 255, 0), -1)
Draw.draw_landmarks(frame, handlandmarks, mediapipeHands.HAND_CONNECTIONS)
cv2.imshow('webcam', frame)
cv2.waitKey(1)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by