ewoksndreg.transformation.lstsq.calc_similarity#
- ewoksndreg.transformation.lstsq.calc_similarity(from_coord, to_coord)[source]#
Coordinate array shape is (ndim, ncoord).
Find the similarity transformation between two sets of coordinates by solving this system of equations:
\[\begin{split}\begin{align*} x' &= a.x - b.y + t_0\\ y' &= b.x + a.y + t_1\\ \mathrm{\mathrm{sol}} &= [a, b, t_0, t_1] \end{align*}\end{split}\]\[\begin{split}\begin{equation*} \begin{bmatrix} x_1 & -y1 & 1 & 0 \\ y1 & x_1 & 0 & 1 \\ x_2 & -y_2 & 1 & 0 \\ y_2 & x_2 & 0 & 1 \\ \vdots \end{bmatrix}.\mathrm{sol}= \begin{bmatrix} x_1' \\ y1' \\ x_2' \\ y_2' \\ \vdots \end{bmatrix} \end{equation*}\end{split}\]The resulting transformation matrix is
\[\begin{split}\begin{equation*} \mathrm{sol}=\begin{bmatrix} a & -b & t_0\\ b & a & t_1\\ 0 & 0 & 1 \end{bmatrix} \end{equation*}\end{split}\]- Parameters:
from_coord (
Sequence
[ndarray
])to_coord (
Sequence
[ndarray
])
- Return type:
ndarray