Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Migushthe2nd committed Apr 12, 2020
2 parents 5c52a7f + e14ba30 commit 267ca89
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions faceit_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -250,19 +255,31 @@ 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<len(img_list)-1:
pos=pos-1
else:
pos=0
return readimage()

def readnextimage(position=-1):
global img_list,pos,img_shape
global pos
if (position != -1):
pos = position
else:
if pos<len(img_list)-1:
pos=pos+1
else:
pos=0
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
return readimage()

main()

0 comments on commit 267ca89

Please sign in to comment.