Updates for video capture examples, new keywords.txt

This commit is contained in:
Casey Reas
2013-03-05 12:53:13 -08:00
parent 6b5eb6ae55
commit 1ee4d922e3
16 changed files with 122 additions and 58 deletions
@@ -2,8 +2,8 @@
* Getting Started with Capture.
*
* Reading and displaying an image from an attached Capture device.
*/
*/
import processing.video.*;
Capture cam;
@@ -12,21 +12,26 @@ void setup() {
size(640, 480, P2D);
String[] cameras = Capture.list();
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
}
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();
}
// Or, the settings can be defined based on the text in the list
//cam = new Capture(this, 640, 480, "Built-in iSight", 30);
// Start capturing the images from the camera
cam.start();
}
}
void draw() {
@@ -34,7 +39,9 @@ void draw() {
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.
// The following does the same as the above image() line, but
// is faster when just drawing the image without any additional
// resizing, transformations, or tint.
//set(0, 0, cam);
}
}