-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathimgTest_client.py
More file actions
37 lines (28 loc) · 877 Bytes
/
imgTest_client.py
File metadata and controls
37 lines (28 loc) · 877 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
from __future__ import print_function
import grpc
import cv2
import imageTest_pb2
import imageTest_pb2_grpc
import skvideo.io
URL = "/home/nirvan/Desktop/projName/db/DVR_ch7_main_20171015180000_20171015190000.mp4"
def run():
channel = grpc.insecure_channel('192.168.1.195:50051')
stub = imageTest_pb2_grpc.ImageTestStub(channel)
#temp = cv2.imread('/home/nirvan/img_one.png')
for response in stub.Analyse( generateRequests() ):
print(str(response.reply))
def generateRequests():
videogen = skvideo.io.vreader(URL)
i=0
cnt = 1
for frame in videogen:
if(cnt == 5):
cnt = 1
else:
cnt+=1
continue
frame = cv2.cvtColor( frame, cv2.COLOR_RGB2GRAY )
frame = bytes(frame)
yield imageTest_pb2.MsgRequest(img= frame)
if __name__ == '__main__':
run()