Idle from picamera removed
This commit is contained in:
@@ -34,30 +34,21 @@ class CameraPicamera(Camera):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.hasPreview = True
|
self.hasPreview = True
|
||||||
self.hasIdle = True
|
self.hasIdle = False
|
||||||
|
|
||||||
logging.info('Using PiCamera')
|
logging.info('Using PiCamera')
|
||||||
|
|
||||||
self._cap = 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):
|
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):
|
def getPicture(self):
|
||||||
|
|
||||||
self.setActive()
|
|
||||||
|
|
||||||
stream = io.BytesIO()
|
stream = io.BytesIO()
|
||||||
self._cap.capture(stream, format='rgb')
|
self._cap.capture(stream, format='rgb')
|
||||||
stream.seek(0)
|
stream.seek(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user