-
Notifications
You must be signed in to change notification settings - Fork 2
/
PalmIdentification.m
54 lines (51 loc) · 1.31 KB
/
PalmIdentification.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
46
47
48
49
50
51
52
53
54
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Palm Finder %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Find the find continous line of object from the bottom of the image.
% This will be assumed as the palm base, the palm height is assumed to
% be 35px. A initial offset of 10px is ensures we can emit the false
% positive,the border of box, in case it appears in the image.
%
FOUND_PALM_START = 0;
FOUND_PALM_END = 0;
innerbreak = false;
start_of_palm = [0 0];
end_of_palm = [0 0];
palm_width = end_of_palm(2)-start_of_palm(2);
palm_repeat_count = 0;
for ir=1:1:((nr/2)) % scan from the top, hand is reversed
for ic=1:nc
if(object_image(ir,ic) == 1 )
if(FOUND_PALM_START == 0)
FOUND_PALM_START = 1;
start_of_palm = [ir ic];
else
end_of_palm = [ir ic];
FOUND_PALM_END = 1;
end
else
if(FOUND_PALM_END == 1)
palm_width = end_of_palm(2) - start_of_palm(2);
if(palm_width > 17)
palm_repeat_count = palm_repeat_count + 1;
end
if(palm_repeat_count > 3)
innerbreak = true;
end
break
end
end
end
if(innerbreak)
break
end
FOUND_PALM_START = 0;
FOUND_PALM_END = 0;
end
palm_width = end_of_palm(2) - start_of_palm(2);
if(TRAINING_MODE)
palm_height = palm_height_train;
else
palm_height = uint8(1.5*palm_width);
end
palm_centre = bitshift(palm_width,(-1)); % Divide by 2