Here’s a quick script to do a webcam using pyGame.
It works rather well on a Nokia n900 (while there are some issues getting hold of the webcam image on Mac OSX …).
Copy the text into a textfile and name it as you please – without spaces though. Then copy the file to the n900, and run it using “python YourScriptName” < where you replace “YourScriptName” with the name of your script. ( You may find some instructions for transferring files and running them, on the n900, here ).
# import the relevant libraries import time import pygame import pygame.camera from pygame.locals import *
# this is where one sets how long the script # sleeps for, between frames.sleeptime__in_seconds = 0.05 # initialise the display window screen = pygame.display.set_mode([800,420]) pygame.init() pygame.camera.init() # set up a camera object cam = pygame.camera.Camera("/dev/video0",(640,480)) # start the camera cam.start() while 1: # sleep between every frame time.sleep( sleeptime__in_seconds ) # fetch the camera image image = cam.get_image() # blank out the screen screen.fill([0,0,0]) # copy the camera image to the screen screen.blit( image, ( 100, 0 ) ) # update the screen to show the latest screen image pygame.display.update()