From 83bfa5827865f0ce4bca7cd95aa529b241e3805b Mon Sep 17 00:00:00 2001 From: Benjamin Evans <51272212+dfgHiatus@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:16:29 -0600 Subject: [PATCH] (tweak) Add OpenCV cam release, fix COM detection --- BabbleApp/camera.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/BabbleApp/camera.py b/BabbleApp/camera.py index e8c8ed6..b126e4d 100644 --- a/BabbleApp/camera.py +++ b/BabbleApp/camera.py @@ -93,7 +93,10 @@ class Camera: self.config.capture_source is not None and self.config.capture_source != "" ): - if "COM" in self.camera_list[self.config.capture_source]: + if "COM" in str(self.config.capture_source): + if self.cv2_camera is not None: + self.cv2_camera.release() + self.cv2_camera = None if self.vft_camera is not None: self.vft_camera.close() if ( @@ -105,6 +108,10 @@ class Camera: self.current_capture_source = port self.start_serial_connection(port) elif "HTC Multimedia Camera" in self.camera_list[self.config.capture_source]: + if self.cv2_camera is not None: + self.cv2_camera.release() + self.cv2_camera = None + if self.vft_camera is None: print(self.error_message.format(self.config.capture_source)) if self.cancellation_event.wait(WAIT_TIME):