X-Git-Url: http://git.tomasm.cz/imago.git/blobdiff_plain/331a6c45e65595765e1f3b345f67675552c88588..5c59d0214abee9c50a57ea258c83bf7c05e93a87:/camera.py?ds=inline diff --git a/camera.py b/camera.py index a1be68b..7efacb4 100644 --- a/camera.py +++ b/camera.py @@ -13,7 +13,8 @@ if os.name == 'posix': def get_image(self): for _ in range(8): #HACK - im = cv.QueryFrame(self._cam) + cv.QueryFrame(self._cam) + im = cv.QueryFrame(self._cam) # Add the line below if you need it (Ubuntu 8.04+) #im = cv.GetMat(im) #convert Ipl image to PIL image @@ -26,12 +27,18 @@ if os.name == 'posix': elif os.name in ('ce', 'nt', 'dos'): from VideoCapture import Device + import time # TODO exception handling class Camera: def __init__(self, device=0): self._cam = Device() self._cam.setResolution(640, 480) + #HACK to let the camera self-adjust: + print "The device is getting ready." + for _ in xrange(20): + self._cam.getImage() + time.sleep(0.5) def get_image(self): return self._cam.getImage()