From e6ae4cf7671f99d32e24c30994e1027981fb0812 Mon Sep 17 00:00:00 2001 From: Somdev Sangwan Date: Mon, 29 May 2023 17:50:42 +0530 Subject: [PATCH] handle no face cases --- run.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run.py b/run.py index 184a80a..3acdf00 100644 --- a/run.py +++ b/run.py @@ -8,9 +8,11 @@ from tkinter import filedialog from tkinter.filedialog import asksaveasfilename from core.processor import process_video, process_img from core.utils import is_img, detect_fps, set_fps, create_video, add_audio, extract_frames +from core.config import get_face import webbrowser import psutil import shutil +import cv2 pool = None args = {} @@ -67,6 +69,10 @@ def start(): global pool pool = mp.Pool(psutil.cpu_count()-1) target_path = args['target_path'] + test_face = get_face(cv2.imread(args['source_img'])) + if not test_face: + print("\n[WARNING] No face detected in source image. Please try with another one.\n") + return if is_img(target_path): process_img(args['source_img'], target_path) return