attributeerror:模块'cv2.face'没有属性'createlbphfacerecognizer' [英] attributeerror: module 'cv2.face' has no attribute 'createlbphfacerecognizer'

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

问题描述

因此,我正在做一个小小的个人项目,但是当我尝试创建识别器时,我一直收到此错误.我有opencv-contrib和所有东西.有人知道发生了什么吗?下面发布的代码

So i'm doing a little personal project but i keep getting this error when I try to create the recognizer. i have opencv-contrib and everything. Does anyone know whats going on? code posted below

import cv2, os
import numpy as np
from PIL import Image

cascadePath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascadePath)

recognizer = cv2.face.createLBPHFaceRecognizer()

它被捕获在最后一行.我已经尝试过重新安装所有模块.不太确定该怎么办.奇怪的是它可以在我的笔记本电脑上工作,但不能在我的台式机上工作.他们都有相同的模块,相同的python版本,并运行完全相同的代码.

it gets caught on that last line. I've tried reinstalling all modules already. Not really sure what else to do. The weird thing is it works on my laptop but not my desktop. They both have the same modules, same python release and running the exact same code.

推荐答案

出现相同的问题.使用:

Had the same problem. Use:

recognizer = cv2.face.LBPHFaceRecognizer_create()

它适用于我的程序.

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

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