forked from LaikinasAkauntas/ctw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemoKit.m
More file actions
executable file
·72 lines (57 loc) · 1.87 KB
/
demoKit.m
File metadata and controls
executable file
·72 lines (57 loc) · 1.87 KB
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
71
72
% A demo for aligning two subjects opening cabinet using CTW.
% This is the same function used for visualizing (Fig. 4) the second experiment (Sec 5.2) in the CTW paper.
%
% History
% create - Feng Zhou (zhfe99@gmail.com), 01-20-2012
% modify - Feng Zhou (zhfe99@gmail.com), 05-05-2013
clear variables;
prSet(4);
%% src parameter
act = 'cabinet';
subIdx = [1 2];
rann = 'y';
feats = {'XQ', 'XQ'};
parPca = st('d', .99);
%% algorithm parameter
parDtw = [];
parCca = st('d', .8, 'lams', .6); % CCA: reduce dimension to keep at least 0.8 energy, set the regularization weight to .6
parCtw = st('debg', 'n');
%% src
wsSrc = kitAliSrc(act, subIdx, rann, 'svL', 2);
%% data
wsData = kitAliData(wsSrc, 'svL', 2);
pFss = wsData.pFss;
Xs = {wsData.XQs{1}, wsData.XQs{2}};
%% utw (initialization)
aliUtw = utw(Xs, [], []);
%% dtw
aliDtw = dtw(Xs, [], parDtw);
%% ctw
aliCtw = ctw(Xs, aliDtw, [], parCtw, parCca, parDtw);
%% show sequences
rows = 1; cols = 3;
axs = iniAx(3, rows, cols, [300 * rows, 300 * cols]);
parPca = st('d', 2, 'homo', 'n');
parMk = st('mkSiz', 2, 'lnWid', 1, 'ln', '-');
parAx = st('mar', .1, 'ang', [30 80], 'tick', 'n');
XX0s = pcas(Xs, parPca);
shs(XX0s, parMk, parAx, 'ax', axs{1, 1});
title('Original');
Ys = gtwTra(homoX(Xs), aliCtw, parCca, parDtw);
YYs = pcas(Ys, parPca);
shs(YYs, parMk, parAx, 'ax', axs{1, 2});
title('CTW');
shAlis2d({aliDtw, aliCtw}, 'legs', {'dtw', 'ctw'}, 'ax', axs{1, 3});
hold on;
plot([1, 831], [496 496], '--k');
plot([597, 597], [1 779], '--k');
%% show keyframes aligned by DTW
lNew = 10;
rows = 2; cols = lNew;
Ax = iniAx(6, rows, cols, [80 * rows, 100 * cols], 'wGap', .1, 'hGap', .1);
shMocAliFr(wsSrc, wsData, aliDtw, lNew, Ax, 'all', 'n');
%% show keyframes aligned by CTW
lNew = 10;
rows = 2; cols = lNew;
Ax = iniAx(5, rows, cols, [80 * rows, 100 * cols], 'wGap', .1, 'hGap', .1);
shMocAliFr(wsSrc, wsData, aliCtw, lNew, Ax, 'all', 'n');