Crop frame to face box

This commit is contained in:
Nicolas Mowen 2024-10-21 10:59:28 -06:00
parent ed243846cc
commit 33b0958531

View File

@ -288,7 +288,21 @@ class EmbeddingMaintainer(threading.Thread):
if not face: if not face:
return return
# TODO crop frame to face box face_box = face.get("box")
if not face_box:
return
face_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
face_frame = face_frame[face_box[1] : face_box[3], face_box[0] : face_box[2]]
# if face_frame is not None:
# cv2.imwrite(
# "/media/frigate/face_crop.webp",
# face_frame,
# [int(cv2.IMWRITE_WEBP_QUALITY), 60],
# )
# TODO run embedding on face box # TODO run embedding on face box
# TODO compare embedding to faces in embeddings DB to fine cosine similarity # TODO compare embedding to faces in embeddings DB to fine cosine similarity
# TODO check against threshold and min score to see if best face qualifies # TODO check against threshold and min score to see if best face qualifies