Processing with ARToolKit

 

  1. Test if the camera is working

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(); // Read image that camera see
image(cam, 0, 0); // Display image

// set(0, 0, cam); // This does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.

}
}

-Give you list and resolution of all detected camera

 

Advertisements