Tuesday, January 4, 2011

Webcam Videocapture pygame psyco (Make ur code fast!!)

import pygame
from PIL import Image

import psyco
psyco.full()


from VideoCapture import Device

cam=Device()
cam.setResolution(320,240)
im=cam.getImage()

pygame.init()
screen=pygame.display.set_mode(im.size)

pix=im.load()
a=pygame.image.frombuffer(im.tostring(), im.size, im.mode)
screen.blit(a, (0,0))
pygame.display.flip()

No comments:

Post a Comment