Best Fiit 2D Transformation

3 views (last 30 days)
James Eder
James Eder on 28 Jul 2020
I have N pairs of points in the X,Y plane. I am trying to find the best fit 2D transformation which consists of the following sequence of operations.
  1. Stretch in the X and Y directions, governed by two parameters Lambda_X and Lambda_Y
  2. A rotation by an angle "theta" about the origin.
  3. A shift governed by 2 parameters, delta_X, delta_Y
Is there a procedure to determine the best fit 5 parameters to which performs this transformation?
I've been successful at using SVD to determine the best fit rigid body transformation. If the original N points are given in a 2XN matrix, Xin and the transformed points are given by another 2XN matrix Xout, I can calculate the best fit rigid body transformation by the following code.
%strip off mean position from Xin
XinNoMean=Xin-repmat(mean(Xin,2),1,inCol);
%strip off mean position fron Xout
XoutNoMean=Xout-repmat(mean(Xout,2),1,inCol);
%throw away any stretch components to extract orthogonal transformation
%calculate covariance of input and output
Q=XoutNoMean*XinNoMean';
%perform svd of the covariance matrix
[U,~,V]=svd(Q);
A=(U*V'); %get rid of the stretch terms
%calculate translation
b=mean(Xout-A*Xin,2);
Here the matrix A is an orthogonal matrix whose eigenvalues are 1,1. The A matrix depends upon 1 paramter, and b vector depends upon 2 parameters.
Somehow, I feel like I want to find the best fit SVD decomposition of the matrix Q which has V identically equal to eye(2). Any ideas would be greatly appreciated.

Answers (0)

Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!