即使我使用opencv-contrib-python更新了opencv之后,我仍然遇到属性错误

时间:2019-07-18 16:39:14

标签: python python-3.x opencv

  

AttributeError:模块'cv2.cv2'没有属性'createLBPHFaceRecognizer'   我重新启动了Windows,但仍然无法正常工作

recognizer=cv2.face.createLBPHFaceRecognizer_create()

1 个答案:

答案 0 :(得分:1)

您的代码中有错字。该方法称为LBPHFaceRecognizer_create,而不是createLBPHFaceRecognizer_create

以下对我有用(安装opencv-contrib-python后):

import cv2
recognizer = cv2.face.LBPHFaceRecognizer_create()