Update things to have thing_server_interface, and further fixes to properties
This commit is contained in:
parent
a0b8a71477
commit
5d3aa71b4f
9 changed files with 39 additions and 17 deletions
|
|
@ -175,7 +175,7 @@ class BaseCamera(lt.Thing):
|
|||
lores_mjpeg_stream = lt.outputs.MJPEGStreamDescriptor()
|
||||
_memory_buffer = CameraMemoryBuffer()
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, thing_server_interface: lt.ThingServerInterface) -> None:
|
||||
"""Initialise the base camera, this creates the background detectors.
|
||||
|
||||
This must be run by all child camera classes.
|
||||
|
|
@ -183,7 +183,7 @@ class BaseCamera(lt.Thing):
|
|||
To add a new background detector to the server it must be added to the
|
||||
dictionary in this function. Configuration will be added at a later date.
|
||||
"""
|
||||
super().__init__()
|
||||
super().__init__(thing_server_interface)
|
||||
self.background_detectors = {
|
||||
"Colour Channels (LUV)": ColourChannelDetectLUV(),
|
||||
"Channel Deviations (LUV)": ChannelDeviationLUV(),
|
||||
|
|
|
|||
|
|
@ -27,12 +27,14 @@ LOGGER = logging.getLogger(__name__)
|
|||
class OpenCVCamera(BaseCamera):
|
||||
"""A Thing that provides and interface to an OpenCV Camera."""
|
||||
|
||||
def __init__(self, camera_index: int = 0) -> None:
|
||||
def __init__(
|
||||
self, thing_server_interface: lt.ThingServerInterface, camera_index: int = 0
|
||||
) -> None:
|
||||
"""Iniatilise the thing storing the index of the camera to use.
|
||||
|
||||
:param camera_index: The index of the camera to use for the microscope.
|
||||
"""
|
||||
super().__init__()
|
||||
super().__init__(thing_server_interface)
|
||||
self.camera_index = camera_index
|
||||
self._capture_thread: Optional[Thread] = None
|
||||
self._capture_enabled = False
|
||||
|
|
|
|||
|
|
@ -128,7 +128,12 @@ class StreamingPiCamera2(BaseCamera):
|
|||
generalisation.
|
||||
"""
|
||||
|
||||
def __init__(self, camera_num: int = 0, camera_board: str = "picamera_v2") -> None:
|
||||
def __init__(
|
||||
self,
|
||||
thing_server_interface: lt.ThingServerInterface,
|
||||
camera_num: int = 0,
|
||||
camera_board: str = "picamera_v2",
|
||||
) -> None:
|
||||
"""Initialise the camera with the given camera number.
|
||||
|
||||
This makes no connection to the camera (except to get the default tuning file).
|
||||
|
|
@ -138,7 +143,7 @@ class StreamingPiCamera2(BaseCamera):
|
|||
:param camera_board: The camera board used. Supported options are "picamera_v2"
|
||||
and "picamera_hq".
|
||||
"""
|
||||
super().__init__()
|
||||
super().__init__(thing_server_interface)
|
||||
self._setting_save_in_progress = False
|
||||
self._camera_num = camera_num
|
||||
self._camera_board = camera_board
|
||||
|
|
@ -175,7 +180,7 @@ class StreamingPiCamera2(BaseCamera):
|
|||
mjpeg_bitrate: Optional[int] = lt.property(default=100000000)
|
||||
"""Bitrate for MJPEG stream (None for default)."""
|
||||
|
||||
stream_active: bool = lt.property(default=False, observable=True, readonly=True)
|
||||
stream_active: bool = lt.property(default=False, readonly=True)
|
||||
"""Whether the MJPEG stream is active."""
|
||||
|
||||
def save_settings(self) -> None:
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ class SimulatedCamera(BaseCamera):
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
thing_server_interface: lt.ThingServerInterface,
|
||||
shape: tuple[int, int, int] = (616, 820, 3),
|
||||
glyph_shape: tuple[int, int, int] = (121, 121, 3),
|
||||
canvas_shape: tuple[int, int, int] = (3000, 4000, 3),
|
||||
|
|
@ -71,7 +72,7 @@ class SimulatedCamera(BaseCamera):
|
|||
:param frame_interval: Nominally the time between frames on the MJPEG stream,
|
||||
however the rate may be slower due to calculation time for focus.
|
||||
"""
|
||||
super().__init__()
|
||||
super().__init__(thing_server_interface)
|
||||
self.shape = shape
|
||||
self.glyph_shape = glyph_shape
|
||||
self.canvas_shape = canvas_shape
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue