I want to process an image and then stream it. I'm currently using Node.js with the OpenCV module, but there is only a video capture method, so I only process one frame.
I want to stream it. This is my current code:
var cv = require('/home/pi/node_modules/opencv/lib/opencv');
var lines = new cv.Matrix();
var camera = new cv.VideoCapture(0);
var pfio = require('piface-node');
camera.read(function(err, im) {
// image processing code here
im.save('/tmp/cam2.jpg');
});
I use mjpg-streamer to stream the image, but this code only creates one image. I currently use setInterval to stream, but that isn't a good way. What should I be doing?