Skip processing if there is no face, print output to console

This commit is contained in:
henryruhs 2023-05-29 15:47:57 +02:00
parent fa813d8025
commit 31de5fde57

View File

@ -14,9 +14,14 @@ def process_video(source_img, frame_paths):
frame = cv2.imread(frame_path) frame = cv2.imread(frame_path)
try: try:
face = get_face(frame) face = get_face(frame)
if face:
result = face_swapper.get(frame, face, source_face, paste_back=True) result = face_swapper.get(frame, face, source_face, paste_back=True)
cv2.imwrite(frame_path, result) cv2.imwrite(frame_path, result)
print('.', end='', flush=True)
else:
print('S', end='', flush=True)
except Exception as e: except Exception as e:
print('E', end='', flush=True)
pass pass