From b776e70b4cd94c5d1f53dde39b2e46f6447cac3e Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Tue, 9 Jun 2026 19:39:35 -0600 Subject: Motion capture: profile support, FPS config, persistent tracking, window state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Profile integration: - CameraDevice.get_save_config() serialises camera_index, simulate, resolution, fps — cameras now persist in .labdaq profiles - ProfileManager.register/unregister_device_factory() lets plugins register their device classes for profile restoration without core → plugin dependency - MotionCapturePlugin registers CameraDevice factory on load/unload Camera configuration: - Add Frame Rate combo to CameraPanel (Default/15/24/30/60/120 fps) defaults to 30 fps; flows through to CAP_PROP_FPS on connect - tracker.start() accepts fps param alongside existing resolution Tracking persistence: - CameraTracker.is_running() — checks thread alive state - MotionCaptureWindow initialises _connected from tracker.is_running() so reopening the window resumes the live feed without restarting the camera or losing the active tracking state Window state: - Plugin saves px_per_mm + camera_idx when window closes - Reopened window restores saved values and syncs mode/shape UI from tracker state via restore_ui_state() (signals blocked to avoid resetting tracker) - Window type changed to Qt.WindowType.Window for independent close button on all Linux WMs Co-Authored-By: Claude Sonnet 4.6 --- plugins/motion_capture/camera_panel.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'plugins/motion_capture/camera_panel.py') diff --git a/plugins/motion_capture/camera_panel.py b/plugins/motion_capture/camera_panel.py index 5e25f7f..279945e 100644 --- a/plugins/motion_capture/camera_panel.py +++ b/plugins/motion_capture/camera_panel.py @@ -21,6 +21,15 @@ _RESOLUTIONS = { "2560 × 1440": (2560, 1440), } +_FPS = { + "Default": None, + "15 fps": 15, + "24 fps": 24, + "30 fps": 30, + "60 fps": 60, + "120 fps": 120, +} + class CameraScanThread(QThread): cameras_found = pyqtSignal(list) # list of (index: int, label: str) @@ -64,7 +73,14 @@ class CameraPanel(QWidget): form.setContentsMargins(0, 0, 0, 0) self.res_cb = QComboBox() self.res_cb.addItems(list(_RESOLUTIONS.keys())) + self.res_cb.setCurrentText("1280 × 720") form.addRow("Resolution:", self.res_cb) + + self.fps_cb = QComboBox() + self.fps_cb.addItems(list(_FPS.keys())) + self.fps_cb.setCurrentText("30 fps") + form.addRow("Frame Rate:", self.fps_cb) + lay.addLayout(form) note = QLabel( @@ -91,9 +107,11 @@ class CameraPanel(QWidget): resolution: Optional[Tuple[int, int]] = _RESOLUTIONS.get( self.res_cb.currentText() ) + fps: Optional[int] = _FPS.get(self.fps_cb.currentText()) return CameraDevice( device_id=device_id, camera_index=self._selected_index, simulate=self._simulate, resolution=resolution, + fps=fps, ) -- cgit v1.2.3