9 def __init__(self, device=0):
10 self._cam = cv.CaptureFromCAM(device)
11 print cv.GetCaptureProperty(self._cam, cv.CV_CAP_PROP_CONVERT_RGB)
12 cv.SetCaptureProperty(self._cam, cv.CV_CAP_PROP_CONVERT_RGB, True)
15 for _ in range(8): #HACK
16 im = cv.QueryFrame(self._cam)
17 # Add the line below if you need it (Ubuntu 8.04+)
19 #convert Ipl image to PIL image
20 return Image.fromstring("RGB", cv.GetSize(im), im.tostring())
26 elif os.name in ('ce', 'nt', 'dos'):
28 from VideoCapture import Device
30 # TODO exception handling
32 def __init__(self, device=0):
34 self._cam.setResolution(640, 480)
37 return self._cam.getImage()