Last active
February 4, 2017 15:42
-
-
Save harveyslash/e679862827094b2f9ff11dc1df19c7b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| import cv2 | |
| import numpy as np | |
| import socket | |
| import sys | |
| import pickle | |
| import os | |
| from time import sleep | |
| import struct ### new code | |
| cap=cv2.VideoCapture(0) | |
| cap.set(3,224) | |
| cap.set(4,224) | |
| clientsocket=socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
| clientsocket.connect(('delta.student.rit.edu',8084)) | |
| while True: | |
| ret,frame=cap.read() | |
| data = pickle.dumps(frame) ### new code | |
| clientsocket.sendall(struct.pack("Q", len(data))+data) ### new code | |
| # sleep(1) | |
| data = clientsocket.recv(4096) | |
| os.system('clear') | |
| print (data) | |
| cv2.imshow('frame',frame) | |
| if cv2.waitKey(1) & 0xFF == ord('s'): | |
| exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment