From 3898a019f24c2596e07a85b0a06b44dd49f6fd7d Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sun, 14 Jul 2024 21:32:50 +0700 Subject: [PATCH] Create biometric_authentication.py --- .../biometric_authentication.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 features/blockchain_identity_verification/biometric_authentication.py diff --git a/features/blockchain_identity_verification/biometric_authentication.py b/features/blockchain_identity_verification/biometric_authentication.py new file mode 100644 index 000000000..caa9abcfc --- /dev/null +++ b/features/blockchain_identity_verification/biometric_authentication.py @@ -0,0 +1,16 @@ +# File name: biometric_authentication.py +import face_recognition +import numpy as np + +class BiometricAuthentication: + def __init__(self): + self.known_faces = [] + + def enroll_face(self, image): + face_encoding = face_recognition.face_encodings(image)[0] + self.known_faces.append(face_encoding) + + def authenticate(self, image): + unknown_face_encoding = face_recognition.face_encodings(image)[0] + results = face_recognition.compare_faces(self.known_faces, unknown_face_encoding) + return results