from PIL import Image, ImageDraw

SRC = '/root/.hermes/webui/attachments/9710c799d486/'
man = Image.open(SRC + '707f2402-9eb3-4aa0-a58b-fbb46d61815f.jpg').crop((0, 250, 946, 1180))
woman = Image.open(SRC + 'e461f313-7e7d-4183-93b2-f3d0e9756d73.jpg').crop((0, 250, 946, 1180))

# Show face regions with nose markers
def debug(img, face_x0, face_y0, face_x1, face_y1, nose_y, label):
    d = ImageDraw.Draw(img)
    d.rectangle([face_x0, face_y0, face_x1, face_y1], outline=(255, 0, 0), width=4)
    d.line([face_x0, nose_y, face_x1, nose_y], fill=(0, 255, 0), width=3)
    img.save(f'/root/workspace/debug_tb_{label}.jpg', quality=95)
    print(f'{label}: face=[{face_x0},{face_y0},{face_x1},{face_y1}], nose_y={nose_y}')

debug(man.copy(), 390, 260, 946, 800, 545, 'man')
debug(woman.copy(), 120, 95, 860, 720, 400, 'woman')
