From bebe709f46a53e1752dc220070613df25c285e4f Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sat, 20 Dec 2014 20:25:25 +0100 Subject: image server --- server.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'server.py') diff --git a/server.py b/server.py index 6fc2814..4e5cd65 100644 --- a/server.py +++ b/server.py @@ -26,14 +26,19 @@ while True: connection, client_address = sock.accept() try: print >>sys.stderr, 'connection from', client_address + cap = cv2.VideoCapture("/home/flo/outvid2.avi") # Receive the data in small chunks and retransmit it while True: data = connection.recv(16) print >>sys.stderr, 'received "%s"' % data if data: - print >>sys.stderr, 'sending data back to the client' - connection.sendall(data) + if data=="get\n": + status, frame = cap.read() + print >>sys.stderr, 'sending image to the client' + connection.sendall(frame.tostring()) + cv2.imshow("img",frame) + cv2.waitKey(20) else: print >>sys.stderr, 'no more data from', client_address break @@ -42,7 +47,6 @@ while True: # Clean up the connection connection.close() -cap = cv2.VideoCapture("/home/flo/outvid2.avi") while True: status, frame = cap.read() cv2.imshow("img",frame) -- cgit v1.2.3