|
|
- import zmq
- import cv2
- import numpy as np
- import struct
-
- context = zmq.Context()
-
- # Socket to talk to server
- print("Connecting to hello world server…")
- socket = context.socket(zmq.REQ)
- socket.connect("tcp://192.168.0.12:5556")
-
- cv2.namedWindow('image')
- while 1:
- socket.send(b"Hello")
-
- # Get the reply.
- message = socket.recv()
- img = np.frombuffer(message, dtype=np.uint8).reshape((32, 8))
- cv2.imshow("image", cv2.resize(img, (160, 640)))
- key = cv2.waitKey(100)
- if key == ord('q'):
- break
-
- cv2.destroyAllWindows()
|