正在获取else语句右括号的无效语法错误,是因为缩进错误还是编码错误我该如何修复此错误。在
font= cv2.FONT_HERSHEY_COMPLEX_SMALL
while(True):
ret,img=cam.read();
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
faces=faceDetect.detectMultiScale(gray,1.3,5)
for(x,y,w,h) in faces:
cv2.rectangle(img,(x,y), (x+w,y+h),(0,0,255),2)
id,conf=rec.predict(gray[y:y+h,x:x+w])
if(conf<50):
user=getUser(id)
if(user!=None):
cv2.putText(img,str(user[1]),(x,y+h),font,2,(0,255,0),2)
else:
cv2.putText(img,"Unknown"),(x,y+h),font,2,(0,255,0),2)#<-get invalid syntax for close bracket
cv2.imshow("Face",img);
if(cv2.waitKey(1)==ord('q')):
break;
cam.release()
cv2.destroy.AllWindows()
你有一个多余的支架,把它去掉。在
相关问题 更多 >
编程相关推荐