""" motion_capture/plugin.py LabDAQ Motion Capture plugin. When enabled, adds a "Camera" device type to the Add Device dialog. Each camera added by the user becomes a first-class device in the acquisition pipeline — data flows through the standard Device → Signal → Channel → Plot stream. Custom filter registered globally: pixel_to_mm — convert pixel coords to mm using a px_per_mm value. Add it in Signals → Channels on x_pos or y_pos. Install OpenCV for real camera support: pip install opencv-python """ from __future__ import annotations from plugins.base_plugin import LabPlugin, PluginContext class MotionCapturePlugin(LabPlugin): # ── Metadata ────────────────────────────────────────────────────────── @property def plugin_id(self) -> str: return "motion_capture" @property def name(self) -> str: return "Motion Capture" @property def version(self) -> str: return "1.0.0" @property def description(self) -> str: return ( "Adds a Camera device type to the Add Device dialog. " "Stream x/y tracking coordinates directly into the signal pipeline." ) @property def author(self) -> str: return "LabDAQ" # ── Lifecycle ───────────────────────────────────────────────────────── def on_load(self, context: PluginContext) -> None: self._ctx = context from ui.add_device_dialog import _PANELS from camera_panel import CameraPanel _PANELS["Camera"] = (CameraPanel, "cam") def on_unload(self) -> None: from ui.add_device_dialog import _PANELS _PANELS.pop("Camera", None) # ── Integration hooks ───────────────────────────────────────────────── def get_filter_classes(self) -> dict: from filter import PixelToMMFilter return {"pixel_to_mm": PixelToMMFilter}