% get image located in different (known) directory
x = erase(mfilename('fullpath'),extractAfter(mfilename('fullpath'),'matlab_code'));
img = imread(fullfile(x,'Model','img','terminator.jpg'));

% load control points
load('test/test_PQ2')

% initialize class
stepXY = [10,10];
m = MLSdeformation(size(img),stepXY,'rigid');

% precompute for given set of control points p
m.mlsPrecomupte(p)

% calculate deformation in evaluation points v for given set of deformed positions of control
% points q; you can select method (constraints) - last called overwrites
% results
m.mlsRigid(q)
tic;
m.mlsSimilarity(q)


newImg = uint8(zeros(size(img)));
 newImg = m.interpolate1(img,newImg);
toc

figure; imshow(newImg);shg;
