Hi Dipak,
To explore the formulas behind the Procrustes transformation, you can directly view the source code of the “procrustes” function in MATLAB. To do this, type the following command in the command window:
The formulas used in the “procrustes” function are as follows:
1. Centering:
Subtract the mean of each dataset to center them at the origin:
where
and
are the means of X and Y. 2. Normalization:
Compute the Frobenius norms (square root of the sum of squared elements) of the centered datasets:
Scale both datasets to unit norm:
3. Optimal rotation and reflection:
Compute the optimal rotation/reflection matrix T that aligns
and
: where U and V are the orthogonal matrices from the Singular Value Decomposition (SVD) of A.
4. Reflection handling:
If det(T)<0 and reflection is not desired, adjust T to ensure it's orthogonal with a positive determinant.
5. Scaling:
Compute the optimal scaling factor b if scaling is enabled:
If scaling is not enabled, set b=1.
6. Transformation and distance:
The transformed shape Z is given by:
The sum of squared differences (dissimilarity) is computed as:
Therefore, by using the “open” command, we can view the source code of any function or class in MATLAB. To know more about "open" function, refer to the following documentation link: