39 lines
648 B
Plaintext
39 lines
648 B
Plaintext
import processing.video.*;
|
|
|
|
Capture cam;
|
|
int x =0;
|
|
int d = 26;
|
|
int eyeZone = 10;
|
|
float s = 1/30;
|
|
int start = 0;
|
|
|
|
void setup() {
|
|
size(750, 480);
|
|
cam = new Capture(this, width, height);
|
|
cam.start();
|
|
loop();
|
|
x=0;
|
|
}
|
|
|
|
void draw() {
|
|
if(cam.available()) {
|
|
cam.read();
|
|
}
|
|
image(cam, 0, 0);
|
|
if(x<10*1/s && start==1){
|
|
saveFrame("frame_#####.jpg");
|
|
x++;
|
|
}
|
|
//fill(255,0,0);
|
|
rect(width*0.5-d*2-eyeZone/2,height*0.5,eyeZone,5);
|
|
rect(width*0.5+d*2-eyeZone/2,height*0.5,eyeZone,5);
|
|
fill(0,0);
|
|
rect(width*0.5-3*d/2,height*0.5-d*5/2,3*d,3*d/2);
|
|
delay( int(s*1000) );
|
|
}
|
|
|
|
void keyPressed() {
|
|
start = 1;
|
|
println("ok");
|
|
}
|