javascript - using cv.readImage() with stream in nodejs -


I am trying to create something like this fascination with OpenCV and nodejs.

I am already using Ubuntu and I am able to stream images from my webcam.

Then it is my .js for the webcam

  var socket = io.connect (); Var FPS = 30; Socket.on ('connect', function () {$ (server server). Text ('connect')}); Socket.one ('connecting', function () {$ ('serverstats'). Text ('connect')}); Socket.one ('disconnect', function () {$ ('serverstatus'). Text ('disconnected')}); Var dropped = function (e) {warnings ('you have to enable webcams'); }; Window.URL = window.URL || Window.webkitURL; Navigator.getUserMedia = (Navigator.GetuSermedia || Navigator.WebKitGetUsermedia || Navigator.MozGetUsermedia || NavigatorMMSGetUsermedia); Var video = document.query selector ('video'); If (navigator.getUserMedia) {navigator.getUserMedia ({video: true}, function (stream) {video.src = window.URL.createObjectURL (stream);}, dropped CAM); } Else {Warning ('your browser does not support webcam control'); } Video.addEventListener ('play', function (e) {var canvas = document.getElementById ('frontendCanvas'); var goByScale = (video.videoightight> = video.videoWidth)? 'Height': 'width'; Var scale = (300 / video ['video' + goByScale]); canvas.width = video.videoWidth * scale; canvas.style.width = canvas.width + 'px'; canvas.height = video.videoHeight * Scale; canvas (style, 0, video.videoWidth * scale, video.videoHeight * scale); socket.emit ('videostream', canvas.toDataURL ('image / webp'));}}, 1000 / fps)}, wrong);  

and app.js

  var express = required ('express.io'); Var app = express (); Var path = requirement ('path'); Var requires favicon = ('service-favicon'); Var Loger = Required ('Morgan'); Var requires cookieParser = ('cookie-parser'); Var bodyParser = is required ('body-parser'); Var routes = required ('. / Route / index'); Var Backend = Required ('./way / backend'); Var requires CV = ('OpenCV'); Var FS = Requirement ('FS'); // View engine setup app.set ('views', path.join (__dirname, 'views')); App.set ('visual engine', 'EJS'); // Connection Setup App (.) IO (); App.io.sockets.on ('connection', function (socket) {socket.on ('videostream', function (data) {socket.broadcast.emit ('sendVideo', data); var buffer = new buffer (data) , 'Base 64');})}}  

When I'm trying to detect the face in a photo, I am using something like this:

  cv .readImage ("/ picture.png", function (mistake, im) {});  

But I know people's address in front of the camera How can I use data from the Webcam Stream to install? Thank you!


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -