-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestResult.m
37 lines (35 loc) · 862 Bytes
/
testResult.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
function faceornot = testResult(cascade,feature)
% detect face in 64*64
% Input
% cascade: multi-stage boosted classifier
% feature: feature value
% Output
% faceornot: 1/-1
totLen = length(cascade);
for stage = 1:totLen
h = cascade(stage);
if h.T~=1
sumResult = 0;
for t = 1:h.T
Idx = h.featureIdx(t);
fea = feature(feature(:,2)==Idx,1);
ht = sign(h.p(t)*(h.theta(t)-fea));
sumResult = sumResult + h.alpha(t)*ht;
end
if sumResult-h.modifytheta<0
faceornot = -1;
return;
end
faceornot = 1;
else
Idx = h.featureIdx(1);
fea = feature(feature(:,2)==Idx,1);
ht = sign(h.p(1)*(h.theta(1)-fea));
if ht<1
faceornot = -1;
return;
end
faceornot = 1;
end
end
end