blob: 943c946a51b0bd1d7d07408971074a40d9dc8bf0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import hypermedia.video.*;
import java.awt.Rectangle;
OpenCV opencv;
void setup() {
size(640, 480);
fill(0,0);
stroke(255,0,0);
opencv = new OpenCV(this);
opencv.capture(320, 240);
opencv.cascade(OpenCV.CASCADE_FRONTALFACE_ALT);
}
void draw() {
opencv.read();
image(opencv.image(), 0, 0);
// detect anything ressembling a FRONTALFACE
Rectangle[] faces = opencv.detect();
for (int i=0; i<faces.length; i++) {
rect(faces[i].x,faces[i].y,faces[i].width,faces[i].height);
}
image(opencv.image(OpenCV.MEMORY), 329, 0);
}
void keyPressed() {
opencv.remember();
}
|