Skip to content

Instantly share code, notes, and snippets.

@dex1t
Created June 10, 2013 16:55
Show Gist options
  • Save dex1t/5750379 to your computer and use it in GitHub Desktop.
Save dex1t/5750379 to your computer and use it in GitHub Desktop.
2011/6/23 4:07
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