Key B for previous image

pull/4/head
Migushthe2nd 4 years ago
parent d5092a35fe
commit e14ba3008e

@ -174,9 +174,14 @@ def main():
print("Centering the image") print("Centering the image")
# center # center
reset = True reset = True
elif k==ord('b'):
# rotate images
print("Loading previous image")
source_image = readpreviousimage()
reset = True
elif k==ord('n'): elif k==ord('n'):
# rotate images # rotate images
print("Loading new image") print("Loading next image")
source_image = readnextimage() source_image = readnextimage()
reset = True reset = True
elif k==ord('t'): 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 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<len(img_list)-1:
pos=pos-1
else:
pos=0
return readimage()
def readnextimage(position=-1): def readnextimage(position=-1):
global img_list,pos,img_shape global pos
if (position != -1): if (position != -1):
pos = position pos = position
else: else:
@ -259,10 +280,6 @@ def readnextimage(position=-1):
pos=pos+1 pos=pos+1
else: else:
pos=0 pos=0
img = imageio.imread(img_list[pos]) return readimage()
img_shape = img.shape
cv2.resizeWindow('DeepFake', int(img_shape[1] / img_shape[0] * 256), 256)
img = resize(img, (256, 256))[..., :3]
return img
main() main()
Loading…
Cancel
Save