sustaining_gazes/matlab_version/face_validation/paw_helpers/CalculateCoefficients.m
Tadas Baltrusaitis 5959176921 Some big changes:
- face validator is a retrained CNN now
- starting retiring CLM-Z from OpenFace
2017-08-01 17:11:02 -04:00

33 lines
975 B
Matlab

function [ coeffs ] = CalculateCoefficients( alphas, betas, triangulation, destination )
%CALCULATECOEFFICIENTS Summary of this function goes here
% Detailed explanation goes here
xs = destination(:,1);
ys = destination(:,2);
triangulation = triangulation + 1;
numTri = size(triangulation, 1);
coeffs = zeros(numTri, 3);
for l=1:numTri
i = triangulation(l,1);
j = triangulation(l,2);
k = triangulation(l,3);
c1 = xs(i);
c2 = xs(j) - c1;
c3 = xs(k) - c1;
c4 = ys(i);
c5 = ys(j) - c4;
c6 = ys(k) - c4;
coeffs(l,1) = c1 + c2*alphas(l,1) + c3*betas(l,1);
coeffs(l,2) = c2*alphas(l,2) + c3*betas(l,2);
coeffs(l,3) = c2*alphas(l,3) + c3*betas(l,3);
coeffs(l,4) = c4 + c5*alphas(l,1) + c6*betas(l,1);
coeffs(l,5) = c5*alphas(l,2) + c6*betas(l,2);
coeffs(l,6) = c5*alphas(l,3) + c6*betas(l,3);
end
end