function plot_matching_result(X,Y,P)


figure;hold on;
plot(X(:,1),X(:,2),'r*','linewidth',2);
plot(Y(:,1),Y(:,2),'b+','linewidth',2);
legend('model point set','data point set','location','best')
title('before point matching')

%plot matching result, here we use affine transformation for warping two
%point sets




Nx=size(X,1);

Xe=[X ones(Nx,1)];
Xtran=Xe*inv(Xe'*Xe)*(Xe'*P*Y);
figure;hold on;
plot(Xtran(:,1),Xtran(:,2),'r*','LineWidth',2);%transformed model point set
plot(Y(:,1),Y(:,2),'b+','LineWidth',2);%data point set
plot([Xtran(:,1) P*Y(:,1)]',[Xtran(:,2),P*Y(:,2)]','k-','LineWidth',2);%point correspondences
legend('transformed model point set','data point set','location','best')
title('point matching result')