R2LogR2RBF

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

Bases: RadialBasisFunction

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

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

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]

Apply the derivative of the basis function wrt the centres and the points given by points.

Note

Let points be x, then

..math:

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

where:

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

Vert`

Parameters:

x : (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 derivative of the radius from each centre wrt the centre’s position, evaluated at each point.

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