Loading openflexure_microscope/camera/mock.py +11 −6 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ import logging # Type hinting from typing import Tuple from openflexure_microscope.camera.base import BaseCamera from openflexure_microscope.camera.base import BaseCamera, CaptureObject """ Loading Loading @@ -189,14 +189,19 @@ class MockStreamer(BaseCamera): bayer (bool): Store raw bayer data in capture """ if isinstance(output, CaptureObject): target = output.file else: target = target with self.lock: if isinstance(output, str): output = open(output, "wb") if isinstance(target, str): target = open(target, "wb") output.write(self.stream.getvalue()) target.write(self.stream.getvalue()) if isinstance(output, str): output.close() if isinstance(target, str): target.close() # HANDLE STREAM FRAMES Loading openflexure_microscope/camera/pi.py +7 −2 Original line number Diff line number Diff line Loading @@ -548,6 +548,11 @@ class PiCameraStreamer(BaseCamera): output_object (str/BytesIO): Target object. """ if isinstance(output, CaptureObject): target = output.file else: target = target with self.lock: logging.info("Capturing to {}".format(output)) Loading @@ -556,7 +561,7 @@ class PiCameraStreamer(BaseCamera): self.stop_stream_recording() self.camera.capture( output, target, format=fmt, quality=100, resize=resize, Loading @@ -568,7 +573,7 @@ class PiCameraStreamer(BaseCamera): if not use_video_port: self.start_stream_recording() return output return target def yuv( self, use_video_port: bool = True, resize: Tuple[int, int] = None Loading Loading
openflexure_microscope/camera/mock.py +11 −6 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ import logging # Type hinting from typing import Tuple from openflexure_microscope.camera.base import BaseCamera from openflexure_microscope.camera.base import BaseCamera, CaptureObject """ Loading Loading @@ -189,14 +189,19 @@ class MockStreamer(BaseCamera): bayer (bool): Store raw bayer data in capture """ if isinstance(output, CaptureObject): target = output.file else: target = target with self.lock: if isinstance(output, str): output = open(output, "wb") if isinstance(target, str): target = open(target, "wb") output.write(self.stream.getvalue()) target.write(self.stream.getvalue()) if isinstance(output, str): output.close() if isinstance(target, str): target.close() # HANDLE STREAM FRAMES Loading
openflexure_microscope/camera/pi.py +7 −2 Original line number Diff line number Diff line Loading @@ -548,6 +548,11 @@ class PiCameraStreamer(BaseCamera): output_object (str/BytesIO): Target object. """ if isinstance(output, CaptureObject): target = output.file else: target = target with self.lock: logging.info("Capturing to {}".format(output)) Loading @@ -556,7 +561,7 @@ class PiCameraStreamer(BaseCamera): self.stop_stream_recording() self.camera.capture( output, target, format=fmt, quality=100, resize=resize, Loading @@ -568,7 +573,7 @@ class PiCameraStreamer(BaseCamera): if not use_video_port: self.start_stream_recording() return output return target def yuv( self, use_video_port: bool = True, resize: Tuple[int, int] = None Loading