def grab(self): ts = time.time() camera_port_0, output_port_0 = self.camera._get_ports(True, 0) self.jpeg_encoder = self.camera._get_image_encoder( camera_port_0, output_port_0, 'jpeg', None, quality=self._jpeg_quality) camera_port_1, output_port_1 = self.camera._get_ports(True, 1) self.rgb_encoder = self.camera._get_image_encoder( camera_port_1, output_port_1, 'bgr', self.out_rgb_resolution) #print "g.1: " + str(ts - time.time()) #ts = time.time() with self.camera._encoders_lock: self.camera._encoders[0] = self.jpeg_encoder self.camera._encoders[1] = self.rgb_encoder self.out_jpeg.seek(0) self.out_rgb.seek(0) self.jpeg_encoder.start(self.out_jpeg) self.rgb_encoder.start(self.out_rgb) if not self.jpeg_encoder.wait(10): raise picamera.PiCameraError('Timed out') if not self.rgb_encoder.wait(10): raise picamera.PiCameraError('Timed out') with self.camera._encoders_lock: del self.camera._encoders[0] del self.camera._encoders[1] self.jpeg_encoder.close() self.rgb_encoder.close()
def grab_one(self): self.out_jpeg.seek(0) self.out_rgb.seek(0) self.jpeg_encoder.start(self.out_jpeg) self.rgb_encoder.start(self.out_rgb) if not self.jpeg_encoder.wait(10): raise picamera.PiCameraError('Timed Out') if not self.rgb_encoder.wait(10): raise picamera.PiCameraError('Timed Out')
def grab_bgr(self): ts = time.time() self.out_rgb.seek(0) self.rgb_encoder.start(self.out_rgb) if not self.rgb_encoder.wait(10): raise picamera.PiCameraError('Timed out')
def grab_jpeg(self): ts = time.time() self.out_jpeg.seek(0) self.jpeg_encoder.start(self.out_jpeg) if not self.jpeg_encoder.wait(10): raise picamera.PiCameraError('Timed out')