Opencv3 and Python 2.7 on Virtual Environment - AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'

后端 未结 6 1916
栀梦
栀梦 2021-01-02 02:53

I have a python function with opencv 3. it works without virtual environment.Also I installed opencv on venv from:pyimagesearch. i am trying to run that python function on v

6条回答
  •  [愿得一人]
    2021-01-02 03:17

    For windows users using python 3, you can get the opencv_contrib from here. My system is 64 bit so opencv_python‑3.3.0+contrib‑cp36‑cp36m‑win_amd64.whl is what I used. If you are 32 bit then choose the 32 bit version.

    Open command prompt and navigate to the download folder and use the command

    pip install opencv_python-3.3.0+contrib-cp36-cp36m-win_amd64.whl
    

    Note: Use a command similar to the file you just downloaded and make sure to uninstall an older version before installing the new one with the contrib. I had to run:

    pip uninstall opencv_python-3.3.0-cp36-cp36m-win_amd64.whl
    

    before making the new installation.

    Then make sure it's successful

    >>>import cv2
    >>>cv2.face
    
    

    Instead of createLBPHFaceRecognizer(), you must use LBPHFaceRecognizer_create()

提交回复
热议问题