OpenCV:AttributeError:模块"cv2"没有属性"face" [英] OpenCV: AttributeError: module 'cv2' has no attribute 'face'

查看:680
本文介绍了OpenCV:AttributeError:模块"cv2"没有属性"face"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以下版本上使用Python和OpenCV创建人脸识别系统:

I am creating a face recognition system using Python and OpenCV on these versions:

  • Python 3.6.2 :: Anaconda自定义(64位)
  • Anaconda 4.3.23
  • OpenCV 3.3.0

当我尝试训练人脸识别器时:

When I try to train the face recognizer:

face_recognizer = cv2.face.createLBPHFaceRecognizer()

我收到此错误:

AttributeError:模块'cv2'没有属性'face'

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

更新:

我试图做到这一点:

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

也:

conda install -c menpo opencv3=3.3.0

我仍然有错误.

推荐答案

我找到了解决我问题的方法,您必须按照本教程

I found the solution to my issue, you have to follow this tutorial OpenCV with extra modules.

基本步骤是:

  • 转到C:/PythonXX/lib/site-packeges(安装python的site-packages文件夹),然后删除cv2.pyd(如果存在).
  • 下载带有附加模块的OpenCV
  • 使用CMake创建Visual Studio项目
  • 打开Python IDLE,然后输入import cv2.如果没有错误,则表示安装成功.

这篇关于OpenCV:AttributeError:模块"cv2"没有属性"face"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆