555
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
574 B

  1. import zmq
  2. import cv2
  3. import numpy as np
  4. import struct
  5. context = zmq.Context()
  6. # Socket to talk to server
  7. print("Connecting to hello world server…")
  8. socket = context.socket(zmq.REQ)
  9. socket.connect("tcp://192.168.0.12:5556")
  10. cv2.namedWindow('image')
  11. while 1:
  12. socket.send(b"Hello")
  13. # Get the reply.
  14. message = socket.recv()
  15. img = np.frombuffer(message, dtype=np.uint8).reshape((32, 8))
  16. cv2.imshow("image", cv2.resize(img, (160, 640)))
  17. key = cv2.waitKey(100)
  18. if key == ord('q'):
  19. break
  20. cv2.destroyAllWindows()