Processing P5.JS Webcam Video Test

This is a test of Processing P5.JS version 0.5 from Oct. 2017. The objective is to grab the output of the user's webcam and display it on-screen after applying the INVERT filter to the image.


The P5.JS source code is as follows:

var video;

function setup() {
  var myCanvas = createCanvas(800, 600);
  myCanvas.parent('myContainer');  // put the canvas inside the DIV named myCOntainer
  pixelDensity(1);
  video = createCapture(VIDEO);
  video.parent('myContainer');
  video.size(200, 150);  // this captures a scaled down version of the video
}

function draw() {
  video.loadPixels();
  image(video, 0, 0, 400, 300);
  filter('INVERT');
}

Return to the Processing and Processing.js Experiments in Digital Art Index