Best Fiit 2D Transformation

4 次查看(过去 30 天)
James Eder
James Eder 2020-7-28
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Least Squares 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by