-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathFaceDetectorExample.pde
More file actions
50 lines (35 loc) · 1.18 KB
/
FaceDetectorExample.pde
File metadata and controls
50 lines (35 loc) · 1.18 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import ch.bildspur.vision.*;
import ch.bildspur.vision.result.*;
PImage testImage;
DeepVision vision = new DeepVision(this);
ULFGFaceDetectionNetwork network;
ResultList<ObjectDetectionResult> detections;
public void setup() {
size(640, 480);
colorMode(HSB, 360, 100, 100);
testImage = loadImage(sketchPath("data/office.jpg"));
println("creating network...");
network = vision.createULFGFaceDetectorRFB320();
println("loading model...");
network.setup();
//network.setConfidenceThreshold(0.2f);
println("inferencing...");
detections = network.run(testImage);
println("done!");
for (ObjectDetectionResult detection : detections) {
System.out.println(detection.getClassName() + "\t[" + detection.getConfidence() + "]");
}
println("found " + detections.size() + " faces!");
}
public void draw() {
background(55);
detections = network.run(testImage);
image(testImage, 0, 0);
noFill();
strokeWeight(2f);
stroke(200, 80, 100);
for (ObjectDetectionResult detection : detections) {
rect(detection.getX(), detection.getY(), detection.getWidth(), detection.getHeight());
}
surface.setTitle("Face Recognition Test - FPS: " + Math.round(frameRate));
}