We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The package terminates my program every time it recognizes a face and the following error appears:
import cv2 import face_recognition
video_capture = cv2.VideoCapture(0)
exemplo_imagem = face_recognition.load_image_file("exemplo.jpg") exemplo_face_encodings = face_recognition.face_encodings(exemplo_imagem)
if len(exemplo_face_encodings) > 0: exemplo_face_encoding = exemplo_face_encodings[0] else: print("Nenhum rosto encontrado na imagem de exemplo.") video_capture.release() cv2.destroyAllWindows() exit()
conhecidos_face_encodings = [exemplo_face_encoding] conhecidos_nomes = ["Exemplo"]
while True: ret, frame = video_capture.read() if not ret: print("Não foi possível capturar o quadro.") break
rgb_frame = frame[:, :, ::-1] face_locations = face_recognition.face_locations(rgb_frame) face_encodings = face_recognition.face_encodings(rgb_frame, face_locations) for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings): matches = face_recognition.compare_faces(conhecidos_face_encodings, face_encoding) name = "Desconhecido" if True in matches: first_match_index = matches.index(True) name = conhecidos_nomes[first_match_index] cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2) cv2.putText(frame, name, (left, top - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2) cv2.imshow('Video', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break
video_capture.release() cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
The package terminates my program every time it recognizes a face and the following error appears:
Code
import cv2
import face_recognition
video_capture = cv2.VideoCapture(0)
exemplo_imagem = face_recognition.load_image_file("exemplo.jpg")
exemplo_face_encodings = face_recognition.face_encodings(exemplo_imagem)
if len(exemplo_face_encodings) > 0:
exemplo_face_encoding = exemplo_face_encodings[0]
else:
print("Nenhum rosto encontrado na imagem de exemplo.")
video_capture.release()
cv2.destroyAllWindows()
exit()
conhecidos_face_encodings = [exemplo_face_encoding]
conhecidos_nomes = ["Exemplo"]
while True:
ret, frame = video_capture.read()
if not ret:
print("Não foi possível capturar o quadro.")
break
video_capture.release()
cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered: