Created
February 5, 2018 15:53
-
-
Save TheVisualG/ada0a95f989c5c333a197a2d1a2bf75f to your computer and use it in GitHub Desktop.
face_Detect_example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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