R2LogRRBF

class menpo.transform.rbf.R2LogRRBF(c)[source]

Bases: RadialBasisFunction

Calculates the \(r^2 \log{r}\) basis function.

The derivative of this function is \(r (1 + 2 \log{r})\).

Note

\(r = \lVert x - c \rVert\)

Parameters:

c : (n_centres, n_dims) ndarray

The set of centers that make the basis. Usually represents a set of source landmarks.

apply(x, **kwargs)

Applies this transform to x.

If x is Transformable, x will be handed this transform object to transform itself non-destructively (a transformed copy of the object will be returned).

If not, x is assumed to be an ndarray. The transformation will be non-destructive, returning the transformed version.

Any kwargs will be passed to the specific transform _apply() method.

Parameters:

x : Transformable or (n_points, n_dims) ndarray

The array or object to be transformed.

kwargs : dict

Passed through to _apply().

Returns:

transformed : type(x)

The transformed object or array

apply_inplace(x, **kwargs)

Applies this transform to a Transformable x destructively.

Any kwargs will be passed to the specific transform _apply() method.

Parameters:

x : Transformable

The Transformable object to be transformed.

kwargs : dict

Passed through to _apply().

Returns:

transformed : type(x)

The transformed object

compose_after(transform)

Returns a TransformChain that represents this transform composed after the given transform:

c = a.compose_after(b)
c.apply(p) == a.apply(b.apply(p))

a and b are left unchanged.

This corresponds to the usual mathematical formalism for the compose operator, o.

Parameters:

transform : Transform

Transform to be applied before self

Returns:

transform : TransformChain

The resulting transform chain.

compose_before(transform)

Returns a TransformChain that represents this transform composed before the given transform:

c = a.compose_before(b)
c.apply(p) == b.apply(a.apply(p))

a and b are left unchanged.

Parameters:

transform : Transform

Transform to be applied after self

Returns:

transform : TransformChain

The resulting transform chain.

d_dl(points)[source]

The derivative of the basis function wrt the coordinate system evaluated at points.

\((x - c)^T (1 + 2 \log{r_{x, l}})\).

Note

:math:`r_{x, l} = lVert x - c

Vert`

Parameters:

points : (n_points, n_dims) ndarray

Set of points to apply the basis to.

Returns:

d_dl : (n_points, n_centres, n_dims) ndarray

The jacobian tensor representing the first order partial derivative of each points wrt the centres

n_dims

The RBF can only be applied on points with the same dimensionality as the centres.

n_dims_output

The result of the transform has a dimension (weight) for every centre