-1

i'm following a youtube tutorial https://www.youtube.com/watch?v=01sAkU_NvOY and i copied the code line by line but it seems like python cannot find multi_hand_landmarks im using VScode here is my code:

import cv2
from cv2 import FONT_HERSHEY_COMPLEX
import mediapipe 
import time 



cap = cv2.VideoCapture(0)
ptime  = 0
Ctime = 0



mpHands = mediapipe.solutions.mediapipe.python.solutions.hands
hands = mpHands.Hands()
mpDraw = mediapipe.solutions.mediapipe.python.solutions.drawing_utils

while True:
    success ,  img = cap.read()
    imgRGB = cv2.cvtColor(img , cv2.COLOR_BGR2RGB)
    results = hands.process(imgRGB)


    if results.multi_hand_landmarks:
        for handLMS in results.multi_hand_landmraks:
        #    for id , lm , in enumerate(handLMS.landmark):
        #        h , w ,c = img.shape
        #        cx,cy = int(lm.x *w), int(lm.y * h)
        #        print(cx , cy)
           mpDraw.draw_landmarks(img ,handLMS , mpHands.HAND_CONNECTIONS) 

    Ctime = time.time()
    fps = 1/(Ctime-ptime)
    ptime = Ctime

    cv2.putText(img ,str(int(fps)) , (10,70), cv2.FONT_HERSHEY_COMPLEX, 3 ,
               (255,0,255),3)

    cv2.imshow("Vid", img )
    cv2.waitKey(1)

this is the error that i get when i run the code: line 25, in for handLMS in results.multi_hand_landmraks: AttributeError: type object 'SolutionOutputs' has no attribute 'multi_hand_landmraks' [ WARN:0@19.994] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (539) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback


1

quhtani
  • 1
  • 2

1 Answers1

1

You have a typo on line

for handLMS in results.multi_hand_landmraks
Sion
  • 33
  • 1
  • 7