-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpi.py
More file actions
41 lines (33 loc) · 770 Bytes
/
pi.py
File metadata and controls
41 lines (33 loc) · 770 Bytes
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
import cv2
from vidgear.gears import PiGear
from vidgear.gears import NetGear
from vidgear.gears import VideoGear
options_netgear = {
'flag': 0,
'copy': False,
'track': False,
"jpeg_compression_quality": 80,
'jpeg_compression_fastupsample': True
}
stream = cv2.VideoCapture(0)
server = NetGear(
address='192.168.11.145', # school network
# address='192.168.11.137', # home network
port='5555',
protocol='tcp',
pattern=2,
logging=True,
receive_mode=False,
**options_netgear
)
while True:
try:
_, frame = stream.read()
if frame is None:
break
server.send(frame=frame)
print('sending...')
except KeyboardInterrupt:
break
stream.release()
server.close()