-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_camera.py
32 lines (26 loc) · 973 Bytes
/
test_camera.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
import cv2
import config
import platform
import os
if(config.imageType == "Video"):
if(platform.system() == "Linux" and config.callOS == 1):
print("Calling OS Script")
os.system(config.osScript)
cap = cv2.VideoCapture(config.imageSource)
if config.imageSource == 0 or config.imageSource == 1:
cap.set(cv2.CAP_PROP_FPS, 15)
if config.camera["SetSize"]:
cap.set(cv2.CAP_PROP_FRAME_WIDTH, config.camera['WidthSize'])
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, config.camera['HeightSize'])
print("FPS Set To: ", cap.get(cv2.CAP_PROP_FPS))
else:
image = cv2.imread(config.imageSource)
while True:
if(config.imageType == "Video"):
ret, image = cap.read()
if config.DISPLAY:
cv2.imshow('Original', image)
keyPressed = cv2.waitKey(1)
if keyPressed == 27:
break
cv2.destroyAllWindows() # Destroy the windows and close the program