File size: 683 Bytes
c794b6b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import cv2
import numpy as np
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "Face_Recognition"))
from face_matcher import FaceMatcher
fe = FaceMatcher()
fe.reload_db()
print(f"DB keys: {list(fe.db.keys())}")
# Try to find a face image
img_path = os.path.join("Face_Recognition", "face_database")
# find first jpg
for root, dirs, files in os.walk(img_path):
for f in files:
if f.endswith(".jpg"):
path = os.path.join(root, f)
print(f"Testing with {path}")
frame = cv2.imread(path)
res = fe.match_frame(frame)
print(res)
break
else:
continue
break
|