9 def __init__(self, vid=0):
10 self._cam = cv.CreateCameraCapture(vid)
13 for _ in range(5): #HACK
14 im = cv.QueryFrame(self._cam)
15 # Add the line below if you need it (Ubuntu 8.04+)
17 #convert Ipl image to PIL image
18 return Image.fromstring("RGB", cv.GetSize(im), im.tostring(), "raw",
25 elif os.name in ('ce', 'nt', 'dos'):
27 from VideoCapture import Device
29 # TODO exception handling
33 self._cam.setResolution(640, 480)
36 return self._cam.getImage()