Files
WallE/cameraworker.py

28 lines
480 B
Python

import sched
from redis import Redis
from control.camera import Camera
INTERVAL_IMAGE = 0.05 # 20/s
scheduler = sched.scheduler()
camera = Camera()
def camera_image():
scheduler.enter(INTERVAL_IMAGE, 1, camera_image)
image, face = camera.get_image()
redisdb.publish('image', image)
scheduler.enter(INTERVAL_IMAGE, 1, camera_image)
if __name__ == '__main__':
redisdb = Redis()
try:
scheduler.run()
except KeyboardInterrupt:
raise