ThinPlateSplines(source, target, kernel=None, min_singular_val=0.0001)¶
The thin plate splines (TPS) alignment between 2D source and target landmarks.
kernelcan be used to specify an alternative kernel function. If
Noneis supplied, the
R2LogR2RBFkernel will be used.
(N, 2)ndarray) – The source points to apply the tps from
(N, 2)ndarray) – The target points to apply the tps to
RadialBasisFunction, optional) – The kernel to apply.
min_singular_val (float, optional) – If the target has points that are nearly coincident, the coefficients matrix is rank deficient, and therefore not invertible. Therefore, we only take the inverse on the full-rank matrix and drop any singular values that are less than this value (close to zero).
ValueError – TPS is only with on 2-dimensional data
The Frobenius Norm of the difference between the target and the aligned source.
apply(x, batch_size=None, **kwargs)¶
Applies this transform to
xwill be handed this transform object to transform itself non-destructively (a transformed copy of the object will be returned).
xis assumed to be an ndarray. The transformation will be non-destructive, returning the transformed version.
kwargswill be passed to the specific transform
(n_points, n_dims)ndarray) – The array or object to be transformed.
batch_size (int, optional) – If not
None, this determines how many items from the numpy array will be passed through the transform at a time. This is useful for operations that require large intermediate matrices to be computed.
kwargs (dict) – Passed through to
type(x)) – The transformed object or array
Deprecated as public supported API, use the non-mutating apply() instead.
For internal performance-specific uses, see _apply_inplace().
TransformChainthat represents this transform composed after the given transform:
c = a.compose_after(b) c.apply(p) == a.apply(b.apply(p))
bare left unchanged.
This corresponds to the usual mathematical formalism for the compose operator, o.
TransformChainthat represents this transform composed before the given transform:
c = a.compose_before(b) c.apply(p) == b.apply(a.apply(p))
bare left unchanged.
Generate an efficient copy of this object.
Note that Numpy arrays and other
selfwill be deeply copied. Dictionaries and sets will be shallow copied, and everything else will be assigned (no copy will be made).
Classes that store state other than numpy arrays and immutable types should overwrite this method to ensure all state is copied.
type(self)– A copy of this object
The pseudoinverse of the transform - that is, the transform that results from swapping source and target, or more formally, negating the transforms parameters. If the transform has a true inverse this is returned instead.
Update this object so that it attempts to recreate the
PointCloud) – The new target that this object should try and regenerate.
The output of the data from the transform.
Noneif the output of the transform is not dimension specific.
PointCloudthat is used in the alignment.
The source is not mutable.