本文介绍了openCV错误模块'cv2.face'没有属性'createEigenFaceRecognizer'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python 3.7和最新版本的openCV.当我尝试创建EigenFaceRecognizer时.出现此错误,提示模块'cv2.face'没有属性createEigenFaceRecognizer.我从Gitub存储库中获得了下面的代码.

I am using python 3.7 and latest version of openCV. When i try to create an EigenFaceRecognizer. This error pops up "module 'cv2.face' has no attribute createEigenFaceRecognizer. I have got this bellow code from a Gitub repo.

recognise = cv2.face.createEigenFaceRecognizer(15, 4000)
recognise.load("Recogniser/trainingDataEigan.xml")

推荐答案

我相信face模块位于opencv-contrib库中.您可以使用

I believe the face module is in the opencv-contrib library. You can install it with

pip uninstall opencv-contrib-python
pip install opencv-contrib-python --no-cache-dir

功能也更改为此. load被替换为read

Also the function got changed to this. load was replaced with read

import cv2

recognise = cv2.face.EigenFaceRecognizer_create()
recognise.read("Recogniser/trainingDataEigan.xml")

这篇关于openCV错误模块'cv2.face'没有属性'createEigenFaceRecognizer'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:20