/** * Anaglyphic 3D Webcam * * CURRENT Reading and displaying all the images from all the attached Capture devices (webcams, ...). * TODO choose left and right webcams * TODO merge images in order to produce anaglyphic blue + red 3D image for anaglyphic blue + red glasses * @author Didier Donsez * @for processing 2.0 and more */ import processing.video.*; Capture[] captures; // @see http://en.wikipedia.org/wiki/Graphic_display_resolutions // QVGA (should be dynamically chosen) static int height=240; static int width=320; void setup() { String[] cameras = Capture.list(); if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); } else { size(width*(cameras.length+1),height); // one more for the anaglyphic blue + red image captures=new Capture[cameras.length]; println("Available cameras:"); for (int i = 0; i < cameras.length; i++) { //if(i==0) continue; // internal webcam on my ladtop if(i==1) continue; // Stereoscopic Multiplexer println(cameras[i]); Capture capture = new Capture(this, width, height, cameras[i]); captures[i]=capture; capture.start(); info(capture); } } } void draw() { for (int i = 0; i < captures.length; i++) { //if(i==0) continue; // internal webcam on my ladtop if(i==1) continue; if (captures[i].available() == true) { captures[i].read(); image(captures[i], i*width, 0); // compute anaglyphic blue + red image // TODO image(anaglyphic, captures.length*width, 0); } } } void info(Capture capture) { //println(capture); print("resolutions:"); int[][] res = capture.resolutions(); for (int r = 0; r < res.length; r++) { print(" " + res[r][0] + "x" + res[r][1]); } println(); print("frame rates:"); String[] fps = capture.framerates(); for (int f = 0; f < fps.length; f++) { print(" "+fps[f]); } println(); }