Skip to content
heynemann edited this page Jan 4, 2012 · 5 revisions

Integrating remotecv into your app is as easy as opening a TCP socket using ZeroMQ. ZeroMQ usage is beyond the scope of this docs, but below you can see a python program using pyzmq that works with remotecv (using tornado's IOLOOP).

ctx = zmq.Context()
socket = ctx.socket(zmq.REQ)
socket.connect('tcp://127.0.0.1:13337')

stream = zmqstream.ZMQStream(socket, ioloop.IOLoop.instance())
stream.on_recv(on_result)

stream.send(bson.dumps({
        'type': self.detection_type,
        'size': engine.size,
        'mode': engine.get_image_mode(),
        'image': image
    })
)

def on_result(data):
    stream.close()
    features = bson.loads(data[0])['points'])
    if features:
        for (left, top, width, height) in features:
            print left
            print top
            print width
            print height
Clone this wiki locally