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 cv.QueryFrame(self._cam)
17 im = cv.QueryFrame(self._cam)
18 # Add the line below if you need it (Ubuntu 8.04+)
20 #convert Ipl image to PIL image
21 return Image.fromstring("RGB", cv.GetSize(im), im.tostring())
27 elif os.name in ('ce', 'nt', 'dos'):
29 from VideoCapture import Device
32 # TODO exception handling
34 def __init__(self, device=0):
36 self._cam.setResolution(640, 480)
37 #HACK to let the camera self-adjust:
38 print "The device is getting ready."
44 return self._cam.getImage()