You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
749 B
Java
31 lines
749 B
Java
8 years ago
|
import processing.core.*;
|
||
|
import processing.video.*;
|
||
|
|
||
|
|
||
|
class Camera {
|
||
|
Capture cam;
|
||
|
|
||
|
/*
|
||
|
Set up a camera.
|
||
|
*/
|
||
|
Camera(PApplet applet, int cameraMode) {
|
||
|
String[] cameras = Capture.list();
|
||
|
if (cameras.length == 0) {
|
||
|
PApplet.println("There are no cameras available for capture.");
|
||
|
applet.exit();
|
||
|
} else {
|
||
|
PApplet.println("Available cameras:");
|
||
|
for(int i = 0; i < cameras.length; i++) {
|
||
|
PApplet.println(i, cameras[i]);
|
||
|
}
|
||
|
PApplet.print("Using camera mode ");
|
||
|
PApplet.println(cameras[cameraMode]);
|
||
|
this.cam = new Capture(applet, cameras[cameraMode]);
|
||
|
this.cam.start();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|