I am facing some attribute error while running face recognizing the code. My face detects code run perfectly.But while I try to run the face recognizing code it shows some a
if you are using python3.x and opencv==4.1.0 then use following commands First of all
python -m pip install --user opencv-contrib-python
after that use this in the python script
cv2.face.LBPHFaceRecognizer_create()
opencv has changed some functions and moved them to their opencv_contrib repo so you have to call the mentioned method with:
recognizer = cv2.face.createLBPHFaceRecognizer()
Note: You can see this issue about missing docs. Try using help function help(cv2.face.createLBPHFaceRecognizer)
for more details.
For me, I had to have OpenCV (3.4.2), Py-OpenCV (3.4.2), LibOpenCV (3.4.2).
My Python was version 3.5.6 with Anaconda in Windows OS 10.
Use the following
recognizer = **cv2.face.LBPHFaceRecognizer_create()**
After you install:
pip install opencv-contrib-python
If using anaconda then in anaconda prompt:
conda install pip
then
pip install opencv-contrib-python
python -m pip install --user opencv-contrib-python
After doing this just Restart your system and then if you are on Opencv >= 4.* use :
recognizer = cv2.face.LBPHFaceRecognizer_create()
This should solve 90% of the problem.
You need to install opencv-contrib
pip install opencv-contrib-python
It should work after that.