Unable to use a built-in Mac camera.
in
Integration and Hardware
•
11 months ago
Hello,
I'm trying to get a video feed in Processing from a Mac's built-in FaceTime camera. The code I am using is essentially copied and pasted from the video library reference. However, it is not working. The program builds and runs, but all that happens is a small, gray window opens up, the line "if (cam.available()){" gets highlighted in yellow, and the red error bar at the bottom-ish of the Processing window reads "NullPointerException". Here is my code:
import processing.video.*;
Capture cam;
int width=1280;
int height=720;
void steup(){
size(1280,720);
cam = new Capture(this,width,height,"FaceTime HD Camera (Built In),size=1280x720,fps=30",30);
cam.start();
}
void draw(){
if (cam.available()){
cam.read();
}
image(cam,0,0);
}
I've tried commenting out "if (cam.available()){", and its accompanying }, but all that changes is that "cam.read();" gets highlighted instead. I've looked
here for help, but got none from it.
Thanks,
makatak
1