aboutsummaryrefslogtreecommitdiff
path: root/host/matelight/nyancat-test.py
diff options
context:
space:
mode:
authorjaseg <jaseg@jaseg.net>2013-12-27 03:02:26 +0100
committerjaseg <jaseg@jaseg.net>2013-12-27 03:02:26 +0100
commita95e0305aeaffadf071e963863c102b30b76993a (patch)
treec499d709443fbef32c3b03c8ecaee5e23d3ce2a9 /host/matelight/nyancat-test.py
parentf2731bac95ebcd91a2a4b289fefa635ae7c34094 (diff)
downloadmatelight-a95e0305aeaffadf071e963863c102b30b76993a.tar.gz
matelight-a95e0305aeaffadf071e963863c102b30b76993a.tar.bz2
matelight-a95e0305aeaffadf071e963863c102b30b76993a.zip
Some fixes to the host software geom stuff, added a small demo script
Diffstat (limited to 'host/matelight/nyancat-test.py')
-rwxr-xr-xhost/matelight/nyancat-test.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/host/matelight/nyancat-test.py b/host/matelight/nyancat-test.py
new file mode 100755
index 0000000..aaabe85
--- /dev/null
+++ b/host/matelight/nyancat-test.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+import host
+import numpy as np
+from config import *
+from PIL import Image, ImageSequence
+import time
+
+img1 = Image.open(open('../nyancat.png', 'rb'))
+img2 = Image.open(open('../nyancat2.png', 'rb'))
+scroller = Image.open(open('../scroller.png', 'rb'))
+datas = []
+for img in [img1, img2]:
+ im = img.convert("RGB")
+ im.thumbnail((DISPLAY_WIDTH, DISPLAY_HEIGHT), Image.NEAREST)
+ data = np.array(im.getdata(), dtype=np.uint8)
+ datas += [data.reshape((DISPLAY_HEIGHT, DISPLAY_WIDTH, 3))]
+
+im = scroller.convert("RGB")
+bar = np.array(im.getdata(), dtype=np.uint8)
+foo = bar.reshape((DISPLAY_HEIGHT, 300, 3))
+
+while True:
+ for i in range(20):
+ for data in datas:
+ host.sendframe(data)
+ time.sleep(0.1)
+ for i in range(260):
+ host.sendframe(foo[:, i:i+40, :])
+