You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\core\src\matrix.cpp:235: error: (-215:Assertion failed) s >= 0 in function 'cv::setSize'
#25
Necesito ayuda con este error, al momento de cambiar de persona me marca este error no se cual sera el problema (soy muy nuevo en esto tengo)
import numpy as np
import cv2
import pickle
Face = cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml ")
eye = cv2.CascadeClassifier('cascades/data/haarcascade_eye.xml')
smile = cv2.CascadeClassifier('cascades/data/haarcascade_smile.xml')
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read("trainner.yml")
labelids={"person_name", 1}
with open("labels.pickle","rb")as f:
og_labelids=pickle.load(f)
labelids={v:k for k,v in og_labelids.items()}
capt = cv2.VideoCapture(0)
while(True):
ret, frame = capt.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = Face.detectMultiScale(gray, scaleFactor=1.5, minNeighbors=5)
for (x, y, w, h) in faces:
#print(x, y, w, h)
gray = gray[y:y+h, x:x+w]
color = frame[y:y+h, x:x+w]
#recordar
id_, conf = recognizer.predict(gray)
if (conf>=4 and conf<=85):
#print(id_)
#print(labelids[id_])
font = cv2.FONT_HERSHEY_SIMPLEX
name= labelids[id_]
color =(255,255,255)
stroke = 2
cv2.putText(frame, name, (x,y), font, 1, color, stroke, cv2.LINE_AA)
capt.release()
cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered: