informramiz / opencv-face-recognition-python

Face Recognition using OpenCV and Python.
MIT License
514 stars 351 forks source link

issues on opencv 3.3.0 version #2

Open Shaniell opened 6 years ago

Shaniell commented 6 years ago

hi Ramiz,

First of all, great tutorial, thank you.

When i (pip) installed the requirement for this tutorial, I've got OpenCV 3.3.0 and it had some issues with your code.

I've done few adjustments to make it work:

  1. Changed the creation of the recognizer from face_recognizer = cv2.face.createLBPHFaceRecognizer() to face_recognizer = cv2.face.LBPHFaceRecognizer_create()

  2. In the predict function changed this label = face_recognizer.predict(face) to label, confidence = face_recognizer.predict(face) The "predict" returns you a value of confidence also, and that addition fixed the TypeError.

Loganzi commented 6 years ago

Hello, But when changed to face_recognizer = cv2.face.LBPHFaceRecognizer_create()

it gives me an error while execution as: 400: error: (-5) This LBPH model is not computed yet. Did you call the train method? in function cv::face::LBPH::predict

I suppose it means I have to call LBPHFaceRecognizer class..? Even though I have, just like in code given... Can this problem be solved?