From 74e2f9718c6d6700ff538168a4d972af59e20a86 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Sat, 16 Jun 2018 23:55:06 +0200 Subject: [PATCH] Idle from picamera removed --- photobooth/camera/CameraPicamera.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/photobooth/camera/CameraPicamera.py b/photobooth/camera/CameraPicamera.py index 79b8cf7..868c36a 100644 --- a/photobooth/camera/CameraPicamera.py +++ b/photobooth/camera/CameraPicamera.py @@ -34,30 +34,21 @@ class CameraPicamera(Camera): super().__init__() self.hasPreview = True - self.hasIdle = True + self.hasIdle = False logging.info('Using PiCamera') self._cap = PiCamera() - def setActive(self): - - if self._cap.closed: - self._cap = PiCamera() - - def setIdle(self): - - if not self._cap.closed: - self._cap.close() - def getPreview(self): - return self.getPicture() + stream = io.BytesIO() + self._cap.capture(stream, format='rgb', use_video_port=True) + stream.seek(0) + return Image.fromarray(stream) def getPicture(self): - self.setActive() - stream = io.BytesIO() self._cap.capture(stream, format='rgb') stream.seek(0)