INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File "e:\Coding\Python\Face_Reg\test.py", line 13, in <module>
fingers = detector.fingersUp('*')
File "C:\Users\aarav\AppData\Local\Programs\Python\Python310\lib\site-packages\cvzone\HandTrackingModule.py", line 111, in fingersUp
myHandType = myHand["type"]
TypeError: string indices must be integers
this is my code:
import cv2
import cvzone.SerialModule
from cvzone.HandTrackingModule import HandDetector
cap = cv2.VideoCapture(0)
detector = HandDetector(maxHands = 1, detectionCon = 0.7)
#mySerial = cvzone.SerialObject("COM3", 9600, 1)
while True:
success, img = cap.read()
hands, img = detector.findHands(img)
lmList, bbox = detector.findHands(img)
if lmList:
fingers = detector.fingersUp('*')
print(fingers)
# mySerial.sendData(fingers)
cv2.imshow("Image", img)
cv2.waitKey(1)
Hi! I was making a hand tracking software. When I click run the camera pops up but as soon as I put my hand in frame the thing shuts and gives error
HandDetector.fingersUpexpects a dictionary representing a hand, as returned byHandDetector.findHands.A working example is provided below:
Note: You might also want to take a look at the project's github, as it contains detailed examples for hand tracking.