-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.m
45 lines (35 loc) · 1006 Bytes
/
demo.m
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
clear all; clear clc; close all;
addpath('lib');
cam = webcam;
while true
preview(cam);
pause;
closePreview(cam);
I = snapshot(cam);
imshow(I);
[F, bboxFace] = face(I);
if isnan(F)
title('Keiner da');
continue;
end
rectangle('Position', bboxFace, 'EdgeColor', 'cyan');
text(bboxFace(1, 1) + 10, bboxFace(1, 2) + 10, 'Gesicht', 'Color', 'cyan');
[M, bboxMouth] = mouth(F);
if isnan(M)
title('Kein Mund sichtbar');
continue;
end
bboxMouth(1) = bboxMouth(1) + bboxFace(1);
bboxMouth(2) = bboxMouth(2) + bboxFace(2);
rectangle('Position', bboxMouth, 'EdgeColor', 'cyan');
text(bboxMouth(1, 1) + 10, bboxMouth(1, 2) + 10, 'Mund', 'Color', 'cyan');
S = smile(M);
if S > 0.5
title('Sie sehen froh aus.');
elseif S > 0.4
title('Ihre Stimmung scheint zu schwanken.');
else
title('Sie sehen nicht sehr froh aus.');
end
pause(.3);
end