Test c/p of python code from github
import pygame, pygame.camera, time
from guild.actor import *
pygame.camera.init()
class Camera(Actor):
def main(self):
camera = pygame.camera.Camera(pygame.camera.list_cameras()[0])
camera.start()
while True:
yield 1
frame = camera.get_image()
self.output(frame)
time.sleep(1.0/50)
class Display(Actor):
def __init__(self, size):
super(Display, self).__init__()
self.size = size
def process_start(self):
self.display = pygame.display.set_mode(self.size)
@actor_method
def show(self, frame):
self.display.blit(frame, (0,0))
pygame.display.flip()
input = show
camera = Camera().go()
display = Display( (800,600) ).go()
pipeline(camera, display)
time.sleep(30)
stop(camera, display)
wait_for(camera, display)
Test c/p of python code from an editor:
import pygame, pygame.camera, time
from guild.actor import *
pygame.camera.init()
class Camera(Actor):
def main(self):
camera = pygame.camera.Camera(pygame.camera.list_cameras()[0])
camera.start()
while True:
yield 1
frame = camera.get_image()
self.output(frame)
time.sleep(1.0/50)
class Display(Actor):
def __init__(self, size):
super(Display, self).__init__()
self.size = size
def process_start(self):
self.display = pygame.display.set_mode(self.size)
@actor_method
def show(self, frame):
self.display.blit(frame, (0,0))
pygame.display.flip()
input = show
camera = Camera().go()
display = Display( (800,600) ).go()
pipeline(camera, display)
time.sleep(30)
stop(camera, display)
wait_for(camera, display)
Michael