codingforentrepreneurs / OpenCV-Python-Series

An OpenCV & Python Tutorial Series and Reference.
401 stars 549 forks source link

cv_face_FaceRecognizer_read erro #27

Open FranciscoMaiungulo opened 2 years ago

FranciscoMaiungulo commented 2 years ago

Hey guys. I'm here with this bug in my code and I can't even find a solution for it. I've already used "load" instead of "read", but still an error appears. When I change the opencv version, I can't create the training "yml" file anymore. Below is my code with the "yml" file already created.

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

lbph_face_classifier = cv2.face.LBPHFaceRecognizer_create() lbph_face_classifier.read('/train/lbph_classifier.yml') imagem_teste = ('C:/Users/MD Francisco/Desktop/Expert/dlib/Reconhecimento/yalefaces/test/subject10.sad.gif') imagem = Image.open(imagem_teste).convert('L') imagem_np = np.array('uint8') print(imagem_np)