Loading noctua/devices/mako.py +22 −22 Original line number Diff line number Diff line Loading @@ -219,28 +219,28 @@ class Webcam(Mako): self._streamer = None # def stream_opencv(self): # """ # Open an OpenCV window in a separate thread for local monitoring. # """ # import cv2 # if not self._streaming: # print("Error: Streaming is False. Start it first.") # return # def loop(): # win_name = f"Mako Stream: {self.id}" # while self._streaming: # if self._last_frame is not None: # fmax = self._last_frame.max() # disp = (self._last_frame / (fmax if fmax > 0 else 1) * 255).astype(np.uint8) # cv2.imshow(win_name, disp) # if cv2.waitKey(1) & 0xFF == ord('q'): # break # cv2.destroyAllWindows() # threading.Thread(target=loop, daemon=True).start() # print("OpenCV Window started. Press 'q' in the window to close.") def stream_opencv(self): """ Open an OpenCV window in a separate thread for local monitoring. """ import cv2 if not self._streaming: print("Error: Streaming is False. Start it first.") return def loop(): win_name = f"Mako Stream: {self.id}" while self._streaming: if self._last_frame is not None: fmax = self._last_frame.max() disp = (self._last_frame / (fmax if fmax > 0 else 1) * 255).astype(np.uint8) cv2.imshow(win_name, disp) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyAllWindows() threading.Thread(target=loop, daemon=True).start() print("OpenCV Window started. Press 'q' in the window to close.") pyproject.toml +2 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ dependencies = [ "loguru", "gnuplotlib", # If focus.py "pyvantagepro", # If meteo.py "opencv-python", # If stream_opencv() in mako.py "quart", "quart_cors", "quart-schema", # validation and Swagger (instead of restx) Loading Loading
noctua/devices/mako.py +22 −22 Original line number Diff line number Diff line Loading @@ -219,28 +219,28 @@ class Webcam(Mako): self._streamer = None # def stream_opencv(self): # """ # Open an OpenCV window in a separate thread for local monitoring. # """ # import cv2 # if not self._streaming: # print("Error: Streaming is False. Start it first.") # return # def loop(): # win_name = f"Mako Stream: {self.id}" # while self._streaming: # if self._last_frame is not None: # fmax = self._last_frame.max() # disp = (self._last_frame / (fmax if fmax > 0 else 1) * 255).astype(np.uint8) # cv2.imshow(win_name, disp) # if cv2.waitKey(1) & 0xFF == ord('q'): # break # cv2.destroyAllWindows() # threading.Thread(target=loop, daemon=True).start() # print("OpenCV Window started. Press 'q' in the window to close.") def stream_opencv(self): """ Open an OpenCV window in a separate thread for local monitoring. """ import cv2 if not self._streaming: print("Error: Streaming is False. Start it first.") return def loop(): win_name = f"Mako Stream: {self.id}" while self._streaming: if self._last_frame is not None: fmax = self._last_frame.max() disp = (self._last_frame / (fmax if fmax > 0 else 1) * 255).astype(np.uint8) cv2.imshow(win_name, disp) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyAllWindows() threading.Thread(target=loop, daemon=True).start() print("OpenCV Window started. Press 'q' in the window to close.")
pyproject.toml +2 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ dependencies = [ "loguru", "gnuplotlib", # If focus.py "pyvantagepro", # If meteo.py "opencv-python", # If stream_opencv() in mako.py "quart", "quart_cors", "quart-schema", # validation and Swagger (instead of restx) Loading