From 61697de659985da6e1f6bd2c79b6961c4a45e8c6 Mon Sep 17 00:00:00 2001 From: gocivici Date: Fri, 27 Oct 2023 11:43:59 +0300 Subject: [PATCH] fear point average --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 40ef6f8..4ac2fbd 100644 --- a/main.py +++ b/main.py @@ -59,8 +59,9 @@ if cam.isOpened(): img = cv2.rotate(img, cv2.ROTATE_90_COUNTERCLOCKWISE) # img = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE) predictions = DeepFace.analyze(img,actions=['emotion']) - fearPoint = predictions[0]["emotion"]["fear"] - surprisePoint = predictions[0]["emotion"]["surprise"] + fearValue = predictions[0]["emotion"]["fear"] + surpriseValue = predictions[0]["emotion"]["surprise"] + fearPoint = max(fearValue,surpriseValue) print("FEAR:" + str(round(fearPoint,2))) print("SURPRISE:" + str(round(surprisePoint,2))) imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) @@ -93,8 +94,9 @@ if cam.isOpened(): printer.set(align='center',font='b',width=2,height=2) printer.image("cropScared.jpg",high_density_vertical=True,high_density_horizontal=False,impl="bitImageRaster") - printer.text("Fear Level: \n" + str(round(fearPoint,2))+"/100\n") - printer.text("Surprise Level: \n" + str(round(surprisePoint,2))+"/100\n") + printer.text("Fear Level: \n" + str(round(fearValue,2))+"/100\n") + printer.text("Surprise Level: \n" + str(round(surpriseValue,2))+"/100\n") + printer.text("Overall: \n" + str(round(fearPoint,2))+"/100\n") #printer.text("(Scream Queen)\n") printer.text("\n\n\n\n") #printer.set(align='center',font='b',width=1,height=1)