-
Notifications
You must be signed in to change notification settings - Fork 1
/
EnumAllFeatures.m
71 lines (62 loc) · 1.47 KB
/
EnumAllFeatures.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function all_ftypes = EnumAllFeatures(W,H)
all_ftypes = zeros(20*W^2*H^2,5);
global SanityCheck;
i = 1;
%Feature 1
for w = 1:W
for h = 1:floor(H/2)
for x = 1:H-2*h+1
for y = 1:W-w+1
if SanityCheck && (x+h-1>H || y+w-1>W)
error('exceed dimensions');
end
all_ftypes(i,:) = [x y w h 1];
i=i+1;
end
end
end
end
%Feature 2
for w = 1:floor(W/2)
for h = 1:H
for x = 1:H-h+1
for y = 1:W-2*w+1
if SanityCheck && (x+h-1>H || y+w-1>W)
error('exceed dimensions');
end
all_ftypes(i,:) = [x y w h 2];
i=i+1;
end
end
end
end
%Feature 3
for w = 1:floor(W/3)
for h = 1:H
for x = 1:H-h+1
for y = 1:W-3*w+1
if SanityCheck && (x+h-1>H || y+w-1>W)
error('exceed dimensions');
end
all_ftypes(i,:) = [x y w h 3];
i=i+1;
end
end
end
end
%Feature 4
for w = 1:floor(W/2)
for h = 1:floor(H/2)
for x = 1:H-2*h+1
for y = 1:W-2*w+1
if SanityCheck && (x+h-1>H || y+w-1>W)
error('exceed dimensions');
end
all_ftypes(i,:) = [x y w h 4];
i=i+1;
end
end
end
end
all_ftypes = all_ftypes(1:i-1,:);
end