Skip to content

Instantly share code, notes, and snippets.

@zenorocha
Created November 11, 2012 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zenorocha/4055187 to your computer and use it in GitHub Desktop.
Save zenorocha/4055187 to your computer and use it in GitHub Desktop.
tracking.js - Multiple Controller Example
var videoCamera = new tracking.VideoCamera().hide().render().renderVideoCanvas(),
ctx = videoCamera.canvas.context;
var t1 = videoCamera.track({
type: 'color',
color: 'magenta',
onFound: function(track) {
var size = 60 - track.z;
ctx.strokeStyle = "rgb(255,0,255)";
ctx.lineWidth = 3;
ctx.strokeRect(track.x - size*0.5, track.y - size*0.5, size, size);
}
});
var t2 = videoCamera.track({
type: 'color',
color: 'cyan',
onFound: function(track) {
var size = 60 - track.z;
ctx.strokeStyle = "rgb(0,255,255)";
ctx.lineWidth = 3;
ctx.strokeRect(track.x - size*0.5, track.y - size*0.5, size, size);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment