After referring to some Stack Overflow answers I did pip install opencv-contrib
, still I am getting those errors.
code for training:
face_recognizer=cv2.face.LBPHFaceRecognizer_create()
code for facial detection:
faces,faceID = fr.labels_for_training_data('C:\\Users\\Desktop\\python tests\\0')
face_recognizer=fr.train_classifier(faces,faceID)
face_recognizer.save('C:\\Users\\Desktop\\python tests\\trainingData.yml')
And Error is :
File "C:/Users/vsneh/OneDrive/Desktop/python tests/Face_detect_Tester.py", line 15, in <module>
face_recognizer=fr.train_classifier(faces,faceID)
File "C:/Users/vsneh/OneDrive/Desktop/python tests\faceRecognition.py", line 47, in train_classifier
face_recognizer=cv2.faces.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.cv2' has no attribute 'faces'