From d5092a35fe3e11bcebdd3caaaa54f42bf4c68cdd Mon Sep 17 00:00:00 2001 From: Migushthe2nd Date: Sun, 12 Apr 2020 21:57:30 +0200 Subject: [PATCH 1/2] Also resize first image --- faceit_live.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faceit_live.py b/faceit_live.py index 7b99fe6..7032376 100644 --- a/faceit_live.py +++ b/faceit_live.py @@ -113,7 +113,7 @@ def main(): cv2.namedWindow('DeepFake', cv2.WINDOW_GUI_NORMAL) # face transformation cv2.moveWindow('DeepFake', int(screen_width/2)+150, 100) - cv2.resizeWindow('DeepFake', 256,256) + cv2.resizeWindow('DeepFake', int(img_shape[1] / img_shape[0] * 256), 256) cv2.namedWindow('Stream', cv2.WINDOW_GUI_NORMAL) # rendered to fake webcam From e14ba3008e4f99a37806f431f3bf1e93500fa8cd Mon Sep 17 00:00:00 2001 From: Migushthe2nd Date: Sun, 12 Apr 2020 22:08:20 +0200 Subject: [PATCH 2/2] Key B for previous image --- faceit_live.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/faceit_live.py b/faceit_live.py index 7032376..8a87181 100644 --- a/faceit_live.py +++ b/faceit_live.py @@ -174,9 +174,14 @@ def main(): print("Centering the image") # center reset = True + elif k==ord('b'): + # rotate images + print("Loading previous image") + source_image = readpreviousimage() + reset = True elif k==ord('n'): # rotate images - print("Loading new image") + print("Loading next image") source_image = readnextimage() reset = True elif k==ord('t'): @@ -250,8 +255,24 @@ def find_face_cut(net,face,previous=False): return cut_x1,cut_y1,cut_x2,cut_y2 +def readimage(): + global img_list,img_shape + img = imageio.imread(img_list[pos]) + img_shape = img.shape + cv2.resizeWindow('DeepFake', int(img_shape[1] / img_shape[0] * 256), 256) + img = resize(img, (256, 256))[..., :3] + return img + +def readpreviousimage(): + global pos + if pos