sustaining_gazes/matlab_version/face_validation/paw_helpers/Crop.m

15 lines
553 B
Mathematica
Raw Normal View History

2016-04-28 21:40:36 +02: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