Added another timer for configuring matrix
This commit is contained in:
parent
a5246021f9
commit
215028dad9
1 changed files with 26 additions and 16 deletions
|
|
@ -5,14 +5,7 @@ from PIL import Image
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
# Configuration for the matrix
|
|
||||||
options = RGBMatrixOptions()
|
|
||||||
options.rows = 32
|
|
||||||
options.cols = 64
|
|
||||||
options.chain_length = 2
|
|
||||||
options.parallel = 1
|
|
||||||
options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat'
|
|
||||||
matrix = RGBMatrix(options=options)
|
|
||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
@ -162,24 +155,41 @@ def interpolate_point_pairs(pairs: list[tuple[Point2D, Point2D]], percentage: fl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("start configuring matrix")
|
||||||
|
startT = curr_time = round(time.time())
|
||||||
|
|
||||||
|
# Configuration for the matrix
|
||||||
|
options = RGBMatrixOptions()
|
||||||
|
options.rows = 32
|
||||||
|
options.cols = 64
|
||||||
|
options.chain_length = 2
|
||||||
|
options.parallel = 1
|
||||||
|
options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat'
|
||||||
|
matrix = RGBMatrix(options=options)
|
||||||
|
|
||||||
|
endT = curr_time = round(time.time())
|
||||||
|
print("configuring matrix took: " + str(endT - startT))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("start loading images")
|
print("start loading images")
|
||||||
startT = curr_time = round(time.time()*1000)
|
startT = curr_time = round(time.time())
|
||||||
|
|
||||||
Image1 = Image.open("faces/eyeLeftOpen.png")
|
Image1 = Image.open("faces/eyeLeftOpen.png")
|
||||||
Image2 = Image.open("faces/eyeLeftClosed.png")
|
Image2 = Image.open("faces/eyeLeftClosed.png")
|
||||||
|
|
||||||
endT = curr_time = round(time.time()*1000)
|
endT = curr_time = round(time.time())
|
||||||
print("loading images took: " + str(endT - startT))
|
print("loading images took: " + str(endT - startT))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("start generating pixel array")
|
print("start generating pixel array")
|
||||||
startT = curr_time = round(time.time()*1000)
|
startT = curr_time = round(time.time())
|
||||||
|
|
||||||
pixelArray1 = generate_point_array_from_image(Image1)
|
pixelArray1 = generate_point_array_from_image(Image1)
|
||||||
pixelArray2 = generate_point_array_from_image(Image2)
|
pixelArray2 = generate_point_array_from_image(Image2)
|
||||||
|
|
||||||
endT = curr_time = round(time.time()*1000)
|
endT = curr_time = round(time.time())
|
||||||
print("generating pixel array took: " + str(endT - startT))
|
print("generating pixel array took: " + str(endT - startT))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -187,11 +197,11 @@ print("generating pixel array took: " + str(endT - startT))
|
||||||
|
|
||||||
|
|
||||||
print("start pairing points for one eye")
|
print("start pairing points for one eye")
|
||||||
startT = curr_time = round(time.time()*1000)
|
startT = curr_time = round(time.time())
|
||||||
|
|
||||||
LeftEyeBlinkPairs = pair_points(pixelArray1, pixelArray2)
|
LeftEyeBlinkPairs = pair_points(pixelArray1, pixelArray2)
|
||||||
|
|
||||||
endT = curr_time = round(time.time()*1000)
|
endT = curr_time = round(time.time())
|
||||||
print("pairing points for one eye took: " + str(endT - startT))
|
print("pairing points for one eye took: " + str(endT - startT))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -202,7 +212,7 @@ blinkFrameCanvases = []
|
||||||
|
|
||||||
|
|
||||||
print("start populating matrices for each blink frame")
|
print("start populating matrices for each blink frame")
|
||||||
startT = curr_time = round(time.time()*1000)
|
startT = curr_time = round(time.time())
|
||||||
|
|
||||||
for alpha in range(0,11):
|
for alpha in range(0,11):
|
||||||
offscreen_interpolated_canvas = matrix.CreateFrameCanvas()
|
offscreen_interpolated_canvas = matrix.CreateFrameCanvas()
|
||||||
|
|
@ -213,7 +223,7 @@ for alpha in range(0,11):
|
||||||
offscreen_interpolated_canvas.SetImage(interpolated_image, unsafe=False)
|
offscreen_interpolated_canvas.SetImage(interpolated_image, unsafe=False)
|
||||||
blinkFrameCanvases.append(offscreen_interpolated_canvas)
|
blinkFrameCanvases.append(offscreen_interpolated_canvas)
|
||||||
|
|
||||||
endT = curr_time = round(time.time()*1000)
|
endT = curr_time = round(time.time())
|
||||||
print("populating matrices for each blink frame took: " + str(endT - startT))
|
print("populating matrices for each blink frame took: " + str(endT - startT))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue