This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.




Capture cam;

void setup() {
  size(640, 480);

  String[] cameras = Capture.list();
  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
  } else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
    // The camera can be initialized directly using an 
    // element from the array returned by list():
    cam = new Capture(this, cameras[0]);

void draw() {
  if (cam.available() == true) {;
  image(cam, 0, 0);
  // The following does the same, and is faster when just drawing the image
  // without any additional resizing, transformations, or tint.
  //set(0, 0, cam);

Description Datatype for storing and manipulating video frames from an attached capture device such as a camera. Use Capture.list() to show the names of any attached devices. Using the version of the constructor without name will attempt to use the last device used by a QuickTime program.
available() Returns "true" when a new video frame is available to read
start() Starts capturing frames from the selected device
stop() Stops capturing frames from an attached device
read() Reads the current video frame
list() Gets a list of all available capture devices such as a camera
Capture(parent, requestConfig)
Capture(parent, requestWidth, requestHeight)
Capture(parent, requestWidth, requestHeight, frameRate)
Capture(parent, requestWidth, requestHeight, cameraName)
Capture(parent, requestWidth, requestHeight, cameraName, frameRate)
parent PApplet: typically use "this"
requestWidth int: width of the frame
requestHeight int: height of the frame
frameRate int: number of frames to read per second
cameraName String: name of the camera
Updated on August 6, 2015 11:06:30pm UTC

Creative Commons License