Create a gist now

Instantly share code, notes, and snippets.

import numpy as np
import zmq
import zmq_utils
# Setup ZeroMQ image publisher & receiver
context = zmq.Context()
sub = context.socket(zmq.SUB)
sub.setsockopt_string(zmq.SUBSCRIBE, "image")
sub.set_hwm(1)
sub.connect("tcp://localhost:5558")
pub = context.socket(zmq.PUB)
pub.set_hwm(1)
pub.connect("tcp://localhost:5559")
print("Starting...")
while True:
image = zmq_utils.recv_image(sub)
zmq_utils.send_image(pub, image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment