headtrackr icon indicating copy to clipboard operation
headtrackr copied to clipboard

canvas inputs

Open forresto opened this issue 11 years ago • 2 comments

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

forresto avatar Feb 21 '13 21:02 forresto

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!

auduno avatar Feb 24 '13 21:02 auduno

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.

forresto avatar Feb 24 '13 21:02 forresto