the line in question is line 2 Its not allowing the hand Left-Right Recognition
mp_hands.HandLandmark.WRIST
result.multi_hand_landmarks[1]
result.multi_handedness[0].classification[0].index == num
result.multi_handedness[0].classification[0].score
def getLabel(index,hand,result):
output = None
for idx, classification in enumerate(result.multi_handedness):
if classification.classification[0].index == index:
label = classification.classification[0].label
score = classification.classification[0].score
text = '{} {}'.format(label,round(score,3))
coords = tuple(np.multiply(
np.array((hand.landmark[mp_hands.HandLandmark.WRIST].x, hand.landmark[mp_hands.HandLandmark.WRIST].y)),
[640,480]).astype(int))
return output
getLabel(num, hand, result)
File "f:\Codes\AIML\jupyter-notebook\hand-detection-mediapipe\handDetection.py", line 41, in <module>
result.multi_hand_landmarks[1]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
this is the error shown. Sometimes this error is also thrown TypeError: 'NoneType' object is not subscriptable