Add a script which prints current camera intensity on screen

This commit is contained in:
Rahix 2026-02-21 20:07:38 +01:00
parent d9c115efc6
commit 263d9b2f49

View file

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