Created
January 23, 2017 01:17
-
-
Save nataliefreed/4b958ba0a840a2ba827097ce8b7b98b3 to your computer and use it in GitHub Desktop.
This file contains 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
//Modified from P5 example at: https://p5js.org/examples/dom-video-capture.html | |
var capture; | |
function setup() { | |
createCanvas(320, 240); | |
capture = createCapture(VIDEO); | |
capture.size(320, 240); | |
capture.hide(); | |
} | |
function draw() { | |
image(capture, 0, 0, 320, 240); | |
loadPixels(); | |
for(var i=0;i<pixels.length;i+=4) { | |
if(pixels[i] > 200) { //if amount of red in a pixel is high enough, add yellow highlights | |
pixels[i] = 255; //red | |
pixels[i+1] = 255; //green | |
pixels[i+2] = 0; //blue | |
}; | |
} | |
updatePixels(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment