Add a script which prints current camera intensity on screen
This commit is contained in:
parent
d9c115efc6
commit
263d9b2f49
1 changed files with 23 additions and 0 deletions
23
Calculations/live_intensity.py
Normal file
23
Calculations/live_intensity.py
Normal 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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue