-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathblockHist.m
53 lines (49 loc) · 1.44 KB
/
blockHist.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
function outHist = blockHist(angle, mag)
mag = mag/norm(mag);
%angle = abs(angle);
%angle= imadd(angle,90);
hist = zeros(1,9);
for y = 1:1:8
for x = 1:1:8
t = angle(y,x);
m = mag(y,x);
votes = interpolate(t,m);
hist(1, votes(1,1)) = hist(1, votes(1,1)) + votes(1,2);
hist(1, votes(2,1)) = hist(1, votes(2,1)) + votes(2,2);
end
end
outHist = hist;
hist = zeros(1,9);
for y = 1:1:8
for x = 1:9:16
t = angle(y,x);
m = mag(y,x);
votes = interpolate(t,m);
hist(1, votes(1,1)) = hist(1, votes(1,1)) + votes(1,2);
hist(1, votes(2,1)) = hist(1, votes(2,1)) + votes(2,2);
end
end
outHist = [outHist,hist];
hist = zeros(1,9);
for y = 9:1:16
for x = 1:1:8
t = angle(y,x);
m = mag(y,x);
votes = interpolate(t,m);
hist(1, votes(1,1)) = hist(1, votes(1,1)) + votes(1,2);
hist(1, votes(2,1)) = hist(1, votes(2,1)) + votes(2,2);
end
end
outHist = [outHist,hist];
hist = zeros(1,9);
for y = 9:1:16
for x = 9:1:16
t = angle(y,x);
m = mag(y,x);
votes = interpolate(t,m);
hist(1, votes(1,1)) = hist(1, votes(1,1)) + votes(1,2);
hist(1, votes(2,1)) = hist(1, votes(2,1)) + votes(2,2);
end
end
outHist = [outHist,hist];
end