AttributeError: module 'cv2.cv2' has no attribute 'createLBPHFaceRecognizer'

前端 未结 12 799
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 04:28

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

相关标签:
12条回答
  • 2020-11-30 05:19

    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() 
    
    0 讨论(0)
  • 2020-11-30 05:20

    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.

    0 讨论(0)
  • 2020-11-30 05:22

    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.

    0 讨论(0)
  • 2020-11-30 05:24

    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
    
    0 讨论(0)
  • 2020-11-30 05:25
    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.

    0 讨论(0)
  • 2020-11-30 05:26

    You need to install opencv-contrib

    pip install opencv-contrib-python
    

    It should work after that.

    0 讨论(0)
提交回复
热议问题