forked from AnthonyHorton/fast-zwo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideo_test.py
31 lines (25 loc) · 904 Bytes
/
video_test.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
import time
import numpy as np
from numpy_ringbuffer import RingBuffer
from asi import ASICamera
def frame_rate_test(camera, n=100):
start_time = time.monotonic()
camera.start_video_capture()
#image_array = RingBuffer(capacity=10, dtype=(np.uint16, 3672, 5496))
image_array = []
for i in range(n):
image = camera.get_video_data()
#Start Brint's code
if image is not None:
#do stuff
image_array.append(image)
diff = image_array[0] - image
end_time = time.monotonic()
camera.stop_video_capture()
fps = n / (end_time - start_time)
msg = "Got {} frames in {} seconds ({} fps).".format(n, (end_time - start_time), fps)
print(msg)
return fps
if __name__ == '__main__':
camera = ASICamera(library_path='/usr/local/lib/libASICamera2.so')
frame_rate_test(camera, n=1000)