I am having an error on the append function as you can see below
Error:
4.5.3
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File “c:/Python/TEST.py”, line 46, in
DATA.append=((Landmark.x))
AttributeError: ‘list’ object attribute ‘append’ is read-only
I am running this in a for loop:
Data=
Data.append=((Landmark.x))
print(Data)
Error:
4.5.3
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File “c:/Python/TEST.py”, line 33, in
Data.append=((Landmark.x))
AttributeError: ‘list’ object attribute ‘append’ is read-only
This is the code in visual studio code:
import cv2
print(cv2.__version__)
import mediapipe as mp
width=1280
height=720
cam=cv2.VideoCapture(0,cv2.CAP_DSHOW)
cam.set(cv2.CAP_PROP_FRAME_WIDTH,width)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT,height)
cam.set(cv2.CAP_PROP_FPS, 30)
cam.set(cv2.CAP_PROP_FOURCC,cv2.VideoWriter_fourcc(*'MJPG'))
Handen=mp.solutions.hands.Hands(False,2,.5,.5,)
mpDraw=mp.solutions.drawing_utils
while True:
ignore, frame=cam.read()
frameRGB=cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
results=Handen.process(frameRGB)
if results.multi_hand_landmarks != None:
for handLandmarks in results.multi_hand_landmarks:
mpDraw.draw_landmarks(frame,handLandmarks,mp.solutions.hands.HAND_CONNECTIONS)
for Landmark in handLandmarks.landmark:
Data=[]
Data.append=((Landmark.x))
print(Data)
print('')
cv2.imshow('my WEBcam',frame)
cv2.moveWindow('my WEBcam',0,0)
if cv2.waitKey(1) & 0xff==ord('q'):
break
cam.release()