def read(self): if escapi.is_capture_done(self.device): image = escapi.read(self.device, self.width, self.height, self.buffer) escapi.do_capture(self.device) return True, image else: return False, None
def read(self): if self.device is None: return super(CameraReader, self).read() if escapi.is_capture_done(self.device): image = escapi.read(self.device, self.width, self.height, self.buffer) escapi.do_capture(self.device) return True, image else: return False, None
def __init__(self, capture, width, height, fps): self.device = None self.width = width self.height = height self.fps = fps self.device = capture escapi.count_capture_devices() self.name = str(escapi.device_name(self.device).decode('utf8')) self.buffer = escapi.init_camera(self.device, self.width, self.height, self.fps) escapi.do_capture(self.device)
def __init__(self, capture, width, height, fps, use_escapi=True): self.device = None self.width = width self.height = height self.fps = fps if os.name == 'nt' and use_escapi: escapi.init() self.device = capture self.buffer = escapi.init_camera(self.device, self.width, self.height, self.fps) escapi.do_capture(self.device) else: super(CameraReader, self).__init__(capture) self.cap.set(3, width) self.cap.set(4, height)