From c7be4182322e7d1c73beb730540d3aa6f50883b8 Mon Sep 17 00:00:00 2001 From: Joe DiPrima Date: Thu, 19 Feb 2026 12:36:53 -0600 Subject: [PATCH] =?UTF-8?q?Rotate=20webcam=20image=20CCW=2090=C2=B0=20to?= =?UTF-8?q?=20match=20headset=20orientation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- teleop/teleop_hand_and_arm.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/teleop/teleop_hand_and_arm.py b/teleop/teleop_hand_and_arm.py index 9de8b64..f0ce2ae 100644 --- a/teleop/teleop_hand_and_arm.py +++ b/teleop/teleop_hand_and_arm.py @@ -107,8 +107,9 @@ class ThreadedWebcam: self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height) # Minimize internal buffer so we always get the latest frame self.cap.set(cv2.CAP_PROP_BUFFERSIZE, 1) - self.actual_w = int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH)) - self.actual_h = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) + # After CCW 90° rotation, width and height are swapped + self.actual_w = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) + self.actual_h = int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH)) self._frame = None self._lock = threading.Lock() self._stop = threading.Event() @@ -116,9 +117,11 @@ class ThreadedWebcam: self._thread.start() def _capture_loop(self): + import cv2 while not self._stop.is_set(): ret, frame = self.cap.read() if ret: + frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE) with self._lock: self._frame = frame