Created
March 26, 2012 20:24
-
-
Save boyofgreen/2209397 to your computer and use it in GitHub Desktop.
face reco js
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
drawToCanvas : function(effect) { | |
var video = App.video, | |
ctx = App.ctx, | |
canvas = App.canvas, | |
i; | |
ctx.drawImage(video, 0, 0, 520,426); | |
//get the image data pixels from the canvas and pass it to js | |
App.pixels = ctx.getImageData(0,0,canvas.width,canvas.height); | |
// Hipstergram! | |
if (effect === 'hipster') { | |
for (i = 0; i < App.pixels.data.length; i=i+4) { | |
App.pixels.data[i + 0] = App.pixels.data[i + 0] * 3 ; | |
App.pixels.data[i + 1] = App.pixels.data[i + 1] * 2; | |
App.pixels.data[i + 2] = App.pixels.data[i + 2] - 10; | |
} | |
ctx.putImageData(App.pixels,0,0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment