Skip to content

Instantly share code, notes, and snippets.

@boyofgreen
Created March 26, 2012 20:24
Show Gist options
  • Save boyofgreen/2209397 to your computer and use it in GitHub Desktop.
Save boyofgreen/2209397 to your computer and use it in GitHub Desktop.
face reco js
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