function [img2transf] = imgTransform (img1, img2, img1_path, img2_path, matchedFP, tform)
%% Funkcia na transformaciu a zarovnanie obrazov podla FP

%%
FP1(:,2) = matchedFP(:,1);
FP1(:,1) = matchedFP(:,2);
FP2(:,2) = matchedFP(:,3);
FP2(:,1) = matchedFP(:,4);



if tform == 1
    tformtype = 'nonreflective similarity';
elseif tform == 2
    tformtype = 'similarity';
elseif tform == 3
    tformtype = 'affine';
elseif tform == 4
    tformtype = 'projective';
elseif tform == 5
    tformtype = 'polynomial';
elseif tform == 6
    tformtype = 'lwm';
end

tform = cp2tform(FP2, FP1, tformtype);
unregistered = img2;

info = imfinfo(img1_path);

img2transf = imtransform(unregistered,tform, 'XData',[1 info.Width], 'YData',[1 info.Height]);

% img2transf = imtransform(img2,tform);




end