We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey, I get this error message "Can not make a static reference to the non-static method list () from the type Component". Can this be related to the new processing version (2.1.1)? The sketch has worked before.
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();
}
image(cam, 0, 0);
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(0, 0, cam);
}
Regards Kucky
Answers
Similar issue found in GitHub: https://github.com/processing/processing/issues/930
Perhaps the same, repeated in the new version?
Thank you for forwarding. I will then wait and see.
I just tried the above code with Processing 2.1.1 on OSX 10.9.1 and a single camera attached and it worked without a problem.
@kucky if you are on windows, please be aware that the video library is in fact broken in 2.1.1, see https://github.com/processing/processing/issues/2327
The issue mentions a simple workaround until 2.1.2 is ready.
Wow, very quick responses and support. Thank you.
@ quark: I'll try
How to do this with a single camera? cam = new Capture(this, cameras[0]); :-/ :\">