-
Notifications
You must be signed in to change notification settings - Fork 34
Integration
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.
ctx = zmq.Context()
socket = ctx.socket(zmq.REQ)
socket.connect('tcp://127.0.0.1:13337')
socket.send(bson.dumps({
'type': 'face',
'size': (300, 200),
'mode': 'RGB',
'image': open('some-image.jpg').read()
})
)
data = socket.recv()
features = bson.loads(data[0])['points'])
if features:
for (left, top, width, height) in features:
print left
print top
print width
print height
remotecv uses BSON (http://pypi.python.org/pypi/bson) for object serialization. Since we send the images bytes, JSON was not a viable option.