Living Pointillism: A pygame webcam script

Living Pointillism

Living Pointillism is a quick little example script I wrote to showcase the camera module I’m writing for pygame through GSoC.  It places a few dozen points (it automatically changes the number based on the framerate) for every frame of video, so the image is only clear if everything is perfectly still.  This also results in some interesting visual effects when things are in motion.  The screenshot above doesn’t quite capture the essence of it, but I don’t have the kind of bandwidth here to upload a video.

To use it, you need pygame with the camera module, which is currently only available from my repository: http://git.n0r.org/?p=pygame-nrp;a=summary

It runs fairly well on the OLPC XO too, and I’ll release an Activity for it along with an rpm of my branch of pygame soon.

Download: Living Pointillism

Update: This is now available packaged as an OLPC Activity.

Update 2: Pygame with the camera module should now be downloaded from the Pygame SVN.

10 Comments on Living Pointillism: A pygame webcam script

Pygame Webcam Support

Update: Grab the up to date code in Pygame >1.9.1 from the Pygame repository.

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.

6 Comments on Pygame Webcam Support