0
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(id ==1):
id = "Tiago"
cv2.cv.PutText(cv2.cv.fromarray(img),str(id), (x,y+h+30),font, 255)
cv2.cv.PutText(cv2.cv.fromarray(img),str(genderTiago), (x,y+h+60),font, 255)
cv2.cv.PutText(cv2.cv.fromarray(img),str(occupationTiago),(x,y+h+90),font,255)
cv2.imshow("Face",img)
elif(id ==2):
id = "Obama"
if (cv2.waitKey(1) == ord('q')):
break;
I’m doing a face recognition program and I’m having a problem with the last Elif. Python says it’s a syntax error. What’s wrong?