We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone,
I'm new in processing. I found a code to save a jpeg when I press a key, but the code save what is on the screen, and actually, I need to show something different on the screen, while capture a photo from the webcam when I press the key.
This is the actual 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]); } cam = new Capture(this, cameras[0]); cam.start(); } }
void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
}
void mousePressed() { cam.stop(); saveFrame("data/001.jpg"); }
I hope for some help
Answers
Please format your code for the forum.
Does cam.saveFrame(...) work?