diff --git a/src/backend/api/routes.py b/src/backend/api/routes.py index dd631d6..4e9d5f0 100644 --- a/src/backend/api/routes.py +++ b/src/backend/api/routes.py @@ -126,7 +126,7 @@ async def status(): "color_available": _camera.is_color_available() if (_camera and _camera.is_open()) else False, "usb_type": _camera.usb_type() if (_camera and _camera.is_open()) else None, "frame_count": _frame_count, - "resolution": {"width": 640, "height": 480}, + "resolution": _camera.resolution() if (_camera and _camera.is_open()) else None, "intrinsics": _calibration_payload(), }) diff --git a/src/backend/services/camera.py b/src/backend/services/camera.py index b0db4f9..cf4a5c3 100644 --- a/src/backend/services/camera.py +++ b/src/backend/services/camera.py @@ -135,6 +135,21 @@ class RealSenseD435: def usb_type(self) -> str: return self._usb_type + def resolution(self) -> Optional[dict]: + """Negotiated color stream resolution, or None if not open. + + Reads from the live pipeline profile so the value reflects what the + firmware actually accepted — on USB 2.x this is the forced 640x480@15 + fallback, not the configured `_width/_height`. + """ + if not self._open or self._profile is None: + return None + try: + stream = self._profile.get_stream(rs.stream.color).as_video_stream_profile() + return {"width": stream.width(), "height": stream.height(), "fps": stream.fps()} + except Exception: + return None + def init(self) -> bool: try: self._ctx = rs.context()