Reference+
Class Name
Capture
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.
Examples
import processing.video.*; Capture cam; void setup() { size(640, 480); String[] cameras = Capture.list(); if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); } else { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) { println(cameras[i]); } // The camera can be initialized directly using an // element from the array returned by list(): cam = new Capture(this, cameras[0]); cam.start(); } } void draw() { if (cam.available() == true) { cam.read(); } 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); }
Constructors
Capture(parent)
Capture(parent, device)
Capture(parent, width, height)
Capture(parent, width, height, fps)
Capture(parent, width, height, device)
Capture(parent, device, fps)
Capture(parent, width, height, device, fps)
Parameters
parent
PApplet, typically "this"device
device namewidth
width in pixelsheight
height in pixelsfps
frames per second
Methods
frameRate()
Sets how often frames are read from the capture device.available()
Returns "true" when a new frame from the device is available to read.start()
Starts capturing frames from an attached device.stop()
Stops capturing frames from an attached device.read()
Reads the current frame of the device.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.