Forked from nataliefreed/videoFilterStartingPoint.js
Created
January 25, 2018 18:57
-
-
Save lizzybrooks/24159abe6fcdbcafd51825cbf132551d 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