The Procrustes library has an example where it demonstrates how to get the Transformation Matrix of two matrices by solving the Procrustes problem. The library seems to be old and doesn't work in Python 3.
I was wondering if there's any way to use the SciPy implementation of the Procrustes problem and be able to solve the exact problem discussed in the library's example.
Another StackOverflow question seems to need the exact thing that I'm asking here but I can't get it to give me the proper Transformation Matrix that would transform the Source Matrix to nearly Using
In summary, I'd like to be able to implement this example using the SciPy library.
You could use
scipy.linalg.orthogonal_procrustes
. Here's a demonstration. Note that the functiongenerateAB
only exists to generate the arrays A and B for the demo. The key steps of the calculation are to center A and B, and then callorthogonal_procrustes
.Output: