Capture stills from webcam without preview on screen

edited December 2015 in Questions about Code

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

Sign In or Register to comment.