-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathupdateMean.m
More file actions
27 lines (20 loc) · 794 Bytes
/
updateMean.m
File metadata and controls
27 lines (20 loc) · 794 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
%{
Description: Finds the optimal shape mean given the aligned pointsets
Inputs:
aligned_pointsets [DxNxM] : The pointsets aligned using optimize1.m or optimize2.m
normalize [boolean] : Specifies whether to normalize the mean or
not. If we work in the preshape space, this is required, but it's
not needed in the second approach
Outputs:
mu [DxN] : The mean pointset
%}
function mu = updateMean(aligned_pointsets, normalize)
% Shape mean is just the average of the aligned pointsets
mu = mean(aligned_pointsets, 3); % DxN
% Projection on the constraint set (unit norm)
if normalize
temp = mu .^ 2;
scale = sqrt(sum(temp(:)));
mu = mu / scale;
end
end