Skip to content

Instantly share code, notes, and snippets.

@TheVisualG
Created February 5, 2018 15:53
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/ada0a95f989c5c333a197a2d1a2bf75f to your computer and use it in GitHub Desktop.
Save TheVisualG/ada0a95f989c5c333a197a2d1a2bf75f to your computer and use it in GitHub Desktop.
face_Detect_example
import gab.opencv.*;
import java.awt.Rectangle;
OpenCV opencv;
Rectangle[] faces;
void setup() {
opencv = new OpenCV(this, "test.jpg");
size(1080, 720);
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