Created
February 1, 2017 21:33
-
-
Save harveyslash/e619fa4428e25e3cd4945871366ca3b3 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
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