Created
December 6, 2016 14:29
-
-
Save datitran/43227a09a289362d06dd02a3501c8c6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grabFrame: function() { | |
| var self = this; | |
| this.canvasCtx.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height); | |
| this.canvas.toBlob(function(imageData) { | |
| var postImageReq = new XMLHttpRequest(); | |
| postImageReq.open("POST", "/prediction", true); | |
| postImageReq.responseType = "json"; | |
| postImageReq.onload = function(event) { | |
| var faces = postImageReq.response.faces; | |
| self.drawFaces(faces); | |
| self.scheduleFrameGrab(); | |
| }; | |
| postImageReq.send(imageData); | |
| }, "image/jpeg", 70); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment