forked from toriumi/scorer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreaming.py
More file actions
40 lines (29 loc) · 916 Bytes
/
Copy pathstreaming.py
File metadata and controls
40 lines (29 loc) · 916 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
import zmq
import cv2
import sys
import scorer_sdk.Scorer
import pycurl
cnt=0
print("Waiting Start...")
args = sys.argv
scorer=scorer_sdk.Scorer.Scorer("Task")
x1,y1,x2,y2 = scorer.get_roi_rect_by_index(0)
while True:
if scorer.poll() == False:
continue
frame = scorer.get_frame()
if frame == None:
continue
bgr = frame.get_bgr()
scorer.web_show(bgr, 2)
bgr = cv2.rectangle(bgr, (x1,y1),(x2,y2), (0,255,0), 5)
scorer.web_show(bgr, 1)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
def send2line():
buffer='saved'
curl = pycurl.Curl()
curl.setopt(pycurl.URL, 'https://notify-api.line.me/api/notify')
curl.setopt(pycurl.HTTPHEADER, ['Authorization: Bearer AhfffLL3f1BYUJMnBnV8HZFAuvFS3ztJ65ZQv9UPo5j'])
curl.setopt(pycurl.HTTPPOST, [('message', buffer.encode('utf-8')),('imageFile', (curl.FORM_FILE, 'lena.png'))])
curl.perform()