Video Capture

Hey there,

I want to run my video cam on my Surface 3 in a sketch and have used the Capture class notes to do so but to no avail. I don't get an error msg or any text in the box rather just a blank grey screen... I've checked and the camera does work it just doesn't seem to be identifiable to Processing.

Any suggestions would be greatly appreciated.

I used this code:

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); }

Tagged:

Answers

Sign In or Register to comment.