我有在RaspberryPi上运行的Python FaceRecognition代码,但遇到了TypeError: face_FaceRecognizer.predict() takes at most 1 argument (3 given)
问题。有人可以解决这个问题吗?
下面是我的代码,在第6行出现了问题
def detectFace(faces,hog,img):
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
result = cv2.face.StandardCollector_create()
rec.predict(hog[y:y+h,x:x+w],result, 0) //here is issue
id = result.getLabel()
conf = result.getDist()
if(conf<150):
if(id==1):
id="Ibrahim_"+str(conf)
elif(id==2):
id="Minh_"+str(conf)
else:
id="Hyeon_"+str(conf)
else:
id="Unknow"
cv2.putText(img,str(id),(x,y+h),font,1,(255,255,255),2,cv2.LINE_AA)
这是终端在RaspberryPi上显示的内容
(cv) pi@raspberrypi:~/Downloads/Raspberry_pi_face_recognition-master $ python FaceRecognizer.py
Traceback (most recent call last):
File "FaceRecognizer.py", line 70, in <module>
detectFace(faces,equ,img)
File "FaceRecognizer.py", line 29, in detectFace
rec.predict(hog[y:y+h,x:x+w],result, 0)
TypeError: face_FaceRecognizer.predict() takes at most 1 argument (3 given)