Loading openflexure_microscope/camera/pi.py +59 −58 Original line number Diff line number Diff line Loading @@ -240,9 +240,11 @@ class StreamingCamera(BaseCamera): def start_preview(self, fullscreen=True, window=None) -> bool: """Start the on board GPU camera preview.""" logging.info("Starting the GPU preview") self.start_stream_recording() # TODO: Commented out as I honestly can't remember why this was here. May need to put back? #self.start_stream_recording() try: with self.lock: if not self.camera.preview: logging.debug("Starting preview") self.camera.start_preview(fullscreen=fullscreen, window=window) Loading @@ -257,14 +259,11 @@ class StreamingCamera(BaseCamera): logging.error("Suppressed a MMALError in start_preview. Exception: {}".format(e)) except picamera.exc.PiCameraValueError as e: logging.error("Suppressed a ValueError exception in start_preview. Exception: {}".format(e)) return True def stop_preview(self) -> bool: """Stop the on board GPU camera preview.""" with self.lock: self.camera.stop_preview() self.state['preview_active'] = False return True def start_recording( self, Loading Loading @@ -340,6 +339,7 @@ class StreamingCamera(BaseCamera): splitter_port (int): Splitter port to stop recording on resolution ((int, int)): Resolution to set the camera to, after stopping recording. """ with self.lock: # If no resolution is specified, default to image_resolution if not resolution: resolution = self.config['image_resolution'] Loading Loading @@ -367,6 +367,7 @@ class StreamingCamera(BaseCamera): splitter_port (int): Splitter port to start recording on resolution ((int, int)): Resolution to set the camera to, before starting recording. Defaults to `self.config['stream_resolution']`. """ with self.lock: # If stream object was destroyed if not hasattr(self, 'stream'): self.stream = io.BytesIO() # Create a stream object Loading Loading
openflexure_microscope/camera/pi.py +59 −58 Original line number Diff line number Diff line Loading @@ -240,9 +240,11 @@ class StreamingCamera(BaseCamera): def start_preview(self, fullscreen=True, window=None) -> bool: """Start the on board GPU camera preview.""" logging.info("Starting the GPU preview") self.start_stream_recording() # TODO: Commented out as I honestly can't remember why this was here. May need to put back? #self.start_stream_recording() try: with self.lock: if not self.camera.preview: logging.debug("Starting preview") self.camera.start_preview(fullscreen=fullscreen, window=window) Loading @@ -257,14 +259,11 @@ class StreamingCamera(BaseCamera): logging.error("Suppressed a MMALError in start_preview. Exception: {}".format(e)) except picamera.exc.PiCameraValueError as e: logging.error("Suppressed a ValueError exception in start_preview. Exception: {}".format(e)) return True def stop_preview(self) -> bool: """Stop the on board GPU camera preview.""" with self.lock: self.camera.stop_preview() self.state['preview_active'] = False return True def start_recording( self, Loading Loading @@ -340,6 +339,7 @@ class StreamingCamera(BaseCamera): splitter_port (int): Splitter port to stop recording on resolution ((int, int)): Resolution to set the camera to, after stopping recording. """ with self.lock: # If no resolution is specified, default to image_resolution if not resolution: resolution = self.config['image_resolution'] Loading Loading @@ -367,6 +367,7 @@ class StreamingCamera(BaseCamera): splitter_port (int): Splitter port to start recording on resolution ((int, int)): Resolution to set the camera to, before starting recording. Defaults to `self.config['stream_resolution']`. """ with self.lock: # If stream object was destroyed if not hasattr(self, 'stream'): self.stream = io.BytesIO() # Create a stream object Loading