opynsim.tps3d#
Classes
Represents Thin-Plate Spline (TPS) coefficients in 3D that were calculated from corresponding pairs of points. |
- class opynsim.tps3d.TPSCoefficients3D#
Bases:
objectRepresents Thin-Plate Spline (TPS) coefficients in 3D that were calculated from corresponding pairs of points.
- __init__(*args, **kwargs)#
- property a1#
The first term of the warping equation (\(a_1\)). This could be interpreted as the translation component of the warp.
- property a2#
The second term of the warping equation (\(a_2\)). This could be interpreted as the first column of a 3x3 linear transformation matrix (scale, rotation, and shear).
- property a3#
The third term of the warping equation (\(a_3\)). This could be interpreted as the second column of a 3x3 linear transformation matrix (scale, rotation, and shear).
- property a4#
The fourth term of the warping equation (\(a_4\)). This could be interpreted as the third column of a 3x3 linear transformation matrix (scale, rotation, and shear).
- warp_point(self, point: ndarray[dtype=float64, shape=(3), device='cpu', writable=False]) numpy.ndarray[dtype=float64, shape=(3), device='cpu']#
Warps a single 3D point by putting
pointthrough the warping equation.- Parameters:
point – a 3-element ndarray.
- Returns:
A 3-element ndarray that represents the warped point.
- opynsim.tps3d.solve_coefficients(source_landmarks: ndarray[dtype=float64, shape=(*, 3), device='cpu', writable=False], destination_landmarks: ndarray[dtype=float64, shape=(*, 3), device='cpu', writable=False], *, warping_penalty: float = 0.0) opynsim._core.tps3d.TPSCoefficients3D#
Returns Thin-Plate Spline (TPS) warping coefficients.
Solves the coefficients by by pairing N “source” points (
source_landmarks) with N “destination” points (destination_landmarks).- Parameters:
source_landmarks – An (N, 3) ndarray of 3D points.
destination_landmarks – An (N, 3) ndarray of 3D points.
warping_penalty – A regularization term that penalizes warping in the solution. This can be desirable when the accuracy of the affine transform is more important than the smoothness of the warp (e.g. when solving joint frames), or when the landmarks are a little noisy and the output would benefit from some smoothing (e.g. for display, high-poly meshes). The concept originates from this paper, and is also exposed as
alphain the thin-plate-spline Python package.
- Returns:
A
TPSCoefficients3Dobject that contains the calculated coefficients.