Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tracking.js

Zeno Rocha
October 10, 2014

 Tracking.js

The tracking.js library which brings different computer vision algorithms and techniques into the browser environment. By using modern HTML5 specifications, we enable you to do real-time color tracking, face detection and much more.

Zeno Rocha

October 10, 2014
Tweet

More Decks by Zeno Rocha

Other Decks in Programming

Transcript

  1. Success callback function onSuccess(stream) { var video = document.querySelector('video'); video.src

    = window.URL.createObjectURL(stream); video.onloadedmetadata = function(e) { // Pronto }; }
  2. Summary User request <video> Access the camera Reproduce it in

    a video Tracking algorithms Obtain the pixel array <canvas> Result
  3. 100% JavaScript! Open Source No dependencies tracking.js Built-in tracking algorithms

    Easily extensible Simple and intuitive API High performance Unit & performance regression tests Automatic setup ~ 7 Kb
  4. var tracker = new tracking.ColorTracker(‘magenta’); ! tracking.track('#video', tracker, { camera:

    true }); ! tracker.on('track', function(event) { event.data.forEach(function(rect) { // Seu código aqui }); });
  5. var tracker = new tracking.ObjectTracker(‘face’); ! tracking.track('#video', tracker, { camera:

    true }); ! tracker.on('track', function(event) { event.data.forEach(function(rect) { // Seu código aqui }); });
  6. var MyTracker = function() { MyTracker.base(this, 'constructor'); }; ! tracking.inherits(MyTracker,

    tracking.Tracker); ! MyTracker.prototype.track = function(pixels, width, height) { // Seu código aqui ! this.emit('track', { // Seu código aqui }); };
  7. var tracker = new tracking.MyTracker(); ! tracking.track('#video', tracker, { camera:

    true }); ! tracker.on('track', function(event) { event.data.forEach(function(rect) { // Seu código aqui }); });
  8. var tracker = new tracking.ColorTracker(‘magenta’); ! tracking.track('#video', tracker, { camera:

    true }); ! tracker.on('track', function(event) { event.data.forEach(function(rect) { // Seu código aqui }); }); Remember?