-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeformReg.m
37 lines (35 loc) · 1.33 KB
/
deformReg.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
function [Transform, C] = deformReg(X,Y,varargin)
%% Deformable registration
% Default options
opt.method='nonrigid'; % use nonrigid registration
% opt.method='rigid'; % use nonrigid registration
% opt.beta=6; % the width of Gaussian kernel (smoothness)
% opt.lambda=3; % regularization weight
% opt.viz=1; % show every iteration
% opt.outliers=0; % noise weight
% opt.fgt=0; % do not use FGT (default)
% opt.normalize=1; % normalize to unit variance and zero mean before registering (default)
% opt.corresp=1; % compute correspondence vector at the end of registration (not being estimated by default)
%
% opt.max_it=100; % max number of iterations
% opt.tol=1e-10; % tolerance
opt.beta=6;
opt.lambda=3;
%% parsing options
if numel(varargin)
for i = 1:2:numel(varargin)
propertyName = varargin{i};
propertyValue = varargin{i+1};
if strcmp(propertyName,'max iter')
opt.max_it = propertyValue;
elseif strcmp(propertyName,'tol')
opt.tol = propertyValue;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[Transform, C]=cpd_register(X,Y,opt);
% DeformedMesh = Transform.Y;
figure,cpd_plot_iter(X, Y); title('Before');
figure,cpd_plot_iter(X, Transform.Y); title('After registering Y to X');
end