Skip to content

Instantly share code, notes, and snippets.

@atduskgreg
Last active September 29, 2018 13:32
Show Gist options
  • Save atduskgreg/c0b0930a88d803511c70 to your computer and use it in GitHub Desktop.
Save atduskgreg/c0b0930a88d803511c70 to your computer and use it in GitHub Desktop.
import gab.opencv.*;
import processing.video.*;
import java.awt.*;
Capture video;
OpenCV opencv;
void setup() {
size(640, 480);
video = new Capture(this, 640/2, 480/2);
opencv = new OpenCV(this, 640/2, 480/2);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
video.start();
}
void draw() {
scale(2);
background(0);
opencv.loadImage(video);
Rectangle[] faces = opencv.detect();
if(faces.length == 0){
fill(255);
stroke(255);
text("haha", 50,50);
}
}
void captureEvent(Capture c) {
c.read();
}
void keyPressed(){
println(key);
if(key == ' '){
println("space");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment