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()