User:Nrp/Weekly updates/20080607

From OLPC
Jump to: navigation, search

From: http://eclecti.cc/olpc/pygame-webcam-support

There was a three day weekend here, so I got some real coding done on my GSoC project.

You can pull the code I’m working on from my repository at http://git.n0r.org/?p=pygame-nrp;a=summary

It is currently barely alpha quality, but it supports v4l2 cameras that use MMAP and YUYV or RGB24 pixelformats. That means it’ll work on the OLPC XO, though you’ll need to install gcc, SDL-devel, and probably some other stuff to compile it.

You can open a camera with: cam = camera.Camera(device, (width, height)) Device in most cases is going to be “/dev/video0″. (width, height) will probably be (640, 480). You then need to start the camera with cam.start(). cam.get_image() will return an RGB Surface. cam.close() closes the camera if necessary.