-
Notifications
You must be signed in to change notification settings - Fork 4
/
LiveVideo.py
40 lines (31 loc) · 1000 Bytes
/
LiveVideo.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
38
39
40
import cv2
try:
from PySpinCapture import PySpinCapture
except ImportError:
PySpinCapture = None
__author__ = 'Joseph Howse'
__copyright__ = 'Copyright (c) 2018, Nummist Media Corporation Limited'
__credits__ = ['Joseph Howse']
__license__ = 'BSD 3-Clause'
__version__ = '0.0.1'
__maintainer__ = 'Joseph Howse'
__email__ = '[email protected]'
__status__ = 'Prototype'
def main():
if PySpinCapture is not None:
capture = PySpinCapture(0, roi=(0, 0, 1920, 1200), binning_radius=1,
is_monochrome=True)
else:
capture = cv2.VideoCapture(0)
capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
success, image = capture.read()
while success:
cv2.imshow('Live Video', image)
if cv2.waitKey(1) != -1:
# The user pressed a key.
# Quit.
break
success, image = capture.read()
if __name__ == '__main__':
main()