-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobili.m
25 lines (22 loc) · 1.11 KB
/
mobili.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
function [B, finalError] = mobili(seq, frm, id, label_dir)
% label_dir directory path must be relative to './devkit/matlab' directory
avgCarHeight = 1.5208;
avgCarLength = 3.8600;
h = avgCarHeight; % Average height of camera from the ground plane
K = [
721.53, 0, 609.55;
0, 721.53, 172.85;
0, 0, 1;
]; % Camera intrinsics matrix
n = [0, -1, 0]'; % Unit normal vector perpendicular to ground plane
trackletFields = getTracklets(seq, frm, id, label_dir);
B = []; % Matrix to store 3D projection vectors of all instances
finalError = []; % Comparision between estimates and actual measurements
for i=1:numel(seq)
b = [(trackletFields(i, 4) + trackletFields(i, 6)) / 2, trackletFields(i, 7), 1]'; % Midpoint from left and right ends and on the bottom part
proj = -(h * inv(K) * b) / (n' * inv(K) * b);
proj = proj + [0; -avgCarHeight/2; avgCarLength/2]; % In 3D, move up in vertical direction and move inward to arrive at midpoint of 3D projection cube
B = [B; proj'];
finalError = [finalError; abs(proj' - trackletFields(i, 9:11))];
end
end