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.

66 lines
1.3 KiB

import processing.io.*;
6 years ago
import processing.serial.*;
6 years ago
//import processing.video.*;
import gohai.glvideo.*;
6 years ago
Serial port;
6 years ago
// ----------------------- camera ---------------------------------------------------------------------------------
//Capture video;
GLCapture video;
PImage img;
6 years ago
boolean countingColors = false, makeBackup = false, takePicture = true;
int videoWidth = 480;
int videoHeight = 240;
6 years ago
6 years ago
int sending = 0;
6 years ago
void setup() {
6 years ago
size(480, 240, P2D);
6 years ago
frameRate(2);
6 years ago
colorMode(HSB, 100, 100, 100);
String portName = Serial.list()[0];
port = new Serial(this, portName, 9600);
6 years ago
6 years ago
String[] cameras = GLCapture.list();
video = new GLCapture(this, cameras[0], width, height, 30);
6 years ago
video.start();
6 years ago
GPIO.pinMode(4, GPIO.INPUT);
// video = new Capture(this, width, height);
// video.start();
6 years ago
background(0);
6 years ago
6 years ago
}
6 years ago
void draw() {
ephPercentage();
if (GPIO.digitalRead(4) == GPIO.LOW && takePicture == true){
takePicture = false;
video.pause();
delay(4000);
makePicture();
}
if(GPIO.digitalRead(4) == GPIO.HIGH && takePicture == false){
takePicture = true;
video.start();
}
}
void keyPressed() {
if (key == 'S' || key == 's') {
6 years ago
video.pause();
makePicture();
}
if (key == 'B' || key == 'b') {
backupFrame();
}
if (key == 'G' || key == 'g') {
video.start();
}
6 years ago
}