-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMOPS.m
More file actions
27 lines (25 loc) · 774 Bytes
/
MOPS.m
File metadata and controls
27 lines (25 loc) · 774 Bytes
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
function LookupTable = MOPS(I, Index)
% The multi-scale oriented patches (MOPS) algorithm described by Brown,
% Szeliski, and Winder.
H = Haar(8);
b = 10;
LookupTable = zeros(b, b, b, 20, 2);
for n = 1 : size(Index, 1);
i = Index(n, 1);
j = Index(n, 2);
d = I((i - 3) : (i + 4), (j - 3) : (j + 4));
m = sum(sum(d)) / 8^2;
v = sqrt(sum(sum((d - m).^2)) / 8^2);
d = (d - m) / v;
d = H*d*H';
c_1 = max(min(round(d(2, 1) + 5), 10), 1);
c_2 = max(min(round(d(1, 2) + 5), 10), 1);
c_3 = max(min(round(d(2, 2) + 5), 10), 1);
for m = 1 : 20
if LookupTable(c_1, c_2, c_3, m, 1) == 0
LookupTable(c_1, c_2, c_3, m, 1) = i;
LookupTable(c_1, c_2, c_3, m, 2) = j;
break;
end
end
end