-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathgetTransViaMerge.m
28 lines (24 loc) · 1.03 KB
/
getTransViaMerge.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
% Codes for CVPR-15 work `Face Alignment by Coarse-to-Fine Shape Searching'
% Any question please contact Shizhan Zhu: [email protected]
% Released on July 25, 2015
function T = getTransViaMerge(win_size,varargin)
% T = getTransViaMerge(win_size,T1,T2,...)
% y = T(x) = T_nargin(...(T2(T1(x))))
% T-s can only be similarity transform: rotate, scale, translate x/y
% Note T-s must have strict order: rotate > scale > translate
% rotate and scale only support: based on the center of patch (same win_size).
% otherwise, don't feel suprised to see this function trouble you.
m = length(varargin{1});
n = length(varargin);
varargin{1} = varargin{1}(:); % to force all Ts to be column vectors.
for i = 2:n
varargin{i} = varargin{i}(:); % to force all Ts to be column vectors.
assert(m == length(varargin{i}));
end;
x_old = repmat([win_size/2,win_size/2,win_size/2,win_size/2-win_size/3],m,1);
x = transPoseFwd(x_old,varargin{1});
for i = 2:n
x = transPoseFwd(x,varargin{i});
end;
T = getTransPair(x_old,x);
end