mood box shape

This commit is contained in:
Şefik Serangil 2020-04-01 15:49:29 +03:00
parent 879592b80d
commit 6482e1b20e
3 changed files with 27 additions and 17 deletions

View File

@ -229,8 +229,9 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True):
if x+w+pivot_img_size < resolution_x:
#right
cv2.rectangle(freeze_img
, (x+w,y+20)
, (x+w+pivot_img_size, y+180)
#, (x+w,y+20)
, (x+w,y)
, (x+w+pivot_img_size, y+h)
, (64,64,64),cv2.FILLED)
cv2.addWeighted(overlay, opacity, freeze_img, 1 - opacity, 0, freeze_img)
@ -238,8 +239,9 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True):
elif x-pivot_img_size > 0:
#left
cv2.rectangle(freeze_img
, (x-pivot_img_size,y+20)
, (x, y+180)
#, (x-pivot_img_size,y+20)
, (x-pivot_img_size,y)
, (x, y+h)
, (64,64,64),cv2.FILLED)
cv2.addWeighted(overlay, opacity, freeze_img, 1 - opacity, 0, freeze_img)
@ -253,21 +255,29 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True):
if x+w+pivot_img_size < resolution_x:
cv2.putText(freeze_img, emotion_label, (x+w, y + 20 + (index+1) * 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
text_location_y = y + 20 + (index+1) * 20
text_location_x = x+w
cv2.rectangle(freeze_img
, (x+w+70, y + 13 + (index+1) * 20)
, (x+w+70+bar_x, y + 13 + (index+1) * 20 + 5)
, (255,255,255), cv2.FILLED)
if text_location_y < y + h:
cv2.putText(freeze_img, emotion_label, (text_location_x, text_location_y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
cv2.rectangle(freeze_img
, (x+w+70, y + 13 + (index+1) * 20)
, (x+w+70+bar_x, y + 13 + (index+1) * 20 + 5)
, (255,255,255), cv2.FILLED)
elif x-pivot_img_size > 0:
cv2.putText(freeze_img, emotion_label, (x-pivot_img_size, y + 20 + (index+1) * 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
text_location_y = y + 20 + (index+1) * 20
text_location_x = x-pivot_img_size
cv2.rectangle(freeze_img
, (x-pivot_img_size+70, y + 13 + (index+1) * 20)
, (x-pivot_img_size+70+bar_x, y + 13 + (index+1) * 20 + 5)
, (255,255,255), cv2.FILLED)
if text_location_y <= y+h:
cv2.putText(freeze_img, emotion_label, (text_location_x, text_location_y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
cv2.rectangle(freeze_img
, (x-pivot_img_size+70, y + 13 + (index+1) * 20)
, (x-pivot_img_size+70+bar_x, y + 13 + (index+1) * 20 + 5)
, (255,255,255), cv2.FILLED)
#-------------------------------

View File

@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="deepface",
version="0.0.11",
version="0.0.12",
author="Sefik Ilkin Serengil",
author_email="serengil@gmail.com",
description="Deep Face Analysis Framework for Face Recognition and Demography",