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)
댓글 수: 1
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!