bp_skripty/enroll.py
2023-05-28 21:12:05 +02:00

36 lines
841 B
Python

import rsid_py
import sys
import logging
PORT="/dev/ttyACM0"
def on_result(result):
print('on_result', result)
def on_progress(p):
print(f'on_progress {p}')
def on_hint(h):
print(f'on_hint {h}')
def on_faces(faces, timestamp):
print(f'detected {len(faces)} face(s)')
for f in faces:
print(f'\tface {f.x},{f.y} {f.w}x{f.h}')
if __name__ == '__main__':
with rsid_py.FaceAuthenticator(PORT) as f:
# user_id = input()
if len(sys.argv) > 1:
user_id = sys.argv[1]
f.enroll(user_id=user_id, on_hint=on_hint, on_progress=on_progress, on_faces=on_faces, on_result=on_result)
else:
print('Chyba')
exit()
#display list of enrolled users
users = f.query_user_ids()
print('Users: ', users)