added pickling from animation test.

This commit is contained in:
CiscoTheWolf 2023-05-31 19:51:05 +02:00
parent 37dd54aff7
commit 74b1a44168

View file

@ -9,6 +9,8 @@ import paho.mqtt.client as mqtt
import time
import threading
import pickle
print("start configuring matrix")
startT = curr_time = round(time.time()*1000)
@ -113,20 +115,9 @@ for alpha in range(0,11):
mouth = points_left_mouth + mirror_points(points_left_mouth)
face = left_eye + right_eye + nose + mouth
print("start gen image")
startTa = curr_time = round(time.time()*1000)
interpolated_face_image = generate_image_from_point_array(face, 128, 32)
endTa = curr_time = round(time.time()*1000)
print("gen image took: " + str(endTa - startTa) + " ms")
blinkFrameCanvases.append(offscreen_interpolated_canvas)
print("start populating matrices for each blink frame")
startTa = curr_time = round(time.time()*1000)
offscreen_interpolated_canvas.SetImage(interpolated_face_image, unsafe=False)
endTa = curr_time = round(time.time()*1000)
print("populating matrices for each blink frame took: " + str(endTa - startTa) + " ms")
blinkFrameCanvases.append(offscreen_interpolated_canvas)
endT = curr_time = round(time.time()*1000)
@ -138,6 +129,10 @@ proot_state.set_blinks_frames_ready(True)
proot_state.blink()
# Store the object to disk
with open('my_object.pickle', 'wb') as file:
pickle.dump(blinkFrameCanvases, file)
# functions called by the MQTT listener
def on_connect(client, userdata, flags, response_code):