javascript - Unable to track eyes using tracking.js -
i creating eye staring game. have used meteorjs, trackingjs tracking stuffs , peerjs streaming. in older version of trackingjs , eye detecting feature there in new version face detecting feature available. here demo app tracks face. http://sushantbaj.meteor.com/ , link github repo: https://github.com/sushant12/eye-staring in docs of trackingjs, said that
in order use object tracker, need instantiate constructor passing classifier data detect:
var objects = new tracking.objecttracker(['face', 'eye', 'mouth']);
so passed 'eye' parameter did not track eye.
var tracker = new tracking.objecttracker('eye'); tracker.setinitialscale(4); tracker.setstepsize(2); tracker.setedgesdensity(0.1); tracking.track('#video', tracker, { camera: true }); tracker.on('track', function(event) { context.clearrect(0, 0, canvas.width, canvas.height); event.data.foreach(function(rect) { context.strokestyle = '#a64ceb'; context.strokerect(rect.x, rect.y, rect.width, rect.height); context.font = '11px helvetica'; context.fillstyle = "#fff"; context.filltext('x: ' + rect.x + 'px', rect.x + rect.width + 5, rect.y + 11); context.filltext('y: ' + rect.y + 'px', rect.x + rect.width + 5, rect.y + 22); }); });
the problem has been solved.
var tracker = new tracking.objecttracker('eye'); tracker.setstepsize(1.7); tracking.track('#video', tracker, { camera: true }); tracker.on('track', function(event) { context.clearrect(0, 0, canvas.width, canvas.height); event.data.foreach(function(rect) { context.strokestyle = '#a64ceb'; context.strokerect(rect.x, rect.y, rect.width, rect.height); }); });
Comments
Post a Comment