-
Notifications
You must be signed in to change notification settings - Fork 0
/
VideoGet.py
36 lines (27 loc) · 896 Bytes
/
VideoGet.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
from ximea import xiapi
from threading import Thread
import cv2
class VideoGet:
"""
Class that continuously gets frames from a VideoCapture object
with a dedicated thread.
"""
def __init__(self,system):
self.system = system
self.frame =None
self.img = xiapi.Image()
# self.img = xiapi.Image()
# self.system.cam.cam.get_image(self.img,100000)
# self.frame = self.img.get_image_data_numpy()
self.stopped = False
def start(self):
self.stopped = False
Thread(target=self.get, args=()).start()
return self
def get(self):
while not self.stopped:
self.system.cam.cam.get_image(self.img,100000)
self.frame = self.img.get_image_data_numpy()
def stop(self):
self.stopped = True
self.cam.stop_acquisition()