-
Notifications
You must be signed in to change notification settings - Fork 31
/
plotPath.m
47 lines (41 loc) · 1.14 KB
/
plotPath.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
function [] = plotPath( t_transforms, n_transforms )
%%plotPath Summary
% Plots original camera path and optimized camera path
num_frames = size(t_transforms, 1) + 1;
orig_a = zeros(num_frames - 1, 1);
C_t = cell(num_frames - 1, 1);
x = [0 0 1];
for k = 1:num_frames-1
x = x * t_transforms{k};
C_t{k} = x;
orig_a(k) = x(2);
end
new_a = zeros(num_frames - 1, 1);
for k = 1:num_frames-1
y = C_t{k} * n_transforms{k};
new_a(k) = y(2);
end
figure;
plot(orig_a, '-r'); hold on;
plot(new_a, '-g'); hold off;
title('Motion in y');
legend('Original Path','Optimized Path');
orig_a = zeros(num_frames - 1, 1);
C_t = cell(num_frames - 1, 1);
x = [0 0 1];
for k = 1:num_frames-1
x = x * t_transforms{k};
C_t{k} = x;
orig_a(k) = x(1);
end
new_a = zeros(num_frames - 1, 1);
for k = 1:num_frames-1
y = C_t{k} * n_transforms{k};
new_a(k) = y(1);
end
figure;
plot(orig_a, '-r'); hold on;
plot(new_a, '-g'); hold off;
title('Motion in x');
legend('Original Path','Optimized Path');
end