From 263d9b2f4972db14c9c255c6c763ba5da2ad7ff3 Mon Sep 17 00:00:00 2001 From: Rahix Date: Sat, 21 Feb 2026 20:07:38 +0100 Subject: [PATCH] Add a script which prints current camera intensity on screen --- Calculations/live_intensity.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Calculations/live_intensity.py diff --git a/Calculations/live_intensity.py b/Calculations/live_intensity.py new file mode 100644 index 0000000..9341bcf --- /dev/null +++ b/Calculations/live_intensity.py @@ -0,0 +1,23 @@ +import cv2 +import numpy as np + +def main(): + capture = cv2.VideoCapture(0) + cv2.namedWindow("Camera", cv2.WINDOW_AUTOSIZE) + + while True: + ret, frame = capture.read() + + frame_mono = np.mean(frame, axis=2) + intensity = np.mean(frame_mono) + + print(f"\033[H\033[2J{intensity:5.1f}") + + cv2.imshow('Camera', frame) + + if cv2.waitKey(1) == ord('q'): + break + + +if __name__ == "__main__": + main()