/** Show video using specified capture device * @author Mithat Konar */ import processing.video.*; Capture cam; final int CANVAS_WIDTH = 320; final int CANVAS_HEIGHT = 240; final int camnum = 55; // Pick a camnum that makes sense given the canvas size! void setup() { size(CANVAS_WIDTH, CANVAS_HEIGHT); String[] camera_list = Capture.list(); if (camera_list.length == 0) { println("There are no camera_list available for capture."); exit(); } println("Available cameras:"); for (int i = 0; i < camera_list.length; i++) { println("camera " + i + ": " + camera_list[i]); } println(); println("Using camera " + camnum + ", " + camera_list[camnum] + "."); // Instantiate a Capture object by specifying the device name stored // in camera_list array: cam = new Capture(this, camera_list[camnum]); cam.start(); // In Processing 2.0, you need to start the capture device } void draw() { if (cam.available() == true) { cam.read(); } image(cam, 0, 0); }