show fps in playframes

This commit is contained in:
Jeff Epler 2025-01-15 21:54:51 -06:00
parent 862b7fb1d5
commit 4ef2d552ce

View file

@ -11,6 +11,7 @@ The image files are sorted and then played repeatedly until interrupted with ctr
import glob
import sys
import time
import adafruit_raspberry_pi5_piomatter
import numpy as np
@ -20,10 +21,15 @@ images = sorted(glob.glob(sys.argv[1]))
geometry = adafruit_raspberry_pi5_piomatter.Geometry(width=64, height=32, n_addr_lines=4, rotation=adafruit_raspberry_pi5_piomatter.Orientation.Normal)
framebuffer = np.asarray(Image.open(images[0])) + 0 # Make a mutable copy
nimages = len(images)
matrix = adafruit_raspberry_pi5_piomatter.AdafruitMatrixBonnetRGB888Packed(framebuffer, geometry)
while True:
t0 = time.monotonic()
for i in images:
print(i)
framebuffer[:] = np.asarray(Image.open(i))
matrix.show()
t1 = time.monotonic()
dt = t1 - t0
fps = nimages/dt
print(f"{nimages} frames in {dt}s, {fps}fps")