Skip to content

Instantly share code, notes, and snippets.

@TheVisualG
Created February 5, 2018 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheVisualG/4cefb2224d432dbd73c9cd0db3f70c16 to your computer and use it in GitHub Desktop.
Save TheVisualG/4cefb2224d432dbd73c9cd0db3f70c16 to your computer and use it in GitHub Desktop.
import gab.opencv.*;
import java.awt.Rectangle;
OpenCV opencv;
Rectangle[] faces;
void setup() {
opencv = new OpenCV(this, "profile_test.jpg");
size(960, 960);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
faces = opencv.detect();
}
void draw() {
image(opencv.getInput(), 0, 0);
noFill();
stroke(0, 255, 0);
strokeWeight(3);
for (int i = 0; i < faces.length; i++) {
rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment