Coding Notes
Coding Notes
set the minimum detection and tracking rate in the variable hands.
hands = mp_hands.Hands()
for each and every tipIds of all the 5 fingers, for lm_index in tipIds:
get finger tip and bottom --> y position value
use expression to find out the finger bottom's y position
checking if all the 4 fingers are displayed in front of the camera lm_index !=4:
def drawHandLandmarks(image,hand_landmarks):
if hand_landmarks:
for landmarks in hand_landmarks:
mp_drawing.draw_landmarks(image, landmarks, mp_hands.HAND_CONNECTIONS)
use a while condition and if true,
success,image = cap.read()
flip the image
results = hands.process(image)
hand_landmarks = results.multi_hand_landmarks
drawHandLandmarks(image, hand_landmarks)
countFingers(image,hand_landmarks)
cv2.imshow("Media Controller", image)
key = cv2.waitkey(1)
if key ==32:
break
cv2.destroyAllWindows()