gpt4 book ai didi

python - 属性错误: module 'cv2' has no attribute 'face' (OpenCV and Python)

转载 作者:太空宇宙 更新时间:2023-11-03 21:35:54 25 4
gpt4 key购买 nike

我已经尝试了很多方法,例如重新安装 CV2,但此错误不会消失。

这是代码:

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

# Path for face image database
path = 'C:\\Users\\lordg_000\\Desktop\\trainer'

recognizer = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");'

最佳答案

未安装扩展模块 Opencv_contrib。

解决方案:

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

关于python - 属性错误: module 'cv2' has no attribute 'face' (OpenCV and Python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53245773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com