I’m trying to capture my webcam in Processing, but it doesn’t work.
I’m using Processing 3.5.3 OSX Sierra 10.12.6
I used the code from the reference:
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);
}
This is my Console output:
Changed waitThread to realtime priority!
Asked for format description...
I tried to outpute my list of devices with the following code, but the console outputs the same:
import processing.video.*;
Capture cam;
void setup(){
size(600,600);
background(255);
println(Capture.list());
}
void draw(){
println(Capture.list());
}
I’ve tried the code in other computers and it does work, I tried looking into System Preferences / Security & Privacy to see if there were options for camera permissions, but it doesn’t show anything.
Any help will be welcome.
Cheers!