-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearch_video.py
More file actions
34 lines (28 loc) · 988 Bytes
/
search_video.py
File metadata and controls
34 lines (28 loc) · 988 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
from socketIO_client import SocketIO, LoggingNamespace
import cv2
import hashlib
import base64
import requests
socketio = SocketIO('http://socket.giscle.com', 8000, LoggingNamespace)
token = "YOUR_API_KEY"
secret = "YOUR_SECRET_KEY"
folder = "..."
def response(args):
print('response', str(args['data']))
def send_Video_face_search():
vidcap = cv2.VideoCapture('./ddd.mp4')
success, img2 = vidcap.read()
success = True
while success:
result, img2 = cv2.imencode('.jpg', img2)
img2 = img2.tostring()
img2 = base64.b64encode(img2)
img2 = img2.decode('utf-8')
print("sending")
socketio.emit('Search_face', {'img1':img2,'token':token,'secret':secret,'folder':folder})
socketio.wait(seconds=2)
success, img2 = vidcap.read()
if __name__ == "__main__":
socketio.emit('authenticate',{'token':token})
socketio.on('response', response)
send_Video_face_search()