From 850e91f209b3643f130787d49255a4386f30a6a7 Mon Sep 17 00:00:00 2001 From: Feier Zhang Date: Sun, 28 Mar 2021 18:02:09 -0400 Subject: [PATCH] Test on Raspberry pi successfully, fix some small staff --- Facial_Recognition_Inference.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Facial_Recognition_Inference.py b/Facial_Recognition_Inference.py index faf75f8c3..331f5781a 100644 --- a/Facial_Recognition_Inference.py +++ b/Facial_Recognition_Inference.py @@ -47,6 +47,7 @@ def inference(): img = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) faces = faceDetector(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) + minDistance = 0.0 for face in faces: @@ -81,12 +82,12 @@ def inference(): # print("time taken = {:.3f} seconds".format(time.time() - t)) - cv2.rectangle(im, (x1, y1), (x2, y2), (0, 255, 0), 2) - font_face = cv2.FONT_HERSHEY_SIMPLEX - font_scale = 0.8 - text_color = (0, 255, 0) - printLabel = '{} {:0.4f}'.format(label, minDistance) - cv2.putText(im, printLabel, (int(x1), int(y1)), font_face, font_scale, text_color, thickness=2) + cv2.rectangle(im, (x1, y1), (x2, y2), (0, 255, 0), 2) + font_face = cv2.FONT_HERSHEY_SIMPLEX + font_scale = 0.8 + text_color = (0, 255, 0) + printLabel = '{} {:0.4f}'.format(label, minDistance) + cv2.putText(im, printLabel, (int(x1), int(y1)), font_face, font_scale, text_color, thickness=2) cv2.imshow('img', im)