Created
June 10, 2013 16:55
-
-
Save dex1t/5750379 to your computer and use it in GitHub Desktop.
2011/6/23 4:07
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 hypermedia.video.*; | |
import java.awt.Rectangle; | |
OpenCV opencv; | |
PImage img; | |
void setup() { | |
size( 320, 240 ); | |
opencv = new OpenCV(this); | |
opencv.capture( width, height ); | |
opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); | |
img = loadImage("hidaka.jpeg");//好きな画像をProcessing作業ディレクトリに。 | |
imageMode(CORNER); | |
} | |
void draw() { | |
opencv.read(); | |
image( opencv.image(), 0, 0 ); | |
Rectangle[] faces = opencv.detect(); | |
for( int i=0; i<faces.length; i++){ | |
image(img, 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