headtrackr
headtrackr copied to clipboard
canvas inputs
My project has a camera module already, so I wanted to us that canvas instead of the video. To headtrackr.js I added:
this.customStart = function(canvas, context) {
canvasElement = canvas;
canvasContext = context;
// create ui if needed
if (params.ui) {
ui = new headtrackr.Ui();
}
// create smoother if enabled
smoother = new headtrackr.Smoother(0.35, params.detectionInterval+15);
this.initialized = true;
run = false;
}
this.customTrack = function(canvas){
videoElement = canvas;
track();
}
and in my app:
// on receive canvas from other module
this._htracker.customTrack(canvas);
I also made some hacks around not sending an image before getting a response for the previous one. It could be useful to have a less-hacky way of bypassing the built-in getUserMedia handling.
Here is my demo: http://meemoo.org/iframework/#gist/5005786 Vid: http://vine.co/v/b6PntIHlaj6
Yes, I think it makes sense to add support for providing just a canvas as input. I'll look at adding it.
Meemoo looks very cool, by the way!
Thanks! And thanks for the great library... I knew that it was just a matter of time before somebody made a good one. Meemoo is all about tying these libraries together for quick experimentation and prototyping.