added pickling from animation test.
This commit is contained in:
parent
37dd54aff7
commit
74b1a44168
1 changed files with 6 additions and 11 deletions
|
|
@ -9,6 +9,8 @@ import paho.mqtt.client as mqtt
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
import pickle
|
||||||
|
|
||||||
|
|
||||||
print("start configuring matrix")
|
print("start configuring matrix")
|
||||||
startT = curr_time = round(time.time()*1000)
|
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)
|
mouth = points_left_mouth + mirror_points(points_left_mouth)
|
||||||
face = left_eye + right_eye + nose + 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)
|
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)
|
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)
|
blinkFrameCanvases.append(offscreen_interpolated_canvas)
|
||||||
|
|
||||||
endT = curr_time = round(time.time()*1000)
|
endT = curr_time = round(time.time()*1000)
|
||||||
|
|
@ -138,6 +129,10 @@ proot_state.set_blinks_frames_ready(True)
|
||||||
proot_state.blink()
|
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
|
# functions called by the MQTT listener
|
||||||
def on_connect(client, userdata, flags, response_code):
|
def on_connect(client, userdata, flags, response_code):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue