Hi!
I’m still very new to processing, I haven’t used it in a while and I’ve changed computer since the last time I was experimenting with it.
I’m trying to get the built in webcam on my 2013 Macbook Pro Retina to show but it seems like I’m missing something.
I have used this code (and installed the video library properly):
import processing.video.*;
Capture video;
void setup() {
size(640,240);
video = new Capture(this, 320, 240);
video.start();
}
void captureEvent(Capture video) {
video.read();
}
void draw() {
image(video, 0, 0);
}
The sketch runs and there are no errors but all I see is the canvas I set up at the right size but it stays grey. The light from my laptop’s camera doesn’t turn on so the camera is not being activated. I tested the camera and it works fine with Photobooth.
I have ran this code from the processing website as well:
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);
}
And the same thing happens, no errors in the console but just a blank canvas. The print function that is supposed to display the available cameras on the machine is apparently not doing anything (nothing show up in the console).
Is this a known error? Everything I can find online about problems with Macbooks mentions at least seeing the camera’s light turning on.
Thank you!