mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Updates for video capture examples, new keywords.txt
This commit is contained in:
+17
-10
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user