AttributeError: module 'cv2' has no attribute 'face'

北慕城南 提交于 2019-12-11 15:56:36

问题


I tried to install opencv3.4.0 on a raspberry3 following this guide: https://www.life2coding.com/install-opencv-3-4-0-python-3-raspberry-pi-3/

Now the problem is that I could not figure out why python3 gives me the error:

AttributeError: module 'cv2' has no attribute 'face'

This happens, whenever I try to execute

face_recognizer = cv2.face.LBPHFaceRecognizer_create()

I already installed opencv3.4.0 and also the additional modules: opencv3.4.0_contrib. I know that "face" needs to be part of the extra modules. Still I cannot figure out what causes this error.

Can anyone help me out?


回答1:


Finally, I got it working. I just used pip for both installations:

pip install opencv-python
pip install opencv-contrib-python


来源:https://stackoverflow.com/questions/51274439/attributeerror-module-cv2-has-no-attribute-face

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!