Skip to content

Instantly share code, notes, and snippets.

@chapel
Created July 27, 2014 19:53
Show Gist options
  • Save chapel/bd6f009673bcb2930879 to your computer and use it in GitHub Desktop.
Save chapel/bd6f009673bcb2930879 to your computer and use it in GitHub Desktop.
var Hapi = require('hapi');
var cv = require('opencv');
var cam = new cv.VideoCapture(0);
var server = Hapi.createServer(9999);
server.route({
path: '/cam.jpg',
method: 'GET',
handler: function (request, reply) {
cam.read(function (err, img) {
img.toBufferAsync(function (err, data) {
reply(data).type('image/jpg');
});
});
}
});
server.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment