Added the mouth and nose to be loaded and dawn with the blink animation.
This commit is contained in:
parent
b847c29a03
commit
5180c414b7
1 changed files with 21 additions and 10 deletions
|
|
@ -168,8 +168,11 @@ print("configuring matrix took: " + str(endT - startT) + " ms")
|
|||
print("start loading images")
|
||||
startT = curr_time = round(time.time()*1000)
|
||||
|
||||
Image1 = Image.open("faces/eyeLeftOpen.png")
|
||||
Image2 = Image.open("faces/eyeLeftClosed.png")
|
||||
# Loading all images
|
||||
image_left_eye_open = Image.open("faces/eyeLeftOpen.png")
|
||||
image_left_eye_closed = Image.open("faces/eyeLeftClosed.png")
|
||||
image_left_nose = Image.open("faces/noseLeft.png")
|
||||
image_left_mouth = Image.open("faces/mouthLeft.png")
|
||||
|
||||
endT = curr_time = round(time.time()*1000)
|
||||
print("loading images took: " + str(endT - startT) + " ms")
|
||||
|
|
@ -179,8 +182,11 @@ print("loading images took: " + str(endT - startT) + " ms")
|
|||
print("start generating pixel array")
|
||||
startT = curr_time = round(time.time()*1000)
|
||||
|
||||
pixelArray1 = generate_point_array_from_image(Image1)
|
||||
pixelArray2 = generate_point_array_from_image(Image2)
|
||||
# generate pixel arrays from each image
|
||||
points_left_eye_open = generate_point_array_from_image(image_left_eye_open)
|
||||
points_left_eye_closed = generate_point_array_from_image(image_left_eye_closed)
|
||||
points_left_nose = generate_point_array_from_image(image_left_nose)
|
||||
points_left_mouth = generate_point_array_from_image(image_left_mouth)
|
||||
|
||||
endT = curr_time = round(time.time()*1000)
|
||||
print("generating pixel array took: " + str(endT - startT) + " ms")
|
||||
|
|
@ -192,7 +198,8 @@ print("generating pixel array took: " + str(endT - startT) + " ms")
|
|||
print("start pairing points for one eye")
|
||||
startT = curr_time = round(time.time()*1000)
|
||||
|
||||
LeftEyeBlinkPairs = pair_points(pixelArray1, pixelArray2)
|
||||
#calculate the point pairs between the open and closed left eye
|
||||
left_eye_blink_pairs = pair_points(points_left_eye_open, points_left_eye_closed)
|
||||
|
||||
endT = curr_time = round(time.time()*1000)
|
||||
print("pairing points for one eye took: " + str(endT - startT) + " ms")
|
||||
|
|
@ -209,11 +216,15 @@ startT = curr_time = round(time.time()*1000)
|
|||
|
||||
for alpha in range(0,11):
|
||||
offscreen_interpolated_canvas = matrix.CreateFrameCanvas()
|
||||
leftEye = interpolate_point_pairs(LeftEyeBlinkPairs, alpha/10)
|
||||
RightEye = mirror_points(leftEye)
|
||||
face = leftEye + RightEye
|
||||
interpolated_image = generate_image_from_point_array(face, 128, 32)
|
||||
offscreen_interpolated_canvas.SetImage(interpolated_image, unsafe=False)
|
||||
|
||||
left_eye = interpolate_point_pairs(left_eye_blink_pairs, alpha/10)
|
||||
right_eye = mirror_points(left_eye)
|
||||
nose = points_left_nose + mirror_points(points_left_nose)
|
||||
mouth = points_left_mouth + mirror_points(points_left_mouth)
|
||||
face = left_eye + right_eye + nose + mouth
|
||||
|
||||
interpolated_face_image = generate_image_from_point_array(face, 128, 32)
|
||||
offscreen_interpolated_canvas.SetImage(interpolated_face_image, unsafe=False)
|
||||
blinkFrameCanvases.append(offscreen_interpolated_canvas)
|
||||
|
||||
endT = curr_time = round(time.time()*1000)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue