Skip to docs navigation

04.02 Camera Input

On this page

p5.js has a video captureexternal link ability built into the library.

// video capture example from p5.js Reference
// https://p5js.org/examples/dom-video-capture.html
let capture;

function setup() {
  createCanvas(390, 240);
  capture = createCapture(VIDEO);
  capture.size(320, 240);
  //capture.hide();
}

function draw() {
  background(255);
  image(capture, 0, 0, 320, 240);
  filter(INVERT);
}