Merge pull request #28 from henryruhs/main

Skip processing if there is no face, print output to console
This commit is contained in:
Somdev Sangwan 2023-05-29 19:31:47 +05:30 committed by GitHub
commit 7041bad118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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