You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.3 KiB
70 lines
1.3 KiB
import processing.io.*;
|
|
import processing.serial.*;
|
|
//import processing.video.*;
|
|
import gohai.glvideo.*;
|
|
|
|
Serial port;
|
|
|
|
// ----------------------- camera ---------------------------------------------------------------------------------
|
|
//Capture video;
|
|
GLCapture video;
|
|
PImage img;
|
|
boolean takePicture = true;
|
|
int videoWidth = 480;
|
|
int videoHeight = 240;
|
|
|
|
int sending = 0;
|
|
|
|
void setup() {
|
|
size(480, 240, P2D);
|
|
frameRate(10);
|
|
colorMode(HSB, 100, 100, 100);
|
|
|
|
String portName = Serial.list()[0];
|
|
port = new Serial(this, portName, 9600);
|
|
|
|
String[] cameras = GLCapture.list();
|
|
video = new GLCapture(this, cameras[0], width, height, 10);
|
|
video.start();
|
|
|
|
GPIO.pinMode(4, GPIO.INPUT);
|
|
|
|
// video = new Capture(this, width, height);
|
|
// video.start();
|
|
|
|
background(0);
|
|
delay(2000);
|
|
|
|
}
|
|
|
|
void draw() {
|
|
ephPercentage();
|
|
|
|
|
|
if (GPIO.digitalRead(4) == GPIO.LOW && takePicture == true){
|
|
takePicture = false;
|
|
delay(4000);
|
|
video.pause();
|
|
makePicture();
|
|
}
|
|
|
|
if(GPIO.digitalRead(4) == GPIO.HIGH && takePicture == false){
|
|
takePicture = true;
|
|
video.start();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void keyPressed() {
|
|
if (key == 'S' || key == 's') {
|
|
video.pause();
|
|
makePicture();
|
|
}
|
|
if (key == 'B' || key == 'b') {
|
|
backupFrame();
|
|
}
|
|
if (key == 'G' || key == 'g') {
|
|
video.start();
|
|
}
|
|
}
|