-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexampleClient.py
More file actions
46 lines (35 loc) · 1.15 KB
/
exampleClient.py
File metadata and controls
46 lines (35 loc) · 1.15 KB
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
41
42
43
44
45
46
import subprocess
import cv2
import numpy as np
import threading
import time
import sys
from signal import signal, SIGINT
from StreamClient import StreamClient
running=True
def handler(signal_received, frame):
# Handle any cleanup here
stop()
signal(SIGINT, handler)
def stop():
print("STOPPING")
for s in clients:
s.stop()
cv2.destroyAllWindows()
sys.exit()
# To recieve non multicast UDP, set IP to 127.0.0.1
# Stereo simply doubles the output width
# Output resolution defined here is independent of what is transmitted
clients=[
# StreamClient("Stereo","stereocam","tcp",8081,720,640,stereo=True),
StreamClient("Stereo","239.1.1.1","udp",5008,1920,1080,stereo=True),
# StreamClient("USB","stereocam","tcp",8082,640,480),
# StreamClient("USB","127.0.0.1","udp",8082,640,480),
# StreamClient("Stereo","stereocam","rtsp","8554/stream1",640,480,stereo=True),
]
def displayStreams(clients):
while (not (cv2.waitKey(1) & 0xFF)==ord('q')) and running:
for s in clients:
s.display()
stop()
displayStreams(clients)