sustaining_gazes/matlab_version/face_validation/Crop.m

15 lines
553 B
Mathematica
Raw Normal View History

2016-04-28 19:40:36 +00:00
function [warpedImage] = Crop(inputImage, destinationPoints, triangulation, triX, mask, alphas, betas, nPix, minX, minY)
coeffs = CalculateCoefficients(alphas, betas, triangulation, destinationPoints);
[ mapX, mapY ] = WarpRegion( minX, minY, mask, triX, coeffs );
if(size(inputImage,3) == 1)
warpedImage = Remap(inputImage, mapX, mapY);
else
warpedImage = [];
for i=1:size(inputImage,3)
warpedImage = cat(3, warpedImage, Remap(inputImage(:,:,i), mapX, mapY));
end
end
end