import mediapipe
import cv2
import null as null
drawingModule = mediapipe.solutions.drawing_utils
handsModule = mediapipe.solutions.hands
capture = cv2.VideoCapture(0)
with handsModule.Hands(static_image_mode=False, min_detection_confidence=0.7, min_tracking_confidence=0.7,max_num_hands=2) as hands:
while (True):
ret, frame = capture.read()
results = hands.process(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
if results.multi_hand_landmarks:
for handLandmarks in results.multi_hand_landmarks:
drawingModule.draw_landmarks(frame, handLandmarks, handsModule.HAND_CONNECTIONS)
cv2.imshow('Test hand', frame)
if cv2.waitKey(1) == 27:
break
cv2.destroyAllWindows()
capture.release() here
This code will also show the same error when hovering over the same line as yours but the code runs. Possibly a bug with PyCharm and the Mediapipe library.
In the source code it is there :
outputs=['multi_hand_landmarks', 'multi_handedness'])
https://github.com/google/mediapipe/blob/710fb3de58dc10b7bc75f9cb758300c9016a5e4f/mediapipe/python/solutions/hands.py#L125