aboutsummaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorjaseg <jaseg@jaseg.net>2014-02-18 21:36:35 +0100
committerjaseg <jaseg@jaseg.net>2014-02-18 21:36:35 +0100
commitbd5b1b6267ff6db530c657b5adb61edeea18e14b (patch)
tree8bc8955c71093a62861c6ef85ae145282de6a9fe /host
parent03bf7d9d49956fc06744bb1898c492ba35d34367 (diff)
downloadmatelight-bd5b1b6267ff6db530c657b5adb61edeea18e14b.tar.gz
matelight-bd5b1b6267ff6db530c657b5adb61edeea18e14b.tar.bz2
matelight-bd5b1b6267ff6db530c657b5adb61edeea18e14b.zip
added variables for brightness and gamma factor
Diffstat (limited to 'host')
-rw-r--r--host/matelight.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/host/matelight.py b/host/matelight.py
index cf5eff5..91a158f 100644
--- a/host/matelight.py
+++ b/host/matelight.py
@@ -13,6 +13,12 @@ DISPLAY_HEIGHT = CRATES_Y*CRATE_HEIGHT
CRATE_SIZE = CRATE_WIDTH*CRATE_HEIGHT*3
FRAME_SIZE = DISPLAY_WIDTH*DISPLAY_HEIGHT
+# Gamma factor
+GAMMA = 2.5
+
+# Brightness of the LEDs in percent. 1.0 means 100%.
+BRIGHTNESS = 0.2
+
dev = usb.core.find(idVendor=0x1cbe, idProduct=0x0003)
def sendframe(framedata):
@@ -22,7 +28,7 @@ def sendframe(framedata):
channel is ignored.
"""
# Gamma correction
- framedata = (((framedata/255) ** 2.5) * 255).astype(np.uint8)
+ framedata = (((framedata/255) ** GAMMA) * BRIGHTNESS * 255).astype(np.uint8)
for cx, cy in product(range(CRATES_X), range(CRATES_Y)):
datar = framedata[cy*CRATE_HEIGHT:(cy+1)*CRATE_HEIGHT, cx*CRATE_WIDTH:(cx+1)*CRATE_WIDTH, :3]
data = datar.flat