Timing issues + issue with changing face expression
The following simple code should:
- display the neutral face
- after 5s, display a happy face
However:
- the happy face is not displayed
- the blinking is too slow
from expressive_eyes.face_manager import FaceManager
import cv2
import time
fm = FaceManager(512, 384)
elapsed_time = 0
begin_time = time.time()
face_changed = False
expression = "Neutral"
while True:
face = fm.run_expressive_eyes(face_str=expression, elapsed_time=0.016)
elapsed_time = time.time() - begin_time
if elapsed_time > 5 and not face_changed:
face_changed = True
print("Changing face!")
expression = "Happy"
# I am not sure about the following wait_time.
#wait_time = int(elapsed_time/2)
# This waitKey is needed to properly display the interpolated face
cv2.waitKey(16)
# This is needed to display the face render
cv2.imshow("Face", face)