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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 | clc; clear; close all;
addpath(genpath('data'));
addpath(genpath('external'));
addpath(genpath('utils'));
S1 = read_off_shape('deform_sph_38.off');
S2 = read_off_shape('deform_sph_8.off');
kEig = 60;
L{1} = compute_laplacian_basis(S1, kEig);
L{2} = compute_laplacian_basis(S2, kEig);
% compute ground-truth funcitonal maps
C = cell(2);
for i = 1:2
for j = 1:2
if i ~= j
C{i, j} = L{j}.evecs'*L{j}.A*L{i}.evecs;
else
C{i, j} = eye(kEig);
end
end
end
% compute the shape difference operators
[u1, v1] = eig(C{1, 2}'*C{1, 2});
[v1, ind] = sort(diag(v1), 'descend');
u1 = u1(:, ind);
[u2, v2] = eig(C{2, 1}'*C{2, 1});
[v2, ind] = sort(diag(v2), 'descend');
u2 = u2(:, ind);
s = max(max(v1), max(v2));
U= extract_latent_basis(C);
% Select the consistent basis
l = 52;
B = U.evecs(:, 1:l);
X = cell(size(C));
for i = 1:length(C)
for j = 1:length(C)
X{i, j} = C{j, i}';
end
end
W = extract_latent_basis(X);
E = B'*W.mat*B;
E = (E+E')/2;
[u, v] = eig(E);
[v, idx] = sort(diag(v), 'descend');
u = u(:, idx);
f = u(:, 1);
f1 = L{1}.evecs*(U.bases{1}(:, 1:l)*f);
f2 = L{2}.evecs*(U.bases{2}(:, 1:l)*f);
g = u(:, 4);
g1 = L{1}.evecs*(U.bases{1}(:, 1:l)*g);
g2 = L{2}.evecs*(U.bases{2}(:, 1:l)*g);
figure;
subplot(3, 4, 1);
plot(v1, 'LineWidth', 2);
xlabel('Index', 'FontWeight','bold','FontSize',30);
ylabel('Spectrum of D_{M, N}', 'FontWeight','bold', 'FontSize',30);
ylim([0, s+0.1]);
xlim([0, 60]);
set(gca,'fontsize',5)
hold on;
plot(1,v1(1),'r.', 'MarkerSize',10);
hold on;
plot(60, v1(60), 'k.', 'MarkerSize',10);
subplot(3, 4, 2);
plot(v2, 'LineWidth', 2);
xlabel('Index', 'FontWeight','bold','FontSize',30);
ylabel('Spectrum of D_{N, M}', 'FontWeight','bold', 'FontSize',30);
ylim([0, s+0.1]);
xlim([0, 60]);
set(gca,'fontsize',5)
hold on;
plot(1,v2(1),'r.', 'MarkerSize',10);
hold on;
plot(60, v2(60), 'k.', 'MarkerSize',10);
subplot(3, 4, 3);
plot(v, 'LineWidth', 2);
xlabel('Index', 'FontWeight','bold','FontSize',30);
ylabel('Spectrum of V^X', 'FontWeight','bold', 'FontSize',30);
xlim([0, 60])
set(gca,'fontsize',5)
hold on;
plot(1,v(1), 'r.', 'MarkerSize',10);
hold on;
plot(4, v(4), 'k.', 'MarkerSize',10);
subplot(3, 4, 5);
plotMesh(L{1}, (L{1}.evecs*u1(:, 1)).^2, 180, -60);
subplot(3, 4, 6);
plotMesh(L{2}, (L{2}.evecs*u2(:, 1)).^2, 180, -60);
subplot(3, 4, 7);
plotMesh(L{1}, f1.^2, 180, -60);
subplot(3, 4, 8);
plotMesh(L{2}, f2.^2, 180, -60);
subplot(3, 4, 9);
plotMesh(L{1}, (L{1}.evecs*u1(:, 60)).^2, 180, -60);
subplot(3, 4, 10);
plotMesh(L{2}, (L{2}.evecs*u2(:, 60)).^2, 180, -60);
subplot(3, 4, 11);
plotMesh(L{1}, g1.^2, 180, -60);
subplot(3, 4, 12);
plotMesh(L{2}, g2.^2, 180, -60);
|