From 09126eb3fbea2ef308ac8591b93c36aff751e569 Mon Sep 17 00:00:00 2001 From: seranus Date: Mon, 6 Dec 2021 23:16:53 +0100 Subject: [PATCH] label face added --- utils/label_face.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 utils/label_face.py diff --git a/utils/label_face.py b/utils/label_face.py new file mode 100644 index 0000000..6e63346 --- /dev/null +++ b/utils/label_face.py @@ -0,0 +1,16 @@ +import cv2 +from pathlib import Path +import numpy as np +import os + +def label_face_filename(face, filename): + text = os.path.splitext(os.path.basename(filename))[0] + font = cv2.FONT_HERSHEY_SIMPLEX + org = (5, face.shape[0] - 10) + thickness = 1 + fontScale = 0.5 + color = (255, 255, 255) + face = face.copy() # numpy array issue + cv2.putText(face, text, org, font, fontScale, color, thickness, cv2.LINE_AA) + + return face