-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stream.py
37 lines (31 loc) · 888 Bytes
/
stream.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import signal
import sys
import time
from datetime import datetime, timezone
from camera_feed import CameraController
NODES = {
'ExposureAuto': 'Off',
'ExposureTime': float(1000),
'Gain': float(27)
}
camera_controller = CameraController()
def main():
try:
camera_controller.start_stream()
curr_frame_time = datetime.now(timezone.utc)
for i in range(100):
npndarray, timestamp = camera_controller.get_npimage()
prev_frame_time = timestamp
print(prev_frame_time - curr_frame_time)
curr_frame_time = timestamp
camera_controller.stop_stream()
finally:
camera_controller.cleanup()
# def cleanup():
# camera_controller.cleanup()
# sys.exit(0)
#
# signal.signal(signal.SIGINT, cleanup)
# signal.signal(signal.SIGTERM, cleanup)
if __name__ == '__main__':
main()