From 898fde4dc286517cb27590b2f9cd7406d9922bd4 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Tue, 9 Jun 2026 18:47:49 -0600 Subject: Upgrade motion capture: template matching, frame-freeze selection, resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tracking: - Add "template" mode (default) using snapshot + shape-masked matchTemplate - Add "csrt" mode as alternative for texture-rich targets - set_roi_rect(x, y, w, h, frame_rgb) initialises from exact selection rect - set_roi() delegates to set_roi_rect (centred square, backwards-compat) - start() accepts resolution=(w, h) to set camera capture resolution Selection UX: - Replace QLabel feed with FrameSelector widget (custom QWidget) - "Click to Track" freezes frame; user scrolls to zoom (anchored to cursor), right-drags to pan, left-drags to draw rubber-band selection - Shape preview: rectangle or inscribed ellipse depending on mode - "Confirm Selection" extracts template from frozen frame and starts tracking - "Clear" cancels selection or clears active tracking Configuration: - CameraPanel adds Resolution combo (Default / 640×480 / 720p / 1080p / 1440p) - CameraDevice stores and forwards resolution to tracker.start() - Template Match listed first in Mode combo; shape combo hidden for CSRT Co-Authored-By: Claude Sonnet 4.6 --- plugins/motion_capture/device.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins/motion_capture/device.py') diff --git a/plugins/motion_capture/device.py b/plugins/motion_capture/device.py index 9806030..8eb1591 100644 --- a/plugins/motion_capture/device.py +++ b/plugins/motion_capture/device.py @@ -26,7 +26,8 @@ class CameraDevice(BaseDevice): def __init__(self, device_id: str = "cam_0", camera_index: int = 0, - simulate: bool = False): + simulate: bool = False, + resolution=None): name = "Camera (Sim)" if simulate else f"Camera {camera_index}" super().__init__(DeviceInfo( device_id = device_id, @@ -55,6 +56,7 @@ class CameraDevice(BaseDevice): )) self._camera_index = camera_index self._simulate = simulate + self._resolution = resolution self._tracker: Optional[Any] = None self._tracking_win = None @@ -63,7 +65,10 @@ class CameraDevice(BaseDevice): def connect(self) -> bool: from tracker import CameraTracker self._tracker = CameraTracker() - self._tracker.start(-1 if self._simulate else self._camera_index) + self._tracker.start( + -1 if self._simulate else self._camera_index, + resolution=self._resolution, + ) if self._tracker.simulated: self.status = DeviceStatus.SIMULATED else: -- cgit v1.2.3