0

I got:

File "c:/Users/Harshit Singh/Desktop/Project/face_recognize.py", line 51
    cv2.putText(im,'% s - %.0f' %

Error from below code can you tell me why?

There is error in Line 51 (%) and I don't know why I'm not able to figure it out.

cv2.putText(im,'% s - %.0f' %
(names[prediction[0]], prediction[1]), 
(x-10, y-10),cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0))
    else:
cv2.putText(im, 'not recognized',
(x-10, y-10), cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0))

cv2.imshow('OpenCV', im)
    
key = cv2.waitKey(10)
if key == 27:
    break

I think I have done some mistake in directory (just a guess) or I am returning the value 0.

This project is for my college.

Mercury
  • 3,417
  • 1
  • 10
  • 35
  • As I see as misindented `else` flying around I'll make a wild guess: in line 50 (before you do `cv2.putText`) you have an `if` statement with the same indentation as line 51. – Matthias Nov 30 '22 at 20:28

0 Answers0