AttributeError: 'NoneType' object has no attribute 'landmark'
I am on windows, using jupyter notebook, Mediapipe:Holistic Solution, Python, tensorflow.
I am using a Holistic solution and trying to get the left hand, right hand and pose landmarks. I am giving my webcam feed as input.
When I run the code below, there are no errors and everything is good.
After this, I was trying to check if I got the landmarks by using results.left_hand_landmarks.landmark and length of the landmarks using len(results.left_hand_landmarks.landmark) I am getting this AttributeError: 'NoneType' object has no attribute 'landmark'
The funny part is the problem is only with left hand and right hand landmarks. I was able to get the Pose landmarks and its length. Please help.
cap = cv2.VideoCapture(0)
# Set mediapipe model
with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:
while cap.isOpened():
# Read feed
ret, frame = cap.read()
# Make detections
image, results = mediapipe_detection(frame, holistic)
print(results)
# Draw landmarks
draw_styled_landmarks(image, results)
# Show to screen
cv2.imshow('OpenCV Feed', image)
# Break gracefully
if cv2.waitKey(10) 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Topic opencv jupyter tensorflow computer-vision deep-learning
Category Data Science